-# Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# Cambridge, MA 02139, USA.
#
-# Propagated rules for making the GNU C library
+# Rules for making a subdirectory in the GNU C library.
+# Each subdirectory Makefile defines some variables and includes this.
#
ifneq (,)
This makefile requires GNU Make.
endif
+all: # Don't let the default goal come from Makeconfig.
+
include ../Makeconfig
ifndef subdir
Each subdirectory makefile must define the `subdir' variable.
endif
+# This is benign and useless in GNU make before 3.63.
+export subdir := $(subdir)
\f
-# This is the default target; it makes the library.
+# This is the default target; it makes the library and auxiliary programs.
.PHONY: all
-all: lib headers
+all: lib others
ifneq "$(findstring env,$(origin headers))" ""
-override headers :=
+headers :=
+endif
+
+ifneq "$(findstring env,$(origin generated))" ""
+generated :=
endif
ifeq "$(strip $(headers))" ""
.PHONY: subdir_lib
subdir_lib: lib-noranlib
-
-.PHONY: subdir_headers
-subdir_headers: headers
\f
# This makes all the auxilliary and test programs.
tests: $(tests:%=$(objpfx)%.out)
ifneq "$(strip $(others) $(tests))" ""
-$(addprefix $(objpfx),$(others) $(tests)): %: %.o lib
+$(addprefix $(objpfx),$(others) $(tests)): %: %.o $(libc.a)
$(+link)
endif
$(objpfx)%.out: $(objpfx)%
$(dir $<)$(notdir $<) > $@
endif # tests
+
+# Because the link above depends on libc.a, which I don't want built
+# automatically, this is necessary. -mib
+ifdef mib_hacks
+others :=
+endif
+
+export others := $(others)
+export tests := $(tests)
\f
# This removes everything that can be regenerated
# except for the object files and the object-file library members.
.PHONY: mostlyclean
mostlyclean:
- -rm -f $(addprefix $(objpfx),$(tests) $(others))
- -rm -f core TAGS depend
+ -rm -f $(addprefix $(objpfx),$(tests) $(others) \
+ $(addsuffix .o,$(tests) $(others)))
+ -rm -f core TAGS $(objpfx)depend-$(subdir)
# This removes absolutely everything that can be regenerated.
.PHONY: subdir_clean clean realclean
subdir_clean realclean: clean
-+objs := $(objects)
clean: mostlyclean
- -rm -f $(+objs) $(+depfiles)
+ -rm -f $(objects) $(addprefix $(objpfx),$(extra-objs)) \
+ $(+depfiles) $(generated)
\f
.PHONY: subdir_echo-headers
subdir_echo-headers: echo-headers
.PHONY: subdir_echo-distinfo
subdir_echo-distinfo:
@echo $(addprefix +header+,$(headers)) \
- $(addprefix +nodist+,$(dont_distribute))
-\f
+ $(addprefix +nodist+,$(generated) $(dont_distribute))
+
+# We want to install everything except the library itself, but update all
+# our portions of the library because the parent make will install it later
+# (likewise the stubs file).
.PHONY: subdir_install
-subdir_install: install
-\f
-# In most cases, we want the C source files to come before
-# the header files so tags for optimizing #define's in the
-# headers won't be put in the tags files, but for ctype,
-# the functions are just backup for the #define's in the header.
-ifeq "$(subdir)" "ctype"
-+tags_sources := *.h $(sources)
-else
-+tags_sources := $(sources) *.h
-endif
+subdir_install: install-no-libc.a lib-noranlib stubs
-# This makes the tags file.
-TAGS: $(+tags_sources)
- @$(cmdecho) '$(ctags) -f $@ ...'
- @$(ctags) -f $@ $^
.PHONY: subdir_TAGS
subdir_TAGS: TAGS
-\f
-# Make the distribution tarfile for the parent makefile.
-
-ifneq "$(findstring env,$(origin distribute))" ""
-override distribute :=
-endif
+# Make the distribution tarfile for the parent makefile.
+export distribute := $(distribute)
+export dont_distribute := $(dont_distribute)
+export generated := $(generated)
.PHONY: subdir_dist dist
subdir_dist: dist
dist: ../Make-dist
$(MAKE) -f $< $(Make-dist-args)
-\f
-# Keep these out of the environment so it doesn't get too big.
-override routines :=
-override aux :=
-override objects :=
+
+# Convenient target to update all the generated source files.
+.PHONY: generated
+generated: $(generated)