]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Get rid of all the duplicated settings of AM_CFLAGS in the makefiles
authorTom Hughes <tom@compton.nu>
Tue, 17 May 2005 16:11:40 +0000 (16:11 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 17 May 2005 16:11:40 +0000 (16:11 +0000)
for the various core modules and use a single global setting so that
the flags are actually consistent everywhere.

Also get rid of most the USE_PIE blocks in the makefiles by having
configure pass expand a variable in the new global AM_CFLAGS to one
of "-fpie" or "" depending on whether PIE is in use.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3760

17 files changed:
Makefile.core-AM_CPPFLAGS.am
auxprogs/Makefile.am
configure.in
coregrind/Makefile.am
coregrind/amd64-linux/Makefile.am
coregrind/amd64/Makefile.am
coregrind/arm-linux/Makefile.am
coregrind/arm/Makefile.am
coregrind/linux/Makefile.am
coregrind/m_aspacemgr/Makefile.am
coregrind/m_demangle/Makefile.am
coregrind/m_dispatch/Makefile.am
coregrind/m_replacemalloc/Makefile.am
coregrind/m_sigframe/Makefile.am
coregrind/m_syscalls/Makefile.am
coregrind/x86-linux/Makefile.am
coregrind/x86/Makefile.am

index fe9d406311f2abd91616edf132f4ad338b21967f..5055b2162bd0338b221762ad9e575873f7ac8619 100644 (file)
@@ -12,6 +12,11 @@ add_includes = -I$(top_srcdir)/coregrind \
                -DVGO_$(VG_OS)=1 \
                -DVGP_$(VG_ARCH)_$(VG_OS)=1
 
+BASE_AM_CFLAGS = @ARCH_CORE_AM_CFLAGS@ -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
+
+PIC_AM_CFLAGS = $(BASE_AM_CFLAGS) -fpic -fno-omit-frame-pointer
+
 AM_CPPFLAGS = $(add_includes)
+AM_CFLAGS = $(WERROR) @PIE_AM_CFLAGS@ $(BASE_AM_CFLAGS)
 AM_CCASFLAGS = $(add_includes) @ARCH_CORE_AM_CCASFLAGS@ -Wa,-gstabs
 
index 1e31292cabd468566a8970a3430473e7a283aed2..1c7ab40d58b8be1b7eb13cf893696b445cb0de8b 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Winline -Wall -O -g
-
 bin_PROGRAMS = valgrind-listener
 
 valgrind_listener_SOURCES = valgrind-listener.c
index f7db9808dfcd533b3f5f8b8e74ef11c6f6a927a0..11f2073f12ba502f003cc5191ce90cbd67a286e6 100644 (file)
@@ -335,6 +335,7 @@ AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
 fi
 
 # Check for PIE support in the compiler and linker
+AC_SUBST(PIE_AM_CFLAGS)
 AC_CACHE_CHECK([for PIE support], vg_cv_pie,
               [AC_ARG_ENABLE(pie, [  --enable-pie            platform supports PIE linking],
                [vg_cv_pie=$enableval],
@@ -350,6 +351,7 @@ AC_CACHE_CHECK([for PIE support], vg_cv_pie,
                  LDFLAGS=$safe_LDFLAGS])])
 if test "$vg_cv_pie" = yes; then
 AC_DEFINE([HAVE_PIE], 1, [can create position-independent executables])
+PIE_AM_CFLAGS="-fpie"
 fi
 AM_CONDITIONAL(USE_PIE, test "$vg_cv_pie" = "yes")
 
index ed1a206edca173ddf2ad27265842047d7d0e35c1..6c8430945b171238d52f5eeab63d457e7c4df883 100644 (file)
@@ -23,9 +23,6 @@ DIST_SUBDIRS = \
 AM_CPPFLAGS += -DVG_LIBDIR="\"$(valdir)"\" \
                -DKICKSTART_BASE=@KICKSTART_BASE@
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g @ARCH_CORE_AM_CFLAGS@
-AM_CFLAGS += -fno-omit-frame-pointer
-
 default.supp: $(SUPP_FILES)
 
 bin_PROGRAMS = \
@@ -120,7 +117,7 @@ stage2_extra= \
 ## only referred to by tool shared objects).
 stage2_extra2 = \
        m_replacemalloc/libreplacemalloc_core.a
-       
+
 ## Nb: older versions of automake don't seem to like having += within an
 ## if-then-else, so we have to use these variables for the common parts.
 st2_DEPS_common = \
@@ -133,14 +130,12 @@ st2_LDFLAGS_common = \
        -Wl,-version-script $(srcdir)/valgrind.vs
 
 if USE_PIE
-stage2_CFLAGS = $(AM_CFLAGS) -fpie
 stage2_DEPENDENCIES = $(st2_DEPS_common)
 stage2_LDFLAGS = \
        $(st2_LDFLAGS_common) \
        -Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \
        -pie
 else
-stage2_CFLAGS = $(AM_CFLAGS)
 stage2_DEPENDENCIES = $(st2_DEPS_common) ${VG_ARCH}/stage2.lds
 stage2_LDFLAGS = \
        $(st2_LDFLAGS_common) \
index a4daba551e9e971dc585371337e1518cd73dc3df..58b3a7328ba8f106d82f9817816eea5cc572a891 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
-
 noinst_HEADERS = \
        core_platform.h \
        vki_unistd.h
@@ -12,9 +10,3 @@ noinst_LIBRARIES = libplatform.a
 
 libplatform_a_SOURCES = \
        core_platform.c
-
-if USE_PIE
-libplatform_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libplatform_a_CFLAGS = $(AM_CFLAGS)
-endif
index 35729bb48f8962c93668d171476a3f0da47174b7..5248b709f29e756a2cb61c512bec60e552bd2c0d 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
-
 noinst_HEADERS = \
        core_arch.h
 
@@ -20,12 +18,6 @@ libarch_a_SOURCES = \
        jmp_with_stack.c \
        state.c
 
-if USE_PIE
-libarch_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libarch_a_CFLAGS = $(AM_CFLAGS)
-endif
-
 # Extract ld's default linker script and hack it to our needs
 stage2.lds: Makefile
        $(CC) -Wl,--verbose -nostdlib 2>&1 | sed \
index 0e434f3fa74434667d5bdbc40080bd6f6baa79fc..cb4cb1f8968bf48725637a57bcf7766d0055773f 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
-
 noinst_HEADERS = \
        core_platform.h \
        vki_unistd.h
@@ -11,8 +9,3 @@ noinst_LIBRARIES = libplatform.a
 
 libplatform_a_SOURCES =
 
-if USE_PIE
-libplatform_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libplatform_a_CFLAGS = $(AM_CFLAGS)
-endif
index c4a81e84eed0c2f8c3e9be23880812db586aa8fd..99b3d444194f8752a4f8d3cd0dbd4f7f0c41af6b 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
-
 noinst_HEADERS = \
        core_arch.h
 
@@ -18,12 +16,6 @@ CLEANFILES = stage2.lds
 libarch_a_SOURCES = \
        state.c
 
-if USE_PIE
-libarch_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libarch_a_CFLAGS = $(AM_CFLAGS)
-endif
-
 # Extract ld's default linker script and hack it to our needs
 stage2.lds: Makefile
        $(CC) -Wl,--verbose -nostdlib 2>&1 | sed \
index 871f9b25814374f4fc14ca86bfd574cbecad1119..33da84fcfa2a62344b4574f64c5bdc6b95b39bb7 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
-
 noinst_HEADERS = \
        core_os.h
 
@@ -11,9 +9,3 @@ noinst_LIBRARIES = libos.a
 libos_a_SOURCES = \
        core_os.c \
        sema.c
-
-if USE_PIE
-libos_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libos_a_CFLAGS = $(AM_CFLAGS)
-endif
index d8a662642072e2820976a2f4e8f2aee08feb58a4..30d62d2910b31005865a4193018e54c9b950f998 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
-
 EXTRA_DIST = \
        README_ASPACEMGR.txt
 
@@ -11,9 +9,3 @@ noinst_LIBRARIES = libaspacemgr.a
 libaspacemgr_a_SOURCES = \
        read_procselfmaps.c \
        aspacemgr.c
-
-if USE_PIE
-libaspacemgr_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libaspacemgr_a_CFLAGS = $(AM_CFLAGS)
-endif
index 3625614526462c755a815dfad756cc870ed156bd..fa521bfb33e321c07cbe15aa88c644b0a9f9e553 100644 (file)
@@ -1,14 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-## Test repeated in both arms of the if-then-else because older versions of
-## automake don't seem to like having += within an if-then-else.
-if USE_PIE
-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -g -fpie
-else
-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -g
-endif
-
 noinst_HEADERS = \
        ansidecl.h     \
        dyn-string.h   \
index d9b5cf6c8ffe00f1705ca35c972d0babd7c8ad93..79abd355b3eb7232aa89f10d068baff836b6876f 100644 (file)
@@ -1,17 +1,9 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
-
 noinst_LIBRARIES = libdispatch.a
 
 ## XXX: this won't work with "make dist" -- only one dispatch-XXX.S file
 ## will be put in the tarball.  Problem exists in various other Makefiles.
 libdispatch_a_SOURCES = \
        dispatch-@VG_ARCH@.S
-
-if USE_PIE
-libdispatch_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libdispatch_a_CFLAGS = $(AM_CFLAGS)
-endif
index 096492c96602186d8fee2cb44786acb655d6740a..4e1942d1b7b5af7f1bc3d56b1d3bcfed95bbe830 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
-
 EXTRA_DIST = \
        README_REPLACEMALLOC.txt
 
@@ -13,15 +11,9 @@ noinst_LIBRARIES = \
 libreplacemalloc_core_a_SOURCES = \
        replacemalloc_core.c
 
-if USE_PIE
-libreplacemalloc_core_a_CFLAGS         = $(AM_CFLAGS) -fpie
-else
-libreplacemalloc_core_a_CFLAGS = $(AM_CFLAGS)
-endif
-
 libreplacemalloc_toolpreload_a_SOURCES = \
        vg_replace_malloc.c
 libreplacemalloc_toolpreload_a_CFLAGS = \
-       $(AM_CFLAGS) -fpic -fno-omit-frame-pointer
+       $(PIC_AM_CFLAGS)
 
 
index 610ffba8984fc2326ba6bcf6898547069b2ef104..a7b1017baac730e2a0004130fb5121a6b13d1387 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
-
 EXTRA_DIST = \
        README_SIGFRAME.txt
 
@@ -10,9 +8,3 @@ noinst_LIBRARIES = libsigframe.a
 
 libsigframe_a_SOURCES = \
        sigframe-@VG_PLATFORM@.c
-
-if USE_PIE
-libsigframe_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libsigframe_a_CFLAGS = $(AM_CFLAGS)
-endif
index ff7ee9668c28727af5aab68b50c65ef95e5067da..796a082231172c21291da77a136206ba19575c8b 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
-
 EXTRA_DIST = \
        README_SYSCALLS.txt
 
@@ -12,7 +10,7 @@ noinst_HEADERS = \
        priv_syscalls-amd64-linux.h \
        priv_syscalls-arm-linux.h \
        priv_syscalls-x86-linux.h
-       
+
 noinst_LIBRARIES = libsyscalls.a
 
 libsyscalls_a_SOURCES = \
@@ -20,9 +18,3 @@ libsyscalls_a_SOURCES = \
        syscalls.c \
        syscalls-@VG_OS@.c \
        syscalls-@VG_PLATFORM@.c
-
-if USE_PIE
-libsyscalls_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libsyscalls_a_CFLAGS = $(AM_CFLAGS)
-endif
index ca6ac2e4cda4dc3bc774bac778ffd5b0d87383c2..58b3a7328ba8f106d82f9817816eea5cc572a891 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
-
 noinst_HEADERS = \
        core_platform.h \
        vki_unistd.h
@@ -12,9 +10,3 @@ noinst_LIBRARIES = libplatform.a
 
 libplatform_a_SOURCES = \
        core_platform.c
-
-if USE_PIE
-libplatform_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libplatform_a_CFLAGS = $(AM_CFLAGS)
-endif
index 03d41694b7f7d4aaeb7b67ff02f7226b577d954d..a3e429618a7574362eba470c0f76250faf91224b 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
-
 noinst_HEADERS = \
        core_arch.h
 
@@ -20,15 +18,9 @@ libarch_a_SOURCES = \
        jmp_with_stack.c \
        state.c
 
-if USE_PIE
-libarch_a_CFLAGS = $(AM_CFLAGS) -fpie
-else
-libarch_a_CFLAGS = $(AM_CFLAGS)
-endif
-
 # Extract ld's default linker script and hack it to our needs
 stage2.lds: Makefile
-       $(CC) -Wl,--verbose -nostdlib 2>&1 | sed \
+       $(CC) $(AM_CFLAGS) -Wl,--verbose -nostdlib 2>&1 | sed \
                -e '1,/^=====\+$$/d' \
                -e '/^=====\+$$/d' \
                -e 's/0x08048000/kickstart_base/g' > $@ || rm -f $@