* sysdeps/m68k/setjmp.c: Also define setjmp and _setjmp if
[glibc.git] / Rules
blobd99bb21dbac1c949de21e532af13c2a0deb7ce65
1 # Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 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 Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the 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 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
20 #       Rules for making a subdirectory in the GNU C library.
21 #       Each subdirectory Makefile defines some variables and includes this.
23 ifneq (,)
24 This makefile requires GNU Make.
25 endif
27 all: # Don't let the default goal come from Makeconfig.
29 include ../Makeconfig
31 ifndef  subdir
32 Each subdirectory makefile must define the `subdir' variable.
33 endif
34 # This ` unconfuses emacs.
35 # This is benign and useless in GNU make before 3.63.
36 export subdir := $(subdir)
38 # This is the default target; it makes the library and auxiliary programs.
39 .PHONY: all
40 all: objs lib others
42 ifeq ($(build-programs),yes)
43 others: $(addprefix $(objpfx),$(extra-objs) \
44                               $(install-lib) \
45                               $(install-bin) $(install-bin-script) \
46                               $(install-rootsbin) $(install-sbin))
47 else
48 others: $(addprefix $(objpfx),$(extra-objs) \
49                               $(install-lib))
50 endif
52 ifneq   "$(findstring env,$(origin headers))" ""
53 headers :=
54 endif
56 ifneq   "$(findstring env,$(origin generated))" ""
57 generated :=
58 endif
60 ifneq   "$(findstring env,$(origin common-generated))" ""
61 common-generated :=
62 endif
64 include ../Makerules
66 .PHONY: subdir_lib
67 subdir_lib: lib-noranlib
69 # Some subdirs need to install a dummy library.
70 # They can use "$(objpfx)libfnord.a: $(dep-dummy-lib); $(make-dummy-lib)".
71 dep-dummy-lib = $(common-objpfx)dummy.o
72 define make-dummy-lib
73 $(AR) cr$(verbose) $@ $<
74 endef
76 $(common-objpfx)dummy.c:
77         rm -f $@
78         (echo 'extern void __dummy__ (void);'; \
79          echo 'void __dummy__ (void) { }') > $@
80 common-generated += dummy.o dummy.c
82 # This makes all the auxiliary and test programs.
84 .PHONY: others tests
85 ifeq ($(build-programs),yes)
86 others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
87 else
88 others: $(addprefix $(objpfx),$(extra-objs))
89 endif
90 ifeq ($(cross-compiling),yes)
91 tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
92 else
93 ifeq ($(build-bounded),yes)
94 tests-bp.out = $(tests:%=$(objpfx)%-bp.out)
95 endif
96 tests: $(tests:%=$(objpfx)%.out) $(tests-bp.out)
97 endif
99 ifeq ($(build-programs),yes)
100 binaries-all = $(others) $(sysdep-others) $(tests) $(test-srcs)
101 binaries-static = $(others-static) $(tests-static)
102 else
103 binaries-all = $(tests) $(test-srcs)
104 binaries-static =
105 endif
107 binaries-shared = $(filter-out $(binaries-static), $(binaries-all))
109 ifneq "$(strip $(binaries-shared))" ""
110 $(addprefix $(objpfx),$(binaries-shared)): %: %.o \
111   $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
112   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
113         $(+link)
114 endif
116 ifneq "$(strip $(binaries-static))" ""
117 $(addprefix $(objpfx),$(binaries-static)): %: %.o \
118   $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \
119   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
120         $(+link-static)
121 endif
123 ifeq ($(build-bounded),yes)
124 binaries-bounded = $(addsuffix -bp,$(tests) $(test-srcs))
125 $(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \
126   $(sort $(filter $(common-objpfx)lib%,$(link-libc-bounded))) \
127   $(addprefix $(csu-objpfx),start.ob) $(+preinit) $(+postinit)
128         $(+link-bounded)
129 endif
131 ifneq "$(strip $(tests) $(test-srcs))" ""
132 # These are the implicit rules for making test outputs
133 # from the test programs and whatever input files are present.
135 make-test-out = GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
136                 $($*-ENV) $(built-program-cmd) $($*-ARGS)
137 $(objpfx)%-bp.out: %.input $(objpfx)%-bp
138         $(make-test-out) > $@ < $(word 1,$^)
139 $(objpfx)%.out: %.input $(objpfx)%
140         $(make-test-out) > $@ < $(word 1,$^)
141 $(objpfx)%.out: /dev/null $(objpfx)%    # Make it 2nd arg for canned sequence.
142         $(make-test-out) > $@
144 endif   # tests
146 .PHONY: distclean realclean subdir_distclean subdir_realclean \
147         subdir_clean subdir_mostlyclean subdir_testclean
148 subdir_mostlyclean: mostlyclean
149 subdir_clean: clean
150 subdir_distclean: distclean
151 subdir_realclean: realclean
152 subdir_testclean: do-tests-clean
153 realclean: distclean
154 distclean: clean
156 .PHONY: subdir_echo-headers
157 subdir_echo-headers: echo-headers
159 .PHONY: subdir_echo-distinfo
160 subdir_echo-distinfo:
161         @echo $(addprefix +header+,$(headers) $(filter %.h,$(distribute))) \
162               $(addprefix +nodist+,$(generated) $(common-generated) $(dont_distribute))
164 # We want to install everything except the library itself, but update all
165 # our portions of the library because the parent make will install it later
166 # (likewise the stubs file).
167 .PHONY: subdir_install
168 subdir_install: install-no-libc.a lib-noranlib stubs
170 .PHONY: subdir_TAGS subdir_dist
171 subdir_TAGS: TAGS
172 subdir_dist: dist
174 # Convenient target to update all the generated source files.
175 .PHONY: generated
176 generated: $(addprefix $(common-objpfx),$(common-generated)) \
177         $(addprefix $(objpfx),$(generated))
179 # Target required by the Hurd to ensure that all the MiG-generated
180 # headers are in place before building a subdirectory.
181 .PHONY: before-compile
182 before-compile: $(before-compile)
184 $(common-objpfx)dummy.o: $(common-objpfx)dummy.c $(before-compile);
185         $(compile-command.c)
187 # There's no good place to put this - here will do.
188 # The dependencies are wrong if it's run from the top level.
189 ifeq ($(filter %posix, $(sysdirs)),)
190 L_tmpnam  = 1
191 TMP_MAX   = 0
192 L_ctermid = 1
193 L_cuserid = 1
194 else
195 L_tmpnam  = 20
196 TMP_MAX   = 238328
197 L_ctermid = 9
198 L_cuserid = 9
199 endif
200 stdio_lim = $(common-objpfx)bits/stdio_lim.h
202 $(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
203 $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
204                    $(common-objpfx)config.make
205         $(make-target-directory)
206         echo '#include "$(..)posix/bits/posix1_lim.h"' |                \
207         SUNPRO_DEPENDENCIES='$(@:st=dT) $@'                             \
208         $(CC) $(+includes) -E -dM -xc - -o $(@:st=hT)
209         echo '#include "$(..)misc/sys/uio.h"' |                         \
210         SUNPRO_DEPENDENCIES='$(@:st=dT) $@'                             \
211         $(CC) -D_LIBC=1 $(+includes) -E -dM -xc - | cat - >> $(@:st=hT)
212 ifdef sed-remove-objpfx
213         sed $(sed-remove-objpfx) $(@:st=dT) > $(@:st=dt)
214         cat $(@:st=dt) >> $(@:st=d)
215 else
216         cat $(@:st=dT) >> $(@:st=d)
217 endif
218         fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`;       \
219         filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`;    \
220         iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`;        \
221         fopen_max=$${fopen_max:-16};                                    \
222         filename_max=$${filename_max:-1024};                            \
223         if [ -z $$iov_max ]; then                                       \
224           define_iov_max="# undef IOV_MAX";                             \
225         else                                                            \
226           define_iov_max="# define IOV_MAX $$iov_max";                  \
227         fi;                                                             \
228         sed -e "s/@FOPEN_MAX@/$$fopen_max/"                             \
229             -e "s/@FILENAME_MAX@/$$filename_max/"                       \
230             -e "s/@L_tmpnam@/$(L_tmpnam)/"                              \
231             -e "s/@TMP_MAX@/$(TMP_MAX)/"                                \
232             -e "s/@L_ctermid@/$(L_ctermid)/"                            \
233             -e "s/@L_cuserid@/$(L_cuserid)/"                            \
234             -e "s/@define_IOV_MAX@/$$define_iov_max/"                   \
235             $< > $(@:st=h.new)
236         $(move-if-change) $(@:st=h.new) $(@:st=h)
237 # Remove these last so that they can be examined if something went wrong.
238         rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt)
239         touch $@
240 # Get dependencies.
241 ifndef no_deps
242 -include $(stdio_lim:h=d)
243 endif
244 common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st