diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-10-29 15:19:58 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-10-29 15:19:58 +0000 |
commit | c0bdcba56e12723440598903fae42b2a60b1b573 (patch) | |
tree | 5bc652f19fe0f7e57b449244c375462f8833f4e5 | |
parent | 419f58c305c1fabe1955d743d450808038a208cb (diff) | |
download | skalibs-c0bdcba56e12723440598903fae42b2a60b1b573.tar.gz skalibs-c0bdcba56e12723440598903fae42b2a60b1b573.tar.xz skalibs-c0bdcba56e12723440598903fae42b2a60b1b573.zip |
Add pie test, don't double build on pie
-rw-r--r-- | Makefile | 6 | ||||
-rwxr-xr-x | configure | 14 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Makefile b/Makefile index f8b1a0a..65b9619 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,12 @@ INSTALL := ./tools/install.sh TYPES := size uid gid pid time dev ino ALL_SRCS := $(wildcard src/lib*/*.c) -ALL_SOBJS := $(ALL_SRCS:%.c=%.o) ALL_DOBJS := $(ALL_SRCS:%.c=%.lo) +ifeq ($(strip $(DEFAULT_PIE)),) +ALL_SOBJS := $(ALL_SRCS:%.c=%.o) +else +ALL_SOBJS := $(ALL_DOBJS) +endif ALL_LIBS := $(SHARED_LIBS) $(STATIC_LIBS) BUILT_INCLUDES := \ src/include/$(package)/sysdeps.h \ diff --git a/configure b/configure index f34dcd0..9d84974 100755 --- a/configure +++ b/configure @@ -377,6 +377,15 @@ if test -z "$target" ; then fi echo " ... $target" +defaultpie=false +echo "Checking whether we're building PIE..." +if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -dM -E - < /dev/null | grep -F __PIE__ ; then + defaultpie=true + echo " ... yes" +else + echo " ... no" +fi + tryflag CFLAGS_AUTO -std=c99 tryflag CFLAGS -fomit-frame-pointer tryflag CFLAGS_AUTO -fno-exceptions @@ -586,6 +595,11 @@ if $shared ; then else echo "SHARED_LIBS :=" fi +if $defaultpie ; then + echo "DEFAULT_PIE := true" +else + echo "DEFAULT_PIE :=" +fi exec 1>&3 3>&- echo " ... done." |