]>
Commit | Line | Data |
---|---|---|
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 | # | |
23 | ifneq (,) | |
24 | This makefile requires GNU Make. | |
25 | endif | |
26 | ||
27 | all: # Don't let the default goal come from Makeconfig. | |
28 | ||
29 | include ../Makeconfig | |
30 | ||
31 | ifndef subdir | |
32 | Each subdirectory makefile must define the `subdir' variable. | |
33 | endif | |
34 | # This is benign and useless in GNU make before 3.63. | |
35 | export subdir := $(subdir) | |
36 | \f | |
37 | # This is the default target; it makes the library and auxiliary programs. | |
38 | .PHONY: all | |
96f873b9 | 39 | all: objs lib others |
28f540f4 | 40 | |
a182affd RM |
41 | others: $(addprefix $(objpfx),$(extra-objs) \ |
42 | $(install-lib) $(install-bin) $(install-sbin)) | |
43 | ||
28f540f4 RM |
44 | ifneq "$(findstring env,$(origin headers))" "" |
45 | headers := | |
46 | endif | |
47 | ||
48 | ifneq "$(findstring env,$(origin generated))" "" | |
49 | generated := | |
50 | endif | |
51 | ||
52 | ifeq "$(strip $(headers))" "" | |
53 | ifneq "$(wildcard $(subdir).h)" "" | |
54 | override headers := $(subdir).h | |
55 | endif | |
56 | endif | |
57 | ||
58 | include ../Makerules | |
59 | ||
60 | .PHONY: subdir_lib | |
3bbceb12 | 61 | subdir_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)". | |
65 | dep-dummy-lib = $(objpfx)dummy.o | |
66 | define make-dummy-lib | |
67 | $(AR) cr$(verbose) $@ $< | |
68 | endef | |
f0097fa0 RM |
69 | $(objpfx)dummy.c: |
70 | rm -f $@ | |
71 | echo 'void __dummy__ () { }' > $@ | |
72 | $(objpfx)empty.c: | |
73 | cp -f /dev/null $@ | |
8942a07a | 74 | generated := $(generated) dummy.o dummy.c empty.c empty.o |
28f540f4 RM |
75 | \f |
76 | # This makes all the auxilliary and test programs. | |
77 | ||
78 | .PHONY: others tests | |
3bbceb12 | 79 | others: $(addprefix $(objpfx),$(others) $(extra-objs)) |
28f540f4 RM |
80 | ifeq ($(cross-compiling),yes) |
81 | tests: $(addprefix $(objpfx),$(tests)) | |
82 | else | |
83 | tests: $(tests:%=$(objpfx)%.out) | |
84 | endif | |
85 | ||
86 | ifneq "$(strip $(others) $(tests))" "" | |
196980f5 RM |
87 | $(addprefix $(objpfx),$(others) $(tests)): %: %.o \ |
88 | $(sort $(filter $(common-objpfx)libc%,$(link-libc))) | |
28f540f4 RM |
89 | $(+link) |
90 | endif | |
91 | ||
92 | ifneq "$(strip $(tests))" "" | |
93 | # These are the implicit rules for making test outputs | |
94 | # from the test programs and whatever input files are present. | |
196980f5 | 95 | $(objpfx)%.out: %.args $(objpfx)% %.input |
fa0bc87c | 96 | $($*-ENV) $(built-program-cmd) `cat $(word 1,$^)` < $(word 3,$^) > $@ |
196980f5 | 97 | $(objpfx)%.out: %.args $(objpfx)% |
fa0bc87c | 98 | $($*-ENV) $(built-program-cmd) `cat $(word 1,$^)` > $@ |
196980f5 | 99 | $(objpfx)%.out: %.input $(objpfx)% |
fa0bc87c | 100 | $($*-ENV) $(built-program-cmd) < $(word 1,$^) > $@ |
196980f5 | 101 | $(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence. |
fa0bc87c | 102 | $($*-ENV) $(built-program-cmd) > $@ |
28f540f4 RM |
103 | endif # tests |
104 | \f | |
105 | .PHONY: distclean realclean subdir_distclean subdir_realclean \ | |
106 | subdir_clean subdir_mostlyclean | |
107 | subdir_mostlyclean: mostlyclean | |
108 | subdir_clean: clean | |
109 | subdir_distclean: distclean | |
110 | subdir_realclean: realclean | |
111 | realclean: distclean | |
112 | distclean: clean | |
113 | ||
114 | .PHONY: subdir_echo-headers | |
115 | subdir_echo-headers: echo-headers | |
116 | ||
117 | .PHONY: subdir_echo-distinfo | |
118 | subdir_echo-distinfo: | |
119 | @echo $(addprefix +header+,$(headers)) \ | |
120 | $(addprefix +nodist+,$(generated) $(dont_distribute)) | |
121 | ||
122 | # We want to install everything except the library itself, but update all | |
123 | # our portions of the library because the parent make will install it later | |
124 | # (likewise the stubs file). | |
125 | .PHONY: subdir_install | |
613a76ff | 126 | subdir_install: install-no-libc.a lib-noranlib stubs |
28f540f4 RM |
127 | |
128 | .PHONY: subdir_TAGS subdir_dist | |
129 | subdir_TAGS: TAGS | |
130 | subdir_dist: dist | |
131 | ||
132 | # Convenient target to update all the generated source files. | |
133 | .PHONY: generated | |
134 | generated: $(addprefix $(objpfx),$(generated)) | |
5790c439 RM |
135 | |
136 | ifndef libc.so-version | |
137 | # Undefine this because it can't work when we libc.so is unversioned. | |
138 | static-only-routines = | |
139 | endif | |
140 | ||
141 | ifdef static-only-routines | |
142 | # These routines are to be omitted from the shared library object, | |
143 | # so we replace the PIC objects for them with the empty object file. | |
144 | $(static-only-routines:%=$(objpfx)%.so): %.so: $(objpfx)empty.o | |
145 | rm -f $@ | |
146 | ln $< $@ | |
147 | endif |