gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 67dca02 2/3: AM_CPPFLAGS and AM_LDFLAGS contai


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 67dca02 2/3: AM_CPPFLAGS and AM_LDFLAGS contain internal libraries
Date: Thu, 24 May 2018 14:39:10 -0400 (EDT)

branch: master
commit 67dca0255737cac69eaa1ad887ca73407167f053
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    AM_CPPFLAGS and AM_LDFLAGS contain internal libraries
    
    To tell the programs where to find the Gnulib and Gnuastro library headers
    and binary files, until now, we were modifying the global CPPFLAGS and
    LDFLAGS in `configure.ac'. However, this caused several complications: 1)
    forcing us to define `IN_CPPFLAGS' and `IN_LDFLAGS' for BuildProgram, 2)
    forcing us to remove the extra addresses from the installed
    `libgnuastro.la', 3) redundant (possible buggy) options when building and
    linking Gnulib and the library.
    
    To solve this problem, we are only adding the necessary directories in each
    program's `Makefile.am' through the `AM_CPPFLAGS' and `AM_LDFLAGS' options.
---
 bin/TEMPLATE/Makefile.am    |  8 ++++----
 bin/arithmetic/Makefile.am  |  6 +++---
 bin/buildprog/Makefile.am   | 29 +++++++++++++----------------
 bin/convertt/Makefile.am    |  6 +++---
 bin/convolve/Makefile.am    |  6 +++---
 bin/cosmiccal/Makefile.am   |  6 +++---
 bin/crop/Makefile.am        |  6 +++---
 bin/fits/Makefile.am        |  6 +++---
 bin/match/Makefile.am       |  6 +++---
 bin/mkcatalog/Makefile.am   |  6 +++---
 bin/mknoise/Makefile.am     |  6 +++---
 bin/mkprof/Makefile.am      |  6 +++---
 bin/noisechisel/Makefile.am |  6 +++---
 bin/segment/Makefile.am     | 10 +++++-----
 bin/statistics/Makefile.am  |  6 +++---
 bin/table/Makefile.am       |  6 +++---
 bin/warp/Makefile.am        |  6 +++---
 configure.ac                | 21 +--------------------
 lib/Makefile.am             | 17 -----------------
 19 files changed, 65 insertions(+), 104 deletions(-)

diff --git a/bin/TEMPLATE/Makefile.am b/bin/TEMPLATE/Makefile.am
index 8f159f2..b4888ba 100644
--- a/bin/TEMPLATE/Makefile.am
+++ b/bin/TEMPLATE/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.inx
 ##
 ## Original author:
-##      Mohammad akhlaghi <address@hidden>
+##     Mohammad akhlaghi <address@hidden>
 ## Contributing author(s):
 ## Copyright (C) 2016-2018, Free Software Foundation, Inc.
 ##
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/arithmetic/Makefile.am b/bin/arithmetic/Makefile.am
index 2e45ef4..865faa0 100644
--- a/bin/arithmetic/Makefile.am
+++ b/bin/arithmetic/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/buildprog/Makefile.am b/bin/buildprog/Makefile.am
index b76dd2e..1b1e724 100644
--- a/bin/buildprog/Makefile.am
+++ b/bin/buildprog/Makefile.am
@@ -19,14 +19,15 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
+## Necessary pre-processer and linker flags.
 ##
 ## Buildprog will also need some system-specific information that is
 ## gathered at compile time (for example the library installation directory
 ## (LIBDIR) and the executive file suffix (EXEEXT).
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -DLIBDIR=\"$(libdir)\"  \
-              -DINCLUDEDIR=\"$(includedir)\" -DEXEEXT=\"$(EXEEXT)\"
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib \
+              -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\"      \
+              -DEXEEXT=\"$(EXEEXT)\"
 
 
 
@@ -41,18 +42,16 @@ EXTRA_DIST = main.h authors-cite.h args.h ui.h buildprog.h 
astbuildprog.conf.in
 
 
 
-
-
-# Build the final configuration file. The main problem is the possible
-# CPPFLAGS and LDFLAGS that the user might have given at configure time
-# (stored in `IN_CPPFLAGS' and `IN_LDFLAGS' Makefile
-# variables). BuildProgram also needs to know these directories in order to
-# compile its programs. Thus with the rule below, the directories in these
-# variables will be written into the final BuildProgram configuration file.
+# Build the BuildProgram configuration file. The main problem is the
+# possible CPPFLAGS and LDFLAGS that the user might have given at
+# Gnuastro's configure time. BuildProgram also needs to know these
+# directories in order to compile its programs. With the rule below, the
+# directories in these variables will be written into the final
+# BuildProgram configuration file.
 astbuildprog.conf: $(top_srcdir)/bin/buildprog/astbuildprog.conf.in
        cp $< $@
        infoadded="no";                                \
-       for i in $(IN_CPPFLAGS); do                    \
+       for i in $(CPPFLAGS); do                       \
          if test $$infoadded = "no"; then             \
            echo "" >> $@;                             \
            echo "# Installation information" >> $@;   \
@@ -61,7 +60,7 @@ astbuildprog.conf: 
$(top_srcdir)/bin/buildprog/astbuildprog.conf.in
          v=$$(echo $$i | sed -e 's/-I//');            \
          echo " includedir $$v" >> $@;                \
        done;                                          \
-       for i in $(IN_LDFLAGS); do                     \
+       for i in $(LDFLAGS); do                        \
          if test $$infoadded = "no"; then             \
            echo "" >> $@;                             \
            echo "# Installation information" >> $@;   \
@@ -73,8 +72,6 @@ astbuildprog.conf: 
$(top_srcdir)/bin/buildprog/astbuildprog.conf.in
 
 
 
-
-
 ## The configuration file (clean, distribute and install).
 ## NOTE: the man page is created in doc/Makefile.am
 CLEANFILES = astbuildprog.conf
diff --git a/bin/convertt/Makefile.am b/bin/convertt/Makefile.am
index 847d8ba..0e86e59 100644
--- a/bin/convertt/Makefile.am
+++ b/bin/convertt/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/convolve/Makefile.am b/bin/convolve/Makefile.am
index ea3e80e..3cb2b03 100644
--- a/bin/convolve/Makefile.am
+++ b/bin/convolve/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/cosmiccal/Makefile.am b/bin/cosmiccal/Makefile.am
index 29b7487..39da4cc 100644
--- a/bin/cosmiccal/Makefile.am
+++ b/bin/cosmiccal/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/crop/Makefile.am b/bin/crop/Makefile.am
index 24c7a62..36680b7 100644
--- a/bin/crop/Makefile.am
+++ b/bin/crop/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/fits/Makefile.am b/bin/fits/Makefile.am
index fa43cad..e1eafa0 100644
--- a/bin/fits/Makefile.am
+++ b/bin/fits/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/match/Makefile.am b/bin/match/Makefile.am
index 8fb0e3c..adaca2c 100644
--- a/bin/match/Makefile.am
+++ b/bin/match/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/mkcatalog/Makefile.am b/bin/mkcatalog/Makefile.am
index 3576618..7ad37d8 100644
--- a/bin/mkcatalog/Makefile.am
+++ b/bin/mkcatalog/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/mknoise/Makefile.am b/bin/mknoise/Makefile.am
index c87dd7c..91e4e47 100644
--- a/bin/mknoise/Makefile.am
+++ b/bin/mknoise/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/mkprof/Makefile.am b/bin/mkprof/Makefile.am
index a132e69..6840a1a 100644
--- a/bin/mkprof/Makefile.am
+++ b/bin/mkprof/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/noisechisel/Makefile.am b/bin/noisechisel/Makefile.am
index 9434cad..5d86949 100644
--- a/bin/noisechisel/Makefile.am
+++ b/bin/noisechisel/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/segment/Makefile.am b/bin/segment/Makefile.am
index 030be30..b1e3ab8 100644
--- a/bin/segment/Makefile.am
+++ b/bin/segment/Makefile.am
@@ -1,9 +1,9 @@
 ## Process this file with automake to produce Makefile.inx
 ##
 ## Original author:
-##     Your Name <address@hidden>
+##     Mohammad Akhlaghi <address@hidden>
 ## Contributing author(s):
-## Copyright (C) YYYY, Free Software Foundation, Inc.
+## Copyright (C) 2018-2018, Free Software Foundation, Inc.
 ##
 ## Gnuastro is free software: you can redistribute it and/or modify it
 ## under the terms of the GNU General Public License as published by
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/statistics/Makefile.am b/bin/statistics/Makefile.am
index bd8e1c1..d0dddcf 100644
--- a/bin/statistics/Makefile.am
+++ b/bin/statistics/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/table/Makefile.am b/bin/table/Makefile.am
index ddedf1b..6d8cd40 100644
--- a/bin/table/Makefile.am
+++ b/bin/table/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/bin/warp/Makefile.am b/bin/warp/Makefile.am
index cfccc1b..501c4c1 100644
--- a/bin/warp/Makefile.am
+++ b/bin/warp/Makefile.am
@@ -19,9 +19,9 @@
 ## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-## Pre-processer flags (for Gnulib's headers). Recall that the compiled
-## Gnulib library was statically linked to (copied in) Gnuastro's library.
-AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib
+## Necessary pre-processer and linker flags.
+AM_LDFLAGS = -L\$(top_builddir)/lib
+AM_CPPFLAGS = -I\$(top_srcdir)/bootstrapped/lib -I\$(top_srcdir)/lib
 
 
 
diff --git a/configure.ac b/configure.ac
index b9045e7..07b37b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,28 +87,9 @@ AC_DEFINE([IN_GNUASTRO_BUILD], [1], [In building, not usage])
 
 
 
-# If any specific CPPFLAGS and LDFLAGS are given, we need to keep the raw
-# values (before they are changed in the next step) to pass onto
-# BuildProgram (which also needs them).
-AC_SUBST(IN_LDFLAGS, "$LDFLAGS")
-AC_SUBST(IN_CPPFLAGS, "$CPPFLAGS")
-
-
-
-
-
-# Generic compiler flags for all sub-directories.
-#
-# IMPORTANT note: we need to add the `./lib/' directory to `LDFLAGS' and
-# `CPPFLAGS', since all Gnuastro needs to use the library headers and link
-# with them. But we need to use the absolute address of `./lib/'. So we
-# need to use the Autoconf variables with an `abs_' prefix. Otherwise (if
-# we use `top_builddir' istead of `abs_top_builddir'), we are going to have
-# problems in special conditions (most specifically: in `make distcheck').
+# Add warnings and high optimization flags for all builds.
 CFLAGS="-Wall -O3 $CFLAGS"
 CXXFLAGS="-Wall -O3 $CXXFLAGS"
-LDFLAGS="-L\$(abs_top_builddir)/lib $LDFLAGS"
-CPPFLAGS="-I\$(abs_top_srcdir)/lib $CPPFLAGS"
 
 
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 82e556a..a6ee75a 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -156,20 +156,3 @@ gnuastro.pc: Makefile $(srcdir)/gnuastro.pc.in
        '$(srcdir)/address@hidden' >> address@hidden
        chmod a-w address@hidden
        mv address@hidden $@
-
-
-
-
-
-# Remove the two local directories we needed during installation from the
-# library search paths of the installed `libgnuastro.la'.
-#
-# Note that this hook is executed after every installation command
-# (including `make uninstall'). So we should only do it if the library
-# actually exists.
-install-exec-hook:
-       if [ -f $(libdir)/libgnuastro.la ]; then                   \
-         $(SED) -e 's/ -L..\/lib//g' -e 's/ -L..\/..\/lib//g'     \
-                $(libdir)/libgnuastro.la > libgnuastro.la_tmp;    \
-         mv libgnuastro.la_tmp $(libdir)/libgnuastro.la;          \
-       fi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]