diff options
-rw-r--r-- | Makefile | 13 | ||||
-rwxr-xr-x | configure | 19 | ||||
-rw-r--r-- | package/deps.mak | 6 | ||||
-rw-r--r-- | src/libs6net/deps-lib/s6net | 1 | ||||
-rwxr-xr-x | tools/gen-deps.sh | 14 |
5 files changed, 33 insertions, 20 deletions
@@ -20,8 +20,6 @@ INTERNAL_LIBS := EXTRA_TARGETS := LIB_DEFS := --include config.mak - define library_definition = LIB$(firstword $(subst =, ,$(1))) := lib$(lastword $(subst =, ,$(1))).$(if $(DO_ALLSTATIC),a,so).xyzzy ifdef DO_SHARED @@ -32,6 +30,7 @@ STATIC_LIBS += lib$(lastword $(subst =, ,$(1))).a.xyzzy endif endef +-include config.mak include package/targets.mak $(foreach var,$(LIB_DEFS),$(eval $(call library_definition,$(var)))) @@ -45,8 +44,6 @@ CPPFLAGS_ALL := -iquote src/include-local -Isrc/include $(CPPFLAGS) CFLAGS_ALL := $(CFLAGS) -pipe -Wall CFLAGS_SHARED := -fPIC LDFLAGS_ALL := $(LDFLAGS) -LDFLAGS_SHARED := -shared -LDLIBS_ALL := $(LDLIBS) REALCC = $(CROSS_COMPILE)$(CC) AR := $(CROSS_COMPILE)ar RANLIB := $(CROSS_COMPILE)ranlib @@ -95,12 +92,12 @@ ifneq ($(exthome),) update: exec $(INSTALL) -l $(notdir $(home)) $(DESTDIR)$(exthome) -global-links: $(DESTDIR)$(exthome) $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(sproot)/library.so/lib%.so) $(BIN_TARGETS:%=$(DESTDIR)$(sproot)/command/%) $(SBIN_TARGETS:%=$(DESTDIR)$(sproot)/command/%) +global-links: $(DESTDIR)$(exthome) $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(sproot)/library.so/lib%.so.$(version_M)) $(BIN_TARGETS:%=$(DESTDIR)$(sproot)/command/%) $(SBIN_TARGETS:%=$(DESTDIR)$(sproot)/command/%) $(DESTDIR)$(sproot)/command/%: $(DESTDIR)$(home)/command/% exec $(INSTALL) -D -l ..$(subst $(sproot),,$(exthome))/command/$(<F) $@ -$(DESTDIR)$(sproot)/library.so/lib%.so: $(DESTDIR)$(dynlibdir)/lib%.so +$(DESTDIR)$(sproot)/library.so/lib%.so.$(version_M): $(DESTDIR)$(dynlibdir)/lib%.so.$(version_M) exec $(INSTALL) -D -l ..$(subst $(sproot),,$(exthome))/library.so/$(<F) $@ .PHONY: update global-links @@ -136,14 +133,14 @@ $(DESTDIR)$(includedir)/$(package)/%.h: src/include/$(package)/%.h exec $(REALCC) $(CPPFLAGS_ALL) $(CFLAGS_ALL) $(CFLAGS_SHARED) -c -o $@ $< $(ALL_BINS): - exec $(REALCC) -o $@ $(CFLAGS_ALL) $(LDFLAGS_ALL) $(LDFLAGS_NOSHARED) $^ $(EXTRA_LIBS) $(LDLIBS_ALL) + exec $(REALCC) -o $@ $(CFLAGS_ALL) $(LDFLAGS_ALL) $(LDFLAGS_NOSHARED) $^ $(EXTRA_LIBS) $(LDLIBS) lib%.a.xyzzy: exec $(AR) rc $@ $^ exec $(RANLIB) $@ lib%.so.xyzzy: - exec $(REALCC) -o $@ $(CFLAGS_ALL) $(CFLAGS_SHARED) $(LDFLAGS_ALL) $(LDFLAGS_SHARED) -Wl,-soname,$(patsubst lib%.so.xyzzy,lib%.so.$(version_l),$@) $^ + exec $(REALCC) -o $@ $(CFLAGS_ALL) $(CFLAGS_SHARED) $(LDFLAGS_ALL) $(LDFLAGS_SHARED) -Wl,-soname,$(patsubst lib%.so.xyzzy,lib%.so.$(version_M),$@) $^ $(EXTRA_LIBS) $(LDLIBS) .PHONY: it all clean distclean tgz strip install install-dynlib install-bin install-sbin install-lib install-include install-data @@ -124,6 +124,7 @@ CC_AUTO="$CC" CFLAGS_AUTO="$CFLAGS" CPPFLAGS_AUTO="-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -O2 $CPPFLAGS" LDFLAGS_AUTO="$LDFLAGS" +LDFLAGS_SHARED=-shared LDFLAGS_NOSHARED= prefix= exec_prefix='$prefix' @@ -245,10 +246,8 @@ if $slashpackage ; then addincpath="$addincpath -I${sproot}${dep}/include" vpaths="$vpaths ${sproot}${dep}/library" addlibspath="$addlibspath -L${sproot}${dep}/library" - if $allstatic ; then : ; else - vpathd="$vpathd ${sproot}${dep}/library.so" - addlibdpath="$addlibdpath -L${sproot}${dep}/library.so" - fi + vpathd="$vpathd ${sproot}${dep}/library.so" + addlibdpath="$addlibdpath -L${sproot}${dep}/library.so" done < package/deps-build fi @@ -305,6 +304,15 @@ fi if $shared ; then tryldflag LDFLAGS_AUTO -Wl,--hash-style=both + tryldflag LDFLAGS_SHARED -Wl,-Bsymbolic +fi + +LDFLAGS_SHARED="${LDFLAGS_SHARED}${addlibdpath}" + +if $allstatic ; then + LDFLAGS_NOSHARED="${LDFLAGS_NOSHARED}${addlibspath}" +else + LDFLAGS_NOSHARED="${LDFLAGS_NOSHARED}${addlibdpath}" fi if test -z "$vpaths" ; then @@ -316,8 +324,6 @@ if test -z "$vpaths" ; then fi CPPFLAGS_AUTO="$CPPFLAGS_AUTO $addincpath" -LDFLAGS_AUTO="$LDFLAGS_AUTO $addlibspath" -$allstatic || LDFLAGS_AUTO="$LDFLAGS_AUTO $addlibdpath" echo "creating config.mak..." cmdline=$(quote "$0") @@ -355,6 +361,7 @@ CC := $CC_AUTO CFLAGS := $CFLAGS_AUTO CPPFLAGS := $CPPFLAGS_AUTO LDFLAGS := $LDFLAGS_AUTO +LDFLAGS_SHARED := $LDFLAGS_SHARED LDFLAGS_NOSHARED := $LDFLAGS_NOSHARED CROSS_COMPILE := $cross diff --git a/package/deps.mak b/package/deps.mak index 23d9089..e7bf620 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -25,6 +25,7 @@ src/libs6net/s6net_ident_reply_get.o src/libs6net/s6net_ident_reply_get.lo: src/ src/libs6net/s6net_ident_reply_parse.o src/libs6net/s6net_ident_reply_parse.lo: src/libs6net/s6net_ident_reply_parse.c src/include/s6-networking/ident.h src/minidentd/mgetuid-default.o src/minidentd/mgetuid-default.lo: src/minidentd/mgetuid-default.c src/minidentd/mgetuid.h src/minidentd/mgetuid-linux.o src/minidentd/mgetuid-linux.lo: src/minidentd/mgetuid-linux.c src/minidentd/mgetuid.h +src/minidentd/mgetuid.o src/minidentd/mgetuid.lo: src/minidentd/mgetuid.c src/minidentd/mgetuid.h src/minidentd/minidentd.o src/minidentd/minidentd.lo: src/minidentd/minidentd.c src/minidentd/mgetuid.h s6-clockadd: private EXTRA_LIBS := ${SYSCLOCK_LIB} @@ -59,7 +60,8 @@ s6-tcpserver6-socketbinder: private EXTRA_LIBS := ${SOCKET_LIB} s6-tcpserver6-socketbinder: src/conn-tools/s6-tcpserver6-socketbinder.o -lskarnet s6-tcpserver6d: private EXTRA_LIBS := ${SOCKET_LIB} s6-tcpserver6d: src/conn-tools/s6-tcpserver6d.o -lskarnet -libs6net.a.xyzzy: src/libs6net/s6net_ident_client.o src/libs6net/s6net_ident_reply_get.o src/libs6net/s6net_ident_reply_parse.o src/libs6net/s6net_ident_error.o -libs6net.so.xyzzy: src/libs6net/s6net_ident_client.lo src/libs6net/s6net_ident_reply_get.lo src/libs6net/s6net_ident_reply_parse.lo src/libs6net/s6net_ident_error.lo +libs6net.a.xyzzy: src/libs6net/s6net_ident_client.o src/libs6net/s6net_ident_reply_get.o src/libs6net/s6net_ident_reply_parse.o src/libs6net/s6net_ident_error.o +libs6net.so.xyzzy: private EXTRA_LIBS := -lskarnet +libs6net.so.xyzzy: src/libs6net/s6net_ident_client.lo src/libs6net/s6net_ident_reply_get.lo src/libs6net/s6net_ident_reply_parse.lo src/libs6net/s6net_ident_error.lo minidentd: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} minidentd: src/minidentd/minidentd.o src/minidentd/mgetuid.o -lskarnet diff --git a/src/libs6net/deps-lib/s6net b/src/libs6net/deps-lib/s6net index 1b15735..27067c4 100644 --- a/src/libs6net/deps-lib/s6net +++ b/src/libs6net/deps-lib/s6net @@ -2,3 +2,4 @@ s6net_ident_client.o s6net_ident_reply_get.o s6net_ident_reply_parse.o s6net_ident_error.o +-lskarnet diff --git a/tools/gen-deps.sh b/tools/gen-deps.sh index 1ca66ea..f8cf5ee 100755 --- a/tools/gen-deps.sh +++ b/tools/gen-deps.sh @@ -57,11 +57,17 @@ echo for dir in $(ls -1 src | grep -v ^include) ; do for file in $(ls -1 src/$dir/deps-lib) ; do deps= + libs= while read dep ; do - deps="$deps src/$dir/$dep" + if echo $dep | grep -q -e ^-l -e '^\${.*_LIB}' ; then + libs="$libs $dep" + else + deps="$deps src/$dir/$dep" + fi done < src/$dir/deps-lib/$file - echo "lib$file.a.xyzzy: $deps" - echo "lib${file}.so.xyzzy: $(echo "$deps" | sed 's/\.o/.lo/g')" + echo "lib${file}.a.xyzzy:$deps" + echo "lib${file}.so.xyzzy: private EXTRA_LIBS :=$libs" + echo "lib${file}.so.xyzzy:$(echo "$deps" | sed 's/\.o/.lo/g')" done for file in $(ls -1 src/$dir/deps-exe) ; do @@ -71,7 +77,7 @@ for dir in $(ls -1 src | grep -v ^include) ; do if echo $dep | grep -q -- \\.o$ ; then dep="src/$dir/$dep" fi - if echo $dep | grep -q '^\${.*_LIB}' ; then + if echo $dep | grep -q -- '^\${.*_LIB}' ; then libs="$libs $dep" else deps="$deps $dep" |