summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-08-12 19:59:00 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-08-12 19:59:00 +0000
commit6f770a9de51ca5b37646bc76a5c13386b2bfd078 (patch)
treec51129b013adcf34df1c0dc4b93856a5ac68034f /Makefile
parentc33f8ef19fdb814169fb27c3ebac902d078c200c (diff)
downloads6-linux-utils-6f770a9de51ca5b37646bc76a5c13386b2bfd078.tar.gz
s6-linux-utils-6f770a9de51ca5b37646bc76a5c13386b2bfd078.tar.xz
s6-linux-utils-6f770a9de51ca5b37646bc76a5c13386b2bfd078.zip
Link shared libs against their -l deps, better libpath management v2.0.2.2
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 5 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 29a1875..6eba87f 100644
--- a/Makefile
+++ b/Makefile
@@ -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