From 0dfa2c84c21ed47f380328861e893d2a9879426d Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 13 Sep 1999 04:34:38 +0000 Subject: 1999-09-09 Roland McGrath * Makeconf (link-executable): New variable, partial linking commands for executables. ($(target)): Use it. Move .o's before -Wl,-(, just cause. ($(addsuffix .static,$(target))): New static pattern rule, use `$(link-executable) -static' and static hurd libs. [$(doinst) = one]: Give deps to $(target).static too. {"Decode makemode" page}: Set linktarg instead of cleantarg for each makemode that sets only one. [$(makemode) != library]: Append $(linktarg:=.static) to linktarg. [$(cleantarg) empty]: Set cleantarg to $(linktarg). [Installation section] (targets): Set to $(target) if empty. (installable): New variable, union of $(linktarg) and $(targets). Remove conditionals on $(doinst), leaving only multi-target version. Use $(installable) rather than $(targets) to compute list of targets for static pattern rule that does the install. (install-targets): New variable, $(targets) plus subset of $(linktarg) matching $(build-static:=.static). (all): Depend on $(install-targets) rather than $(targets). (install): Likewise for computed list of targets in $(installationdir). * config.make.in (build-static): New variable. * configure.in: Support --enable-static-progs=LIST. --- Makeconf | 56 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-) (limited to 'Makeconf') diff --git a/Makeconf b/Makeconf index aaafbb20..d29698e5 100644 --- a/Makeconf +++ b/Makeconf @@ -97,7 +97,7 @@ ifeq ($(makemode),server) doinst := one installationdir := $(hurddir) clean := yes - cleantarg := $(target) + linktarg := $(target) endif ifeq ($(makemode),utility) @@ -106,14 +106,14 @@ ifeq ($(makemode),utility) installationdir := $(bindir) endif clean := yes - cleantarg := $(target) + linktarg := $(target) endif ifeq ($(makemode),servers) doinst := many installationdir := $(hurddir) clean := yes - cleantarg := $(targets) + linktarg := $(targets) endif ifeq ($(makemode),utilities) @@ -122,7 +122,7 @@ ifeq ($(makemode),utilities) installationdir := $(bindir) endif clean := yes - cleantarg := $(targets) + linktarg := $(targets) endif ifeq ($(makemode),library) @@ -145,12 +145,15 @@ ifeq ($(makemode),library) targets := $(libname).a $(libname).so $(libname)_pic.a $(libname)_p.a endif endif +else + linktarg := $(linktarg) $(linktarg:=.static) endif -ifeq ($(linktarg),) - linktarg:=$(cleantarg) +ifeq ($(cleantarg),) + cleantarg := $(linktarg) endif + # This is a hack to give all hurd utilities a default bug-reporting # address (defined in libhurdbugaddr/bugaddr.c). BUGADDR = $(..)libhurdbugaddr/libhurdbugaddr.a @@ -172,19 +175,15 @@ endif endif # Installation -ifeq ($(doinst),one) -all: $(target) -install: $(installationdir) $(installationdir)/$(target) -$(installationdir)/$(target): $(target) - $(INSTALL_PROGRAM) $(INSTALL-$<-ops) $< $@ -endif - -ifeq ($(doinst),many) -all: $(targets) -install: $(installationdir) $(addprefix $(installationdir)/,$(targets)) -$(addprefix $(installationdir)/,$(targets)): $(installationdir)/%: % +ifndef targets +targets = $(target) +endif +installable := $(sort $(linktarg) $(targets)) +install-targets := $(targets) $(filter $(build-static:=.static),$(linktarg)) +all: $(install-targets) +install: $(installationdir) $(addprefix $(installationdir)/,$(install-targets)) +$(addprefix $(installationdir)/,$(installable)): $(installationdir)/%: % $(INSTALL_PROGRAM) $(INSTALL-$<-ops) $< $@ -endif ifeq ($(makemode),library) all: libs @@ -240,7 +239,7 @@ ifeq ($(doinst),many) endif ifeq ($(doinst),one) -$(target): $(OBJS) $(OTHERLIBS) $(library_deps) +$(target) $(target).static: $(OBJS) $(OTHERLIBS) $(library_deps) endif # Determine which sort of library we should link against from whether -static @@ -262,11 +261,22 @@ rpath := -Wl,-rpath-link=.:$(subst $. ,:,$(dir $(wildcard ../lib*/lib*.so))) # (prof-depend is a special kind of run not normally used; see the rules # below for %.prof_d which uses it.) ifeq ($(prof-depend),) + +define link-executable +$(CC) $(rpath) $(CFLAGS) $($*-CFLAGS) $(LDFLAGS) $($*-LDFLAGS) \ + $(BUGADDR_REF) \ + -o $@ +endef $(target): %$(target-suffix): $(BUGADDR) - $(CC) $(rpath) $(CFLAGS) $($*-CFLAGS) $(LDFLAGS) $($*-LDFLAGS) $(BUGADDR_REF) \ - -o $@ \ - '-Wl,-(' $(filter %.o,$^) \ - $(foreach lib,$(filter-out %.o,$+),${_libsubst}) $($*-LDLIBS) $(LDLIBS) \ + $(link-executable) \ + $(filter %.o,$^) \ + '-Wl,-(' $(foreach lib,$(filter-out %.o,$^),${_libsubst}) \ + $($*-LDLIBS) $(LDLIBS) \ + '-Wl,-)' + +$(addsuffix .static,$(target)): %$(target-suffix).static: $(BUGADDR) + $(link-executable) -static \ + '-Wl,-(' $(patsubst %.so,%.a,$^) $($*-LDLIBS) $(LDLIBS) \ '-Wl,-)' endif -- cgit v1.2.3