mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-14 00:37:41 -04:00
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>
This commit is contained in:
parent
21a2bc896e
commit
51f56dedf8
1 changed files with 8 additions and 6 deletions
14
Makefile
14
Makefile
|
@ -18,7 +18,7 @@ CONFIG_LOCALVERSION =
|
||||||
CPPFLAGS = -I libfdt -I .
|
CPPFLAGS = -I libfdt -I .
|
||||||
WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
|
WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
|
||||||
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
|
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
|
||||||
CFLAGS = -g -Os -fPIC -Werror $(WARNINGS)
|
CFLAGS = -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS)
|
||||||
|
|
||||||
BISON = bison
|
BISON = bison
|
||||||
LEX = flex
|
LEX = flex
|
||||||
|
@ -36,11 +36,13 @@ HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
|
||||||
sed -e 's/\(cygwin\).*/cygwin/')
|
sed -e 's/\(cygwin\).*/cygwin/')
|
||||||
|
|
||||||
ifeq ($(HOSTOS),darwin)
|
ifeq ($(HOSTOS),darwin)
|
||||||
SHAREDLIB_EXT=dylib
|
SHAREDLIB_EXT = dylib
|
||||||
SHAREDLIB_LINK_OPTIONS=-dynamiclib -Wl,-install_name -Wl,
|
SHAREDLIB_CFLAGS = -fPIC
|
||||||
|
SHAREDLIB_LDFLAGS = -fPIC -dynamiclib -Wl,-install_name -Wl,
|
||||||
else
|
else
|
||||||
SHAREDLIB_EXT=so
|
SHAREDLIB_EXT = so
|
||||||
SHAREDLIB_LINK_OPTIONS=-shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
|
SHAREDLIB_CFLAGS = -fPIC
|
||||||
|
SHAREDLIB_LDFLAGS = -fPIC -shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -330,7 +332,7 @@ clean: libfdt_clean pylibfdt_clean tests_clean
|
||||||
|
|
||||||
$(LIBFDT_lib):
|
$(LIBFDT_lib):
|
||||||
@$(VECHO) LD $@
|
@$(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
|
%.lex.c: %.l
|
||||||
@$(VECHO) LEX $@
|
@$(VECHO) LEX $@
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue