Add oldsiglist.c, netax25/ax25.h, and netrom/netrom.h.
[glibc/history.git] / Makefile
blobed8d327ddc3dddd8a1eb859d72f3530050345bac
1 # Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 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.
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.
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 not,
16 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
20 # Master Makefile for the GNU C library
22 ifneq (,)
23 This makefile requires GNU Make.
24 endif
27 # This is the default target; it makes everything except the tests.
28 .PHONY: all
29 all: lib others
31 define autoconf-it
32 @-rm -f $@.new
33 autoconf $(ACFLAGS) $< > $@.new
34 chmod a-w,a+x $@.new
35 mv -f $@.new $@
36 test ! -d CVS || cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
37 endef
39 configure: configure.in aclocal.m4; $(autoconf-it)
40 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
42 include Makeconfig
44 ifndef avoid-generated
45 -include $(objpfx)sysd-dirs
46 define \n
49 endef
50 sysdep-subdirs := $(subst $(\n), ,$(sysdep-subdirs))
51 endif
53 # These are the subdirectories containing the library source.
54 subdirs = csu assert ctype db2 locale intl catgets math setjmp signal stdlib \
55 stdio-common $(stdio) malloc string wcsmbs time dirent grp pwd \
56 posix io termios resource misc socket sysvipc gmon gnulib iconv \
57 iconvdata wctype manual shadow md5-crypt po argp $(add-ons) nss \
58 localedata $(rt) $(sysdep-subdirs) $(binfmt-subdir)
59 export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63.
61 # The mach and hurd subdirectories have many generated header files which
62 # much of the rest of the library depends on, so it is best to build them
63 # first (and mach before hurd, at that). The before-compile additions in
64 # sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
65 # not to exist when making in other directories, but it will be slower that
66 # way with more somewhat expensive `make' invocations.
67 subdirs := $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
68 $(filter-out mach hurd,$(subdirs))
70 # All initialization source files.
71 +subdir_inits := $(wildcard $(foreach dir,$(subdirs),$(dir)/init-$(dir).c))
72 # All subdirectories containing initialization source files.
73 +init_subdirs := $(patsubst %/,%,$(dir $(+subdir_inits)))
76 # These are the targets that are made by making them in each subdirectory.
77 +subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
78 subdir_clean subdir_distclean subdir_realclean \
79 tests subdir_lint.out \
80 subdir_distinfo \
81 subdir_echo-headers subdir_echo-distinfo \
82 subdir_install \
83 $(addprefix install-, no-libc.a bin lib data headers others)
85 headers := errno.h sys/errno.h bits/errno.h limits.h values.h \
86 features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h
87 aux = sysdep $(libc-init) version
88 before-compile += $(objpfx)version-info.h
90 echo-headers: subdir_echo-headers
92 # The headers are in the include directory.
93 subdir-dirs = include
94 vpath %.h $(subdir-dirs)
96 # What to install.
97 install-others = $(inst_includedir)/gnu/stubs.h
98 install-bin = glibcbug
100 ifeq (yes,$(build-shared))
101 install-others += $(inst_includedir)/gnu/lib-names.h
102 endif
104 ifeq (yes,$(gnu-ld))
105 libc-init = set-init
106 else
107 libc-init = munch-init
108 $(objpfx)munch-init.c: munch.awk munch-tmpl.c $(+subdir_inits)
109 awk -f $< subdirs='$(+init_subdirs)' $(word 2,$^) > $@-t
110 mv -f $@-t $@
111 generated := $(generated) munch-init.c
112 endif
115 include Makerules
117 # Install from subdirectories too.
118 install: subdir_install
120 # Make sure that the dynamic linker is installed before libc.
121 $(inst_slibdir)/libc-$(version).so: elf/subdir_install
123 # Create links for shared libraries using the `ldconfig' program is possible.
124 # Ignore the error if we cannot update /etc/ld.so.cache.
125 ifeq (no,$(cross-compiling))
126 ifeq (yes,$(build-shared))
127 install:
128 -test ! -x $(common-objpfx)elf/ldconfig || \
129 $(common-objpfx)elf/ldconfig -d $(inst_slibdir) $(inst_libdir)
130 ifneq (no,$(PERL))
131 ifeq (/usr,$(prefix))
132 ifeq (,$(install_root))
133 CC="$(CC)" $(PERL) test-installation.pl $(common-objpfx)
134 endif
135 endif
136 endif
137 endif
138 endif
140 # Build subdirectory lib objects.
141 lib-noranlib: subdir_lib
143 ifeq (yes,$(build-shared))
144 # Build the shared object from the PIC object library.
145 lib: $(common-objpfx)libc.so
146 endif
148 all-Subdirs-files = $(wildcard $(addsuffix /Subdirs, $(config-sysdirs)))
149 $(objpfx)sysd-dirs: $(+sysdir_pfx)config.make $(all-Subdirs-files)
150 (echo define sysdep-subdirs; \
151 sed 's/#.*$$//' $(all-Subdirs-files) /dev/null; \
152 echo endef) > $@-tmp
153 mv -f $@-tmp $@
155 all-Banner-files = $(wildcard $(addsuffix /Banner, $(subdirs)))
156 $(objpfx)version-info.h: $(+sysdir_pfx)config.make $(all-Banner-files)
157 (case $(config-os) in \
158 linux*) version=`(echo -e "#include <linux/version.h>\nUTS_RELEASE"\
159 | $(CC) -E -P - | \
160 sed -e 's/"\([^"]*\)".*/\1/p' -e d) 2>/dev/null`;\
161 if [ -z "$$version" ]; then \
162 if [ -r /proc/version ]; then \
163 version=`sed 's/.*version \([^ ]*\) .*/>>\1<</' \
164 < /proc/version`; \
165 else \
166 version=`uname -r`; \
167 fi; \
168 fi; \
169 echo -n "\"Compiled on a Linux $$version system "; \
170 echo "on `date +%Y-%m-%d`.\\n\"" ;; \
171 *) ;; \
172 esac; \
173 files="$(all-Banner-files)"; \
174 if test -n "$$files"; then \
175 echo "\"Available extensions:"; \
176 sed -e '/^#/d' -e 's/^[[:space:]]*/ /' $$files; \
177 echo "\""; \
178 fi) > $@T
179 mv -f $@T $@
180 generated += version-info.h
182 version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))
183 $(version.c-objects): $(objpfx)version-info.h
185 # Makerules creates a file `stub-$(subdir)' for each subdirectory, which
186 # contains `#define __stub_FUNCTION' for each function which is a stub.
187 # Here we paste all of these together into <gnu/stubs.h>.
189 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)stub-$(dir))
191 # Since stubs.h is never needed when building the library, we simplify the
192 # hairy installation process by producing it in place only as the last part
193 # of the top-level `make install'. It depends on subdir_install, which
194 # iterates over all the subdirs; subdir_install in each subdir depends on
195 # the subdir's stubs file. Having more direct dependencies would result in
196 # extra iterations over the list for subdirs and many recursive makes.
197 $(inst_includedir)/gnu/stubs.h: subdir_install
198 $(make-target-directory)
199 @rm -f $(objpfx)stubs.h
200 (echo '/* This file is automatically generated.';\
201 echo ' It defines a symbol `__stub_FUNCTION'\'' for each function';\
202 echo ' in the C library which is a stub, meaning it will fail';\
203 echo ' every time called, usually setting errno to ENOSYS. */';\
204 sort $(subdir-stubs)) > $(objpfx)stubs.h
205 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
206 then echo 'stubs.h unchanged'; \
207 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
208 rm -f $(objpfx)stubs.h
210 ifeq (yes,$(build-shared))
212 $(inst_includedir)/gnu/lib-names.h: $(common-objpfx)gnu/lib-names.h
213 $(make-target-directory)
214 if test -r $@ && cmp -s $< $@; \
215 then echo 'gnu/lib-names.h unchanged'; \
216 else $(INSTALL_DATA) $< $@; fi
217 endif
219 # The `glibcbug' script contains the version number and it shall be rebuild
220 # whenever this changes or the `glibcbug.in' file.
221 $(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in
222 cd $(<D); CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F)
224 # This makes the Info or DVI file of the documentation from the Texinfo source.
225 .PHONY: info dvi
226 info dvi:
227 $(MAKE) $(PARALLELMFLAGS) -C manual $@
229 # This makes all the subdirectory targets.
231 # For each target, make it depend on DIR/target for each subdirectory DIR.
232 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
234 # Compute a list of all those targets.
235 all-subdirs-targets := $(foreach dir,$(subdirs),\
236 $(addprefix $(dir)/,$(+subdir_targets)))
238 # The action for each of those is to cd into the directory and make the
239 # target there.
240 $(all-subdirs-targets):
241 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
243 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
245 # Targets to clean things up to various degrees.
247 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean
249 # Subroutines of all cleaning targets.
250 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
251 -rm -f $(foreach o,$(object-suffixes),\
252 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
253 $(addprefix $(objpfx),$(install-lib))
254 parent-clean: parent-mostlyclean common-clean
255 -rm -f $(addprefix $(common-objpfx),$(common-generated))
256 -rm -f $(addprefix $(objpfx),sysd-Makefile sysd-dirs sysd-rules)
258 clean: parent-clean
259 # This is done this way rather than having `subdir_clean' be a
260 # dependency of this target so that libc.a will be removed before the
261 # subdirectories are dealt with and so they won't try to remove object
262 # files from it when it's going to be removed anyway.
263 @$(MAKE) subdir_clean no_deps=t
264 mostlyclean: parent-mostlyclean
265 @$(MAKE) subdir_mostlyclean no_deps=t
267 # The realclean target is just like distclean for the parent, but we want
268 # the subdirs to know the difference in case they care.
269 realclean distclean: parent-clean
270 # This is done this way rather than having `subdir_distclean' be a
271 # dependency of this target so that libc.a will be removed before the
272 # subdirectories are dealt with and so they won't try to remove object
273 # files from it when it's going to be removed anyway.
274 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes
276 # Subroutine of distclean and realclean.
277 distclean-1: subdir_$(distclean-1)
278 -rm -f $(config-generated)
279 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
280 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
281 -rm -f $(addprefix $(objpfx),glibcbug)
282 ifdef objdir
283 -rm -f $(objpfx)Makefile
284 endif
285 -rm -f $(sysdep-$(distclean-1))
287 .PHONY: echo_subdirs
288 echo_subdirs:;@echo '$(subdirs)'
290 .PHONY: echo-distinfo parent_echo-distinfo
291 echo-distinfo: parent_echo-distinfo subdir_echo-distinfo
292 parent_echo-distinfo:
293 @echo $(addprefix +header+,$(headers)) \
294 $(addprefix +nodist+,$(generated))
297 .PHONY: parent-tests
298 tests: parent-tests
300 # Run a test on the header files we use.
301 parent-tests: $(objpfx)isomac
302 $(dir $<)$(notdir $<) '$(CC)' '-Iinclude $(+sysdep-includes)' > $<.out
304 $(objpfx)isomac: isomac.c
305 $(native-compile)
307 # Make the distribution tarfile.
309 distribute := README INSTALL FAQ NOTES NEWS PROJECTS BUGS \
310 COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
311 Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
312 extra-lib.mk o-iterator.mk isomac.c \
313 libc.map mkinstalldirs move-if-change install-sh \
314 configure configure.in aclocal.m4 config.sub config.guess\
315 config.h.in config.make.in config-name.in Makefile.in \
316 autolock.sh rellns-sh munch-tmpl.c munch.awk interp.c \
317 sysdep.h set-hooks.h libc-symbols.h version.h shlib-versions \
318 rpm/Makefile rpm/template rpm/rpmrc glibcbug.in abi-tags \
319 stub-tag.h test-installation.pl
321 distribute := $(strip $(distribute))
322 generated := $(generated) stubs.h version-info.h
324 README: README.template version.h ; # Make-dist should update README.
326 define format-me
327 @rm -f $@
328 makeinfo --no-validate --no-warn --no-headers $< -o $@
329 -chmod a-w $@
330 endef
331 INSTALL: manual/maint.texi; $(format-me)
332 NOTES: manual/creature.texi; $(format-me)
333 manual/dir-add.texi manual/dir-add.info: FORCE
334 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
335 FAQ: gen-FAQ.pl FAQ.in
336 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
337 FORCE:
339 rpm/%: subdir_distinfo
340 $(MAKE) $(PARALLELMFLAGS) -C $(@D) subdirs='$(subdirs)' $(@F)
342 iconvdata/%:
343 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
345 # This is a special goal for people making binary distributions. Normally
346 # everybody uses the DES based crypt library but for the distribution we
347 # need the only-MD5 based one as well.
348 md5-crypt/libmd5crypt:
349 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)