]> sourceware.org Git - glibc.git/blame - Rules
Linux/ARM implementation of pread.
[glibc.git] / Rules
CommitLineData
6591c335 1# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 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
ae1025be
UD
15# License along with the GNU C Library; see the file COPYING.LIB. If not,
16# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17# Boston, MA 02111-1307, USA.
28f540f4
RM
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
c7562c74 34# This ` unconfuses emacs.
28f540f4
RM
35# This is benign and useless in GNU make before 3.63.
36export subdir := $(subdir)
37\f
38# This is the default target; it makes the library and auxiliary programs.
39.PHONY: all
96f873b9 40all: objs lib others
28f540f4 41
0413b54c 42ifeq ($(build-programs),yes)
a182affd 43others: $(addprefix $(objpfx),$(extra-objs) \
1ef32c3d
UD
44 $(install-lib) $(install-bin) \
45 $(install-rootsbin) $(install-sbin))
0413b54c
UD
46else
47others: $(addprefix $(objpfx),$(extra-objs) \
48 $(install-lib))
49endif
a182affd 50
28f540f4
RM
51ifneq "$(findstring env,$(origin headers))" ""
52headers :=
53endif
54
55ifneq "$(findstring env,$(origin generated))" ""
56generated :=
57endif
58
924840c5
TBB
59ifneq "$(findstring env,$(origin common-generated))" ""
60common-generated :=
61endif
62
28f540f4
RM
63include ../Makerules
64
65.PHONY: subdir_lib
3bbceb12 66subdir_lib: lib-noranlib
28f540f4
RM
67
68# Some subdirs need to install a dummy library.
69# They can use "$(objpfx)libfnord.a: $(dep-dummy-lib); $(make-dummy-lib)".
6e953631 70dep-dummy-lib = $(common-objpfx)dummy.o
28f540f4
RM
71define make-dummy-lib
72$(AR) cr$(verbose) $@ $<
73endef
74015205 74
6e953631 75$(common-objpfx)dummy.c:
f0097fa0 76 rm -f $@
11336c16 77 echo 'void __dummy__ (void) { }' > $@
6e953631 78$(common-objpfx)empty.c:
f0097fa0 79 cp -f /dev/null $@
af6f3906
UD
80common-generated += dummy.o dummy.c empty.c \
81 $(addprefix empty,$(object-suffixes))
28f540f4 82\f
6d52618b 83# This makes all the auxiliary and test programs.
28f540f4
RM
84
85.PHONY: others tests
0413b54c 86ifeq ($(build-programs),yes)
414fd335 87others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
0413b54c
UD
88else
89others: $(addprefix $(objpfx),$(extra-objs))
90endif
28f540f4 91ifeq ($(cross-compiling),yes)
7cabd57c
UD
92tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
93ifeq ($(build-static),yes)
94tests: $(addprefix $(objpfx),$(tests-static))
95endif
28f540f4 96else
786a5421 97tests: $(tests:%=$(objpfx)%.out)
7cabd57c
UD
98ifeq ($(build-static),yes)
99tests: $(tests-static:%=$(objpfx)%.sout)
28f540f4 100endif
786a5421 101endif
28f540f4 102
0413b54c 103ifeq ($(build-programs),yes)
414fd335 104binaries-all = $(others) $(sysdep-others) $(tests) $(test-srcs)
e1586792 105binaries-static = $(others-static) $(tests-static) $(test-srcs-static)
0413b54c 106else
e1586792
UD
107binaries-all = $(tests) $(test-srcs)
108binaries-static = $(tests-static) $(test-srcs-static)
109endif
110
111binaries-shared = $(filter-out $(binaries-static), $(binaries-all))
112
113ifneq "$(strip $(binaries-shared))" ""
114$(addprefix $(objpfx),$(binaries-shared)): %: %.o \
9992e360 115 $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
0413b54c
UD
116 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
117 $(+link)
118endif
e1586792
UD
119
120ifneq "$(strip $(binaries-static))" ""
121$(addprefix $(objpfx),$(binaries-static)): %: %.o \
9992e360 122 $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \
e1586792
UD
123 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
124 $(+link-static)
0413b54c 125endif
28f540f4 126
e61abf83 127ifneq "$(strip $(tests) $(test-srcs))" ""
28f540f4
RM
128# These are the implicit rules for making test outputs
129# from the test programs and whatever input files are present.
196980f5 130$(objpfx)%.out: %.args $(objpfx)% %.input
fa0bc87c 131 $($*-ENV) $(built-program-cmd) `cat $(word 1,$^)` < $(word 3,$^) > $@
196980f5 132$(objpfx)%.out: %.args $(objpfx)%
fa0bc87c 133 $($*-ENV) $(built-program-cmd) `cat $(word 1,$^)` > $@
196980f5 134$(objpfx)%.out: %.input $(objpfx)%
fa0bc87c 135 $($*-ENV) $(built-program-cmd) < $(word 1,$^) > $@
196980f5 136$(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence.
fa0bc87c 137 $($*-ENV) $(built-program-cmd) > $@
28f540f4 138endif # tests
a44d2393
UD
139
140ifneq "$(strip $(tests-static) $(test-static-srcs))" ""
141# These are the implicit rules for making test outputs
142# from the test programs and whatever input files are present.
143$(objpfx)%.sout: %.args $(objpfx)% %.input
144 $($*-ENV) $(built-program-file) `cat $(word 1,$^)` < $(word 3,$^) > $@
145$(objpfx)%.sout: %.args $(objpfx)%
146 $($*-ENV) $(built-program-file) `cat $(word 1,$^)` > $@
147$(objpfx)%.sout: %.input $(objpfx)%
148 $($*-ENV) $(built-program-file) < $(word 1,$^) > $@
149$(objpfx)%.sout: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence.
150 $($*-ENV) $(built-program-file) > $@
151endif # tests
28f540f4
RM
152\f
153.PHONY: distclean realclean subdir_distclean subdir_realclean \
edf5b2d7 154 subdir_clean subdir_mostlyclean
28f540f4
RM
155subdir_mostlyclean: mostlyclean
156subdir_clean: clean
157subdir_distclean: distclean
158subdir_realclean: realclean
159realclean: distclean
160distclean: clean
161
162.PHONY: subdir_echo-headers
163subdir_echo-headers: echo-headers
164
165.PHONY: subdir_echo-distinfo
166subdir_echo-distinfo:
d705269e 167 @echo $(addprefix +header+,$(headers) $(filter %.h,$(distribute))) \
924840c5 168 $(addprefix +nodist+,$(generated) $(common-generated) $(dont_distribute))
28f540f4
RM
169
170# We want to install everything except the library itself, but update all
171# our portions of the library because the parent make will install it later
172# (likewise the stubs file).
173.PHONY: subdir_install
613a76ff 174subdir_install: install-no-libc.a lib-noranlib stubs
28f540f4
RM
175
176.PHONY: subdir_TAGS subdir_dist
177subdir_TAGS: TAGS
178subdir_dist: dist
179
180# Convenient target to update all the generated source files.
181.PHONY: generated
acf51e02
TBB
182generated: $(addprefix $(common-objpfx),$(common-generated)) \
183 $(addprefix $(objpfx),$(generated))
5790c439 184
bd78530f
UD
185# Target required by the Hurd to ensure that all the MiG-generated
186# headers are in place before building a subdirectory.
187.PHONY: before-compile
188before-compile: $(before-compile)
189
af6f3906
UD
190define o-iterator-doit
191$(common-objpfx)empty$o: $(common-objpfx)empty.c $(before-compile);
192 $$(compile-command.c)
193endef
194object-suffixes-left := $(object-suffixes)
195include $(o-iterator)
196
6591c335
UD
197define o-iterator-doit
198$(common-objpfx)dummy$o: $(common-objpfx)dummy.c $(before-compile);
199 $$(compile-command.c)
200endef
201object-suffixes-left := $(object-suffixes)
202include $(o-iterator)
7ef90c15
UD
203
204# There's no good place to put this - here will do.
205# The dependencies are wrong if it's run from the top level.
206ifeq ($(filter %posix, $(sysdirs)),)
207L_tmpnam = 1
208TMP_MAX = 0
209L_ctermid = 1
210L_cuserid = 1
211else
431f91ba 212L_tmpnam = 20
7ef90c15
UD
213TMP_MAX = 238328
214L_ctermid = 9
215L_cuserid = 9
216endif
99e46354 217stdio_lim = $(common-objpfx)bits/stdio_lim.h
7ef90c15 218
99e46354
UD
219$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
220$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
221 $(common-objpfx)config.make
7ef90c15
UD
222 $(make-target-directory)
223 echo '#include "$(..)posix/bits/posix1_lim.h"' | \
99e46354
UD
224 SUNPRO_DEPENDENCIES='$(@:st=dT) $@' \
225 $(CC) $(+includes) -E -dM -xc - -o $(@:st=hT)
226ifdef sed-remove-objpfx
227 sed $(sed-remove-objpfx) $(@:st=dT) > $(@:st=dt)
228 mv -f $(@:st=dt) $(@:st=d)
229else
230 mv -f $(@:st=dT) $(@:st=d)
231endif
232 fopen_max=`sed -n 's/^#define OPEN_MAX //p' $(@:st=hT)`; \
233 filename_max=`sed -n 's/^#define PATH_MAX //p' $(@:st=hT)`; \
7ef90c15
UD
234 fopen_max=$${fopen_max:-16}; \
235 filename_max=$${filename_max:-1024}; \
236 sed -e "s/@FOPEN_MAX@/$$fopen_max/" \
237 -e "s/@FILENAME_MAX@/$$filename_max/" \
238 -e "s/@L_tmpnam@/$(L_tmpnam)/" \
239 -e "s/@TMP_MAX@/$(TMP_MAX)/" \
240 -e "s/@L_ctermid@/$(L_ctermid)/" \
241 -e "s/@L_cuserid@/$(L_cuserid)/" \
99e46354
UD
242 $< > $(@:st=h.new)
243 $(move-if-change) $(@:st=h.new) $(@:st=h)
7ef90c15 244# Remove these last so that they can be examined if something went wrong.
99e46354
UD
245 rm -f $(@:st=hT) $(@:st=dT)
246 touch $@
7ef90c15
UD
247# Get dependencies.
248ifndef no_deps
99e46354 249-include $(stdio_lim:h=d)
7ef90c15 250endif
99e46354 251common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st
This page took 0.083497 seconds and 5 git commands to generate.