aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2017-05-19 16:11:48 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2017-05-19 16:11:48 +1000
commit51f56dedf8ea1108edc66150c0bf7e9f76b48daa (patch)
treeb8fd5afa29016fb325da6b83b9d3e90734ce5d34
parent21a2bc896e3d6ccff22f9224d5e554c198eee04d (diff)
downloaddtc-51f56dedf8ea1108edc66150c0bf7e9f76b48daa.zip
dtc-51f56dedf8ea1108edc66150c0bf7e9f76b48daa.tar.gz
dtc-51f56dedf8ea1108edc66150c0bf7e9f76b48daa.tar.bz2
Clean up shared library compile/link options
- Allow overriding of shared library compile time flags for platforms whic need it - Include -fPIC in the link flags variable instead of including it raw in the target rule - Cosmetic formatting tweaks Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--Makefile14
1 files changed, 8 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index beca4a0..7fa2be8 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ CONFIG_LOCALVERSION =
CPPFLAGS = -I libfdt -I .
WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
-CFLAGS = -g -Os -fPIC -Werror $(WARNINGS)
+CFLAGS = -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS)
BISON = bison
LEX = flex
@@ -36,11 +36,13 @@ HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
sed -e 's/\(cygwin\).*/cygwin/')
ifeq ($(HOSTOS),darwin)
-SHAREDLIB_EXT=dylib
-SHAREDLIB_LINK_OPTIONS=-dynamiclib -Wl,-install_name -Wl,
+SHAREDLIB_EXT = dylib
+SHAREDLIB_CFLAGS = -fPIC
+SHAREDLIB_LDFLAGS = -fPIC -dynamiclib -Wl,-install_name -Wl,
else
-SHAREDLIB_EXT=so
-SHAREDLIB_LINK_OPTIONS=-shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
+SHAREDLIB_EXT = so
+SHAREDLIB_CFLAGS = -fPIC
+SHAREDLIB_LDFLAGS = -fPIC -shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
endif
#
@@ -330,7 +332,7 @@ clean: libfdt_clean pylibfdt_clean tests_clean
$(LIBFDT_lib):
@$(VECHO) LD $@
- $(CC) $(LDFLAGS) -fPIC $(SHAREDLIB_LINK_OPTIONS)$(LIBFDT_soname) -o $(LIBFDT_lib) $^
+ $(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS)$(LIBFDT_soname) -o $(LIBFDT_lib) $^
%.lex.c: %.l
@$(VECHO) LEX $@