summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-03-17 18:42:51 +0000
committerRoland McGrath <roland@gnu.org>1995-03-17 18:42:51 +0000
commit693e7b964f9d91d9df97b776718271c94131dcbd (patch)
treef8c09ba386017b689388f0dfd9b2cf8b3f647fd6
parent68b3ef49b933afbc35d4b78b99c5adafffc97770 (diff)
downloadglibc-693e7b964f9d91d9df97b776718271c94131dcbd.tar.gz
glibc-693e7b964f9d91d9df97b776718271c94131dcbd.tar.xz
glibc-693e7b964f9d91d9df97b776718271c94131dcbd.zip
Fri Mar 17 12:58:37 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
	* sunrpc/Makefile (install-lib): Variable removed.
	(rpcsvc-objs): Variable removed.
	(extra-objs): Don't include $(rpcsvc-objs).
	(extra-libs): New variable, contains librpcsvc.
	(librpcsvc-routines): New variable.
	(librpcsvc-inhibit-o): New variable, contains .so.
	(omit-deps): Set this to $(librpcsvc-routines).
	($(objpfx)rpcgen): Don't use $(libc.a).
	(lib, $(objpfx)librpcsvc.a): Targets removed.

	* o-iterator.mk, extra-lib.mk: New files.
	* Makerules (o-iterator): New variable.
	[extra-libs]: Include extra-lib.mk to generate rules for each word
	of $(extra-libs).
	* Makefile (distribute): Add extra-lib.mk, o-iterator.mk.

	(IMPLICIT_ONE, *_MAX_10_EXP_LOG): Macros removed; no longer needed.
	* stdio/fpioconst.c, stdio/fpioconst.h: Don't use
 	LDBL_MAX_10_EXP_LOG; LAST_POW10 defines the maximal available
 	exponent.
-rw-r--r--ChangeLog25
-rw-r--r--Makefile1
-rw-r--r--Makerules17
-rw-r--r--extra-lib.mk29
-rw-r--r--o-iterator.mk9
-rw-r--r--sunrpc/Makefile29
6 files changed, 86 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 40d61f4abc..6f7a40ee92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,34 @@
+Fri Mar 17 12:58:37 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
+
+	* sunrpc/Makefile (install-lib): Variable removed.
+	(rpcsvc-objs): Variable removed.
+	(extra-objs): Don't include $(rpcsvc-objs).
+	(extra-libs): New variable, contains librpcsvc.
+	(librpcsvc-routines): New variable.
+	(librpcsvc-inhibit-o): New variable, contains .so.
+	(omit-deps): Set this to $(librpcsvc-routines).
+	($(objpfx)rpcgen): Don't use $(libc.a).
+	(lib, $(objpfx)librpcsvc.a): Targets removed.
+
+	* o-iterator.mk, extra-lib.mk: New files.
+	* Makerules (o-iterator): New variable.
+	[extra-libs]: Include extra-lib.mk to generate rules for each word
+	of $(extra-libs).
+	* Makefile (distribute): Add extra-lib.mk, o-iterator.mk.
+
 Fri Mar 17 13:28:04 1995  Ulrich Drepper  <drepper@ipd.info.uni-karlsruhe.de>
 
 	* sysdeps/ieee754/ldbl2mpn.c (__mpn_extract_long_double):
 	Handle 80-bit denormalized numbers correctly.
 
 	* stdlib/strtod.c, stdlib/strtof.c, stdlib/strtold.c:
-	[IMPLICIT_ONE,*_MAX_10_EXP_LOG]: not needed anymore.
+	(IMPLICIT_ONE, *_MAX_10_EXP_LOG): Macros removed; no longer needed.
 	* stdlib/strtod.c (RETURN): Add parentheses around return value.
 	(round_and_return): Correct handling of denormalized numbers.
 
-	* stdio/fpioconst.[ch]: [LDBL_MAX_10_EXP_LOG]: don't use it.
-	LAST_POW10 defines the maximal available exponent.
+	* stdio/fpioconst.c, stdio/fpioconst.h: Don't use
+ 	LDBL_MAX_10_EXP_LOG; LAST_POW10 defines the maximal available
+ 	exponent.
 
 Thu Mar 16 00:04:41 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
diff --git a/Makefile b/Makefile
index e3ec603ced..8cf294f651 100644
--- a/Makefile
+++ b/Makefile
@@ -217,6 +217,7 @@ parent_echo-distinfo:
 
 distribute  := README INSTALL NOTES COPYING.LIB COPYING ChangeLog NEWS	\
 	       Makefile Makeconfig Makerules Rules Make-dist MakeTAGS	\
+	       extra-lib.mk o-iterator.mk				\
 	       ansidecl.h mkinstalldirs move-if-change install-sh	\
 	       configure configure.in aclocal.m4 config.sub config.guess\
 	       config.make.in config-name.in Makefile.in \
diff --git a/Makerules b/Makerules
index 6a8073006c..d8d571d993 100644
--- a/Makerules
+++ b/Makerules
@@ -262,6 +262,23 @@ sysdep_routines := $(sysdep_routines)
 # This is the list of all object files, gotten by
 # replacing every ".c" in `sources' with a ".o".
 override objects	:= $(addprefix $(objpfx),$(sources:.c=.o))
+
+
+# This variable is used in ``include $(o-iterator)'' after defining
+# $(o-iterator-doit) to produce some desired rule using $o for the object
+# suffix, and setting $(object-suffixes-left) to $(object-suffixes); a copy
+# is produced for each object suffix in use.
+o-iterator = $(patsubst %,$(..)o-iterator.mk,$(object-suffixes))
+
+# The makefile may define $(extra-libs) with `libfoo libbar'
+# to build libfoo.a et al from the modules listed in $(libfoo-routines).
+ifdef extra-libs
+# extra-lib.mk is included once for each extra lib to define rules
+# to build it, and to add its objects to the various variables.
+# During its evaluation, $(lib) is set to the name of the library.
+extra-libs-left := $(extra-libs)
+include $(patsubst %,$(..)extra-lib.mk,$(extra-libs))
+endif
 
 +depfiles := $(strip $(sources:.c=.d) \
 		     $(patsubst %.o,%.d,$(filter %.o,$(extra-objs))) \
diff --git a/extra-lib.mk b/extra-lib.mk
new file mode 100644
index 0000000000..353b576872
--- /dev/null
+++ b/extra-lib.mk
@@ -0,0 +1,29 @@
+# This file is included several times in a row, once
+# for each element of $(extra-libs).  $(extra-libs-left)
+# is initialized first to $(extra-libs) so that with each
+# inclusion, we advance $(lib) to the next library name (e.g. libfoo).
+# The variable $($(lib)-routines) defines the list of modules
+# to be included in that library.
+
+lib := $(firstword $(extra-libs-left))
+extra-libs-left := $(filter-out $(lib),$(extra-libs-left))
+
+# Add each flavor of library to the lists of things to build and install.
+install-lib += $(foreach o,$(object-suffixes),$(lib:lib%=$(libtype$o)))
+extra-objs += $(foreach o,$(object-suffixes),$($(lib)-routines:=$o))
+alltypes-$(lib) = $(foreach o,$(object-suffixes),\
+			    $(objpfx)$(patsubst %,$(libtype$o),\
+			    $(lib:lib%=%)))
+ifeq (yes,$(build-shared))
+alltypes-$(lib) += $(objpfx)$(lib).so
+endif
+
+lib-noranlib: $(alltypes-$(lib))
+
+# Use o-iterator.mk to generate a rule for each flavor of library.
+define o-iterator-doit
+$(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
+  $($(lib)-routines:%=$(objpfx)%$o); $$(build-extra-lib)
+endef
+object-suffixes-left := $(filter-out $($(lib)-inhibit-o),$(object-suffixes))
+include $(o-iterator)
diff --git a/o-iterator.mk b/o-iterator.mk
new file mode 100644
index 0000000000..18a6e48ae3
--- /dev/null
+++ b/o-iterator.mk
@@ -0,0 +1,9 @@
+# This file is included several times in a row, once
+# for each element of $(object-suffixes).  $(object-suffixes-left)
+# is initialized first to $(object-suffixes) so that with each
+# inclusion, we advance $o to the next suffix.
+
+o := $(firstword $(object-suffixes-left))
+object-suffixes-left := $(filter-out $o,$(object-suffixes-left))
+
+$(o-iterator-doit)
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index 6a5f895722..40026fecd4 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -64,25 +64,27 @@ routines := auth_none auth_unix authuxprot bindrsvprt \
 	    svc_tcp svc_udp xdr xdr_array xdr_float xdr_mem \
 	    xdr_rec xdr_ref xdr_stdio
 
-install-lib := librpcsvc.a
+others := portmap rpcinfo
 install-bin := rpcgen
 install-sbin := rpcinfo portmap
-rpcsvc-objs = $(rpcsvc:%.x=x%.o)
 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
 	      rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o
-extra-objs = $(rpcgen-objs) $(rpcsvc-objs)
-omit-deps = $(basename $(rpcsvc-objs))
 # These headers are part of rpcgen.
 distribute := rpc_util.h rpc_parse.h rpc_scan.h $(rpcgen-objs:.o=.c) etc.rpc
+extra-objs = $(rpcgen-objs)
+
+extra-libs := librpcsvc
+librpcsvc-routines = $(rpcsvc:%.x=x%)
+librpcsvc-inhibit-o = .so # Build no shared rpcsvc library.
+omit-deps = $(librpcsvc-routines)
 
-others := portmap rpcinfo
 
 # Sun's code is not too clean.
 override +gccwarn := -w
 
 include ../Rules
 
-$(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(libc.a)
+$(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a
 	$(+link)
 
 rpcgen-cmd = $(dir $(word 2,$^))$(notdir $(word 2,$^))
@@ -100,21 +102,6 @@ $(sysconfdir)/rpc: etc.rpc
 
 defines := $(defines) -D_PATH_RPC='"$(sysconfdir)/rpc"'
 
-# Build the `rpcsvc' library of XDR functions.
-
-lib: $(objpfx)librpcsvc.a
-
-$(objpfx)librpcsvc.a: $(addprefix $(objpfx),$(rpcsvc-objs))
-# This library is small enough that it's simplest to recreate the archive
-# from scratch each time.
-	rm -f $@
-ifdef objdir
-	cd $(objdir); $(AR) cq$(verbose) $@ $(^:$(objpfx)%=%)
-else
-	$(AR) cq$(verbose) $@ $^
-endif
-	$(RANLIB) $@
-
 # Generate the rpcsvc headers with rpcgen.
 $(objpfx)rpcsvc/%.h: rpcsvc/%.x $(objpfx)rpcgen
 	$(make-target-directory)