]> git.ipfire.org Git - thirdparty/glibc.git/blame - Rules
Wed May 22 00:40:50 1996 David Mosberger-Tang <davidm@azstarnet.com>
[thirdparty/glibc.git] / Rules
CommitLineData
a182affd 1# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
28f540f4
RM
2# This file is part of the GNU C Library.
3
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.
8
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.
13
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.
18
19#
20# Rules for making a subdirectory in the GNU C library.
21# Each subdirectory Makefile defines some variables and includes this.
22#
23ifneq (,)
24This makefile requires GNU Make.
25endif
26
27all: # Don't let the default goal come from Makeconfig.
28
29include ../Makeconfig
30
31ifndef subdir
32Each subdirectory makefile must define the `subdir' variable.
33endif
34# This is benign and useless in GNU make before 3.63.
35export subdir := $(subdir)
36\f
37# This is the default target; it makes the library and auxiliary programs.
38.PHONY: all
96f873b9 39all: objs lib others
28f540f4 40
a182affd
RM
41others: $(addprefix $(objpfx),$(extra-objs) \
42 $(install-lib) $(install-bin) $(install-sbin))
43
28f540f4
RM
44ifneq "$(findstring env,$(origin headers))" ""
45headers :=
46endif
47
48ifneq "$(findstring env,$(origin generated))" ""
49generated :=
50endif
51
52ifeq "$(strip $(headers))" ""
53ifneq "$(wildcard $(subdir).h)" ""
54override headers := $(subdir).h
55endif
56endif
57
58include ../Makerules
59
60.PHONY: subdir_lib
3bbceb12 61subdir_lib: lib-noranlib
28f540f4
RM
62
63# Some subdirs need to install a dummy library.
64# They can use "$(objpfx)libfnord.a: $(dep-dummy-lib); $(make-dummy-lib)".
65dep-dummy-lib = $(objpfx)dummy.o
66define make-dummy-lib
67$(AR) cr$(verbose) $@ $<
68endef
69$(objpfx)dummy.o:
70 @rm -f $(@:.o=.c)
71 echo 'void __dummy__ () { }' > $(@:.o=.c)
72 $(CC) -c $(@:.o=.c) -o $@
8942a07a
RM
73$(objpfx)empty.o:
74 @rm -f $(@:.o=.c)
75 echo '' > $(@:.o=.c)
76 $(CC) -c $(@:.o=.c) -o $@
77generated := $(generated) dummy.o dummy.c empty.c empty.o
28f540f4
RM
78\f
79# This makes all the auxilliary and test programs.
80
81.PHONY: others tests
3bbceb12 82others: $(addprefix $(objpfx),$(others) $(extra-objs))
28f540f4
RM
83ifeq ($(cross-compiling),yes)
84tests: $(addprefix $(objpfx),$(tests))
85else
86tests: $(tests:%=$(objpfx)%.out)
87endif
88
89ifneq "$(strip $(others) $(tests))" ""
196980f5
RM
90$(addprefix $(objpfx),$(others) $(tests)): %: %.o \
91 $(sort $(filter $(common-objpfx)libc%,$(link-libc)))
28f540f4
RM
92 $(+link)
93endif
94
95ifneq "$(strip $(tests))" ""
96# These are the implicit rules for making test outputs
97# from the test programs and whatever input files are present.
196980f5 98$(objpfx)%.out: %.args $(objpfx)% %.input
fa0bc87c 99 $($*-ENV) $(built-program-cmd) `cat $(word 1,$^)` < $(word 3,$^) > $@
196980f5 100$(objpfx)%.out: %.args $(objpfx)%
fa0bc87c 101 $($*-ENV) $(built-program-cmd) `cat $(word 1,$^)` > $@
196980f5 102$(objpfx)%.out: %.input $(objpfx)%
fa0bc87c 103 $($*-ENV) $(built-program-cmd) < $(word 1,$^) > $@
196980f5 104$(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence.
fa0bc87c 105 $($*-ENV) $(built-program-cmd) > $@
28f540f4
RM
106endif # tests
107\f
108.PHONY: distclean realclean subdir_distclean subdir_realclean \
109 subdir_clean subdir_mostlyclean
110subdir_mostlyclean: mostlyclean
111subdir_clean: clean
112subdir_distclean: distclean
113subdir_realclean: realclean
114realclean: distclean
115distclean: clean
116
117.PHONY: subdir_echo-headers
118subdir_echo-headers: echo-headers
119
120.PHONY: subdir_echo-distinfo
121subdir_echo-distinfo:
122 @echo $(addprefix +header+,$(headers)) \
123 $(addprefix +nodist+,$(generated) $(dont_distribute))
124
125# We want to install everything except the library itself, but update all
126# our portions of the library because the parent make will install it later
127# (likewise the stubs file).
128.PHONY: subdir_install
7c713e28
RM
129subdir_install: install-no-libc.a lib-noranlib stubs \
130 $(common-objpfx)sor-$(subdir)
131
132ifdef objpfx
133sor-objpfx = $(objpfx:../%=%)
134else
135sor-objpfx = $(subdir)
136endif
137
138ifndef libc.so-version
139# Undefine this because it can't work when we libc.so is unversioned.
140static-only-routines =
141endif
142
143# This communicates to the parent during install the set of routines that
144# need to be put into the special libc.so archive.
145$(common-objpfx)sor-$(subdir): Makefile
146 echo $(static-only-routines:%=$(sor-objpfx)%.o) > $@T
147 mv -f $@T $@
148
149ifdef static-only-routines
150# These routines are to be omitted from the shared library object,
8942a07a 151# so we replace the PIC objects for them with the empty object file.
05d4c982 152$(static-only-routines:%=$(objpfx)%.so): %.so: $(objpfx)empty.o
7c713e28
RM
153 rm -f $@
154 ln $< $@
155endif
28f540f4
RM
156
157.PHONY: subdir_TAGS subdir_dist
158subdir_TAGS: TAGS
159subdir_dist: dist
160
161# Convenient target to update all the generated source files.
162.PHONY: generated
163generated: $(addprefix $(objpfx),$(generated))