1 # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
20 # Propagated rules for making the GNU C library
23 This makefile requires GNU Make.
26 all: # Don't let the default goal come from Makeconfig.
31 Each subdirectory makefile must define the `subdir' variable.
33 # This is benign and useless in GNU make before 3.63.
34 export subdir := $(subdir)
36 # This is the default target; it makes the library and auxiliary programs.
40 ifneq "$(findstring env,$(origin headers))" ""
44 ifneq "$(findstring env,$(origin generated))" ""
48 ifeq "$(strip $(headers))" ""
49 ifneq "$(wildcard $(subdir).h)" ""
50 override headers := $(subdir).h
57 subdir_lib: lib-noranlib
59 # This makes all the auxilliary and test programs.
62 others: $(addprefix $(objpfx),$(others))
63 tests: $(tests:%=$(objpfx)%.out)
65 ifneq "$(strip $(others) $(tests))" ""
66 $(addprefix $(objpfx),$(others) $(tests)): %: %.o $(libc.a)
70 ifneq "$(strip $(tests))" ""
71 # These are the implicit rules for making test outputs
72 # from the test programs and whatever input files are present.
73 $(objpfx)%.out: $(objpfx)% %.args %.input
74 $(dir $<)$(notdir $<) `cat $(word 2,$^)` < $(word 3,$^) > $@
75 $(objpfx)%.out: $(objpfx)% %.args
76 $(dir $<)$(notdir $<) `cat $(word 2,$^)` > $@
77 $(objpfx)%.out: $(objpfx)% %.input
78 $(dir $<)$(notdir $<) < $(word 2,$^) > $@
79 $(objpfx)%.out: $(objpfx)%
80 $(dir $<)$(notdir $<) > $@
83 export others := $(others)
84 export tests := $(tests)
86 # This removes everything that can be regenerated
87 # except for the object files and the object-file library members.
90 -rm -f $(addprefix $(objpfx),$(tests) $(others) \
91 $(addsuffix .o,$(tests) $(others)))
92 -rm -f core TAGS $(objpfx)depend-$(subdir)
94 # This removes absolutely everything that can be regenerated.
95 .PHONY: subdir_clean clean realclean
96 subdir_clean realclean: clean
98 -rm -f $(objects) $(addprefix $(objpfx),$(extra-objs)) \
99 $(+depfiles) $(generated)
101 .PHONY: subdir_echo-headers
102 subdir_echo-headers: echo-headers
104 .PHONY: subdir_echo-distinfo
105 subdir_echo-distinfo:
106 @echo $(addprefix +header+,$(headers)) \
107 $(addprefix +nodist+,$(generated))
109 .PHONY: subdir_install
110 subdir_install: install-no-libc.a
115 # Make the distribution tarfile for the parent makefile.
116 export distribute := $(distribute)
117 export generated := $(generated)
118 .PHONY: subdir_dist dist
121 $(MAKE) -f $< $(Make-dist-args)
123 # Convenient target to update all the generated source files.
125 generated: $(generated)