]> git.ipfire.org Git - thirdparty/glibc.git/blame - Rules
update from main archive 961217
[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
924840c5
TBB
52ifneq "$(findstring env,$(origin common-generated))" ""
53common-generated :=
54endif
55
28f540f4
RM
56ifeq "$(strip $(headers))" ""
57ifneq "$(wildcard $(subdir).h)" ""
58override headers := $(subdir).h
59endif
60endif
61
62include ../Makerules
63
64.PHONY: subdir_lib
3bbceb12 65subdir_lib: lib-noranlib
28f540f4
RM
66
67# Some subdirs need to install a dummy library.
68# They can use "$(objpfx)libfnord.a: $(dep-dummy-lib); $(make-dummy-lib)".
6e953631 69dep-dummy-lib = $(common-objpfx)dummy.o
28f540f4
RM
70define make-dummy-lib
71$(AR) cr$(verbose) $@ $<
72endef
6e953631 73$(common-objpfx)dummy.c:
f0097fa0 74 rm -f $@
11336c16 75 echo 'void __dummy__ (void) { }' > $@
6e953631 76$(common-objpfx)empty.c:
f0097fa0 77 cp -f /dev/null $@
924840c5 78common-generated := $(common-generated) dummy.o dummy.c empty.c empty.o
28f540f4
RM
79\f
80# This makes all the auxilliary and test programs.
81
82.PHONY: others tests
3bbceb12 83others: $(addprefix $(objpfx),$(others) $(extra-objs))
28f540f4
RM
84ifeq ($(cross-compiling),yes)
85tests: $(addprefix $(objpfx),$(tests))
86else
87tests: $(tests:%=$(objpfx)%.out)
88endif
89
90ifneq "$(strip $(others) $(tests))" ""
196980f5 91$(addprefix $(objpfx),$(others) $(tests)): %: %.o \
c2bb8cab
UD
92 $(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
93 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
28f540f4
RM
94 $(+link)
95endif
96
97ifneq "$(strip $(tests))" ""
98# These are the implicit rules for making test outputs
99# from the test programs and whatever input files are present.
196980f5 100$(objpfx)%.out: %.args $(objpfx)% %.input
fa0bc87c 101 $($*-ENV) $(built-program-cmd) `cat $(word 1,$^)` < $(word 3,$^) > $@
196980f5 102$(objpfx)%.out: %.args $(objpfx)%
fa0bc87c 103 $($*-ENV) $(built-program-cmd) `cat $(word 1,$^)` > $@
196980f5 104$(objpfx)%.out: %.input $(objpfx)%
fa0bc87c 105 $($*-ENV) $(built-program-cmd) < $(word 1,$^) > $@
196980f5 106$(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence.
fa0bc87c 107 $($*-ENV) $(built-program-cmd) > $@
28f540f4
RM
108endif # tests
109\f
110.PHONY: distclean realclean subdir_distclean subdir_realclean \
edf5b2d7 111 subdir_clean subdir_mostlyclean
28f540f4
RM
112subdir_mostlyclean: mostlyclean
113subdir_clean: clean
114subdir_distclean: distclean
115subdir_realclean: realclean
116realclean: distclean
117distclean: clean
118
119.PHONY: subdir_echo-headers
120subdir_echo-headers: echo-headers
121
122.PHONY: subdir_echo-distinfo
123subdir_echo-distinfo:
124 @echo $(addprefix +header+,$(headers)) \
924840c5 125 $(addprefix +nodist+,$(generated) $(common-generated) $(dont_distribute))
28f540f4
RM
126
127# We want to install everything except the library itself, but update all
128# our portions of the library because the parent make will install it later
129# (likewise the stubs file).
130.PHONY: subdir_install
613a76ff 131subdir_install: install-no-libc.a lib-noranlib stubs
28f540f4
RM
132
133.PHONY: subdir_TAGS subdir_dist
134subdir_TAGS: TAGS
135subdir_dist: dist
136
137# Convenient target to update all the generated source files.
138.PHONY: generated
acf51e02
TBB
139generated: $(addprefix $(common-objpfx),$(common-generated)) \
140 $(addprefix $(objpfx),$(generated))
5790c439
RM
141
142ifndef libc.so-version
143# Undefine this because it can't work when we libc.so is unversioned.
144static-only-routines =
145endif
146
147ifdef static-only-routines
148# These routines are to be omitted from the shared library object,
149# so we replace the PIC objects for them with the empty object file.
6e953631 150$(static-only-routines:%=$(objpfx)%.so): %.so: $(common-objpfx)empty.o
5790c439
RM
151 rm -f $@
152 ln $< $@
153endif