1 # NOTE: If you have no `make' program at all to process this makefile, run
4 # Copyright (C) 1988, 89, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
5 # This file is part of GNU Make.
7 # GNU Make is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # GNU Make is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Make; see the file COPYING. If not, write to
19 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 # Boston, MA 02111-1307, USA.
23 # Makefile for GNU Make
33 # Define these for your system as follows:
34 # -DNO_ARCHIVES To disable `ar' archive support.
35 # -DNO_FLOAT To avoid using floating-point numbers.
36 # -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2.
37 # Some compilers apparently accept this
38 # without complaint but produce losing code,
40 # NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
41 # See also `config.h'.
44 # Which flavor of remote job execution support to use.
45 # The code is found in `remote-$(REMOTE).c'.
48 # If you are using the GNU C library, or have the GNU getopt functions in
49 # your C library, you can comment these out.
50 GETOPT = getopt.o getopt1.o
51 GETOPT_SRC = $(srcdir)getopt.c $(srcdir)getopt1.c $(srcdir)getopt.h
53 # If you are using the GNU C library, or have the GNU glob functions in
54 # your C library, you can comment this out. GNU make uses special hooks
55 # into the glob functions to be more efficient (by using make's directory
56 # cache for globbing), so you must use the GNU functions even if your
57 # system's C library has the 1003.2 glob functions already. Also, the glob
58 # functions in the AIX and HPUX C libraries are said to be buggy.
61 # If your system doesn't have alloca, or the one provided is bad, define this.
63 ALLOCA_SRC = $(srcdir)alloca.c
65 # If your system needs extra libraries loaded in, define them here.
66 # System V probably need -lPW for alloca. HP-UX 7.0's alloca in
67 # libPW.a is broken on HP9000s300 and HP9000s400 machines. Use
68 # alloca.c instead on those machines.
71 # Any extra object files your system needs.
74 # Common prefix for machine-independent installed files.
76 # Common prefix for machine-dependent installed files.
79 # Directory to install `make' in.
81 # Directory to find libraries in for `-lXXX'.
83 # Directory to search by default for included makefiles.
85 # Directory to install the Info files in.
87 # Directory to install the man page in.
89 # Number to put on the man page filename.
91 # Prefix to put on installed `make' binary file name.
93 # Prefix to put on installed `make' man page file name.
94 manprefix = $(binprefix)
96 # Whether or not make needs to be installed setgid.
97 # The value should be either `true' or `false'.
98 # On many systems, the getloadavg function (used to implement the `-l'
99 # switch) will not work unless make is installed setgid kmem.
100 install_setgid = false
101 # Install make setgid to this group so it can read /dev/kmem.
104 # Program to install `make'.
105 INSTALL_PROGRAM = copy
106 # Program to install the man page.
108 # Generic install program.
111 # Program to format Texinfo source into Info files.
113 # Program to format Texinfo source into DVI files.
116 # Programs to make tags files.
120 objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \
121 rule.o implicit.o default.o variable.o expand.o function.o \
122 vpath.o version.o ar.o arscan.o signame.o remote-$(REMOTE).o \
123 $(GETOPT) $(ALLOCA) $(extras)
124 srcs = $(srcdir)commands.c $(srcdir)job.c $(srcdir)dir.c \
125 $(srcdir)file.c $(srcdir)getloadavg.c $(srcdir)misc.c \
126 $(srcdir)main.c $(srcdir)read.c $(srcdir)remake.c \
127 $(srcdir)rule.c $(srcdir)implicit.c $(srcdir)default.c \
128 $(srcdir)variable.c $(srcdir)expand.c $(srcdir)function.c \
129 $(srcdir)vpath.c $(srcdir)version.c \
130 $(srcdir)remote-$(REMOTE).c \
131 $(srcdir)ar.c $(srcdir)arscan.c \
132 $(srcdir)signame.c $(srcdir)signame.h $(GETOPT_SRC) \
133 $(srcdir)commands.h $(srcdir)dep.h $(srcdir)filedep.h \
134 $(srcdir)job.h $(srcdir)make.h $(srcdir)rule.h \
135 $(srcdir)variable.h $(ALLOCA_SRC) $(srcdir)config.h.in
139 .SUFFIXES: .o .c .h .ps .dvi .info .texinfo
144 # Some makes apparently use .PHONY as the default goal if it is before `all'.
145 .PHONY: all check info dvi
147 make.info: make.texinfo
148 $(MAKEINFO) -I$(srcdir) $(srcdir)make.texinfo -o make.info
150 make.dvi: make.texinfo
151 $(TEXI2DVI) $(srcdir)make.texinfo
154 dvi2ps make.dvi > make.ps
156 make: $(objs) $(GLOB)
157 $(CC) Link $(LDFLAGS) $(objs) Lib $(GLOB) $(LOADLIBES) To make.new
165 $(MAKE) -$(MAKEFLAGS) -f Makefile
167 # -I. is needed to find config.h in the build directory.
170 $(CC) $(defines) IDir "" IDir glob \
171 $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
173 # For some losing Unix makes.
177 glob/libglob.a: FORCE config.h
178 cd glob; $(MAKE) libglob.a
181 tagsrcs = $(srcs) $(srcdir)remote-*.c
183 .PHONY: install installdirs
184 install: installdirs \
185 $(bindir)$(binprefix)make $(infodir)make.info \
186 $(mandir)$(manprefix)make.$(manext)
189 $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(mandir)
191 $(bindir)$(binprefix)make: make
192 $(INSTALL_PROGRAM) make $@.new
193 @if $(install_setgid); then \
194 if chgrp $(group) $@.new && chmod g+s $@.new; then \
195 echo "chgrp $(group) $@.new && chmod g+s $@.new"; \
197 echo "$@ needs to be owned by group $(group) and setgid;"; \
198 echo "otherwise the \`-l' option will probably not work."; \
199 echo "You may need special privileges to install $@."; \
202 # Some systems can't deal with renaming onto a running binary.
207 $(infodir)make.info: make.info
208 if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
209 for file in $${dir}/make.info*; do \
210 name="`basename $$file`"; \
211 $(INSTALL_DATA) $$file \
212 `echo $@ | sed "s,make.info\$$,$$name,"`; \
214 # Run install-info only if it exists.
215 # Use `if' instead of just prepending `-' to the
216 # line so we notice real errors from install-info.
217 # We use `$(SHELL) -c' because some shells do not
218 # fail gracefully when there is an unknown command.
219 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
220 if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
221 install-info --infodir=$(infodir) $$dir/make.info; \
224 $(mandir)$(manprefix)make.$(manext): make.man
225 $(INSTALL_DATA) $(srcdir)make.man $@
228 loadavg: loadavg.c config.h
229 $(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
230 loadavg.c $(LOADLIBES) -o $@
231 # We copy getloadavg.c into a different file rather than compiling it
232 # directly because some compilers clobber getloadavg.o in the process.
233 loadavg.c: getloadavg.c
234 ln $(srcdir)getloadavg.c loadavg.c || \
235 cp $(srcdir)getloadavg.c loadavg.c
236 check-loadavg: loadavg
237 @echo The system uptime program believes the load average to be:
239 @echo The GNU load average checking code believes:
244 .PHONY: clean realclean distclean mostlyclean
246 -$(RM) make loadavg "#?.o" core make.dvi
248 distclean: clean glob-realclean
249 -$(RM) Makefile config.h config.status build.sh
250 -$(RM) config.log config.cache
252 -$(RM) make.?? make.??s make.log make.toc make.*aux
259 .PHONY: glob-clean glob-realclean
260 glob-clean glob-realclean:
264 # This tells versions [3.59,3.63) of GNU make not to export all variables.
267 # The automatically generated dependencies below may omit config.h
268 # because it is included with ``#include <config.h>'' rather than
269 # ``#include "config.h"''. So we add the explicit dependency to make sure.
272 # Automatically generated dependencies will be put at the end of the file.
274 # Automatically generated dependencies.
275 commands.o: commands.c make.h dep.h filedef.h variable.h job.h \
277 job.o: job.c make.h job.h filedef.h commands.h variable.h
279 file.o: file.c make.h dep.h filedef.h job.h commands.h variable.h
280 misc.o: misc.c make.h dep.h
281 main.o: main.c make.h dep.h filedef.h variable.h job.h commands.h \
283 read.o: read.c make.h dep.h filedef.h job.h commands.h variable.h \
285 remake.o: remake.c make.h filedef.h job.h commands.h dep.h
286 rule.o: rule.c make.h dep.h filedef.h job.h commands.h variable.h \
288 implicit.o: implicit.c make.h rule.h dep.h filedef.h
289 default.o: default.c make.h rule.h dep.h filedef.h job.h commands.h \
291 variable.o: variable.c make.h dep.h filedef.h job.h commands.h \
293 expand.o: expand.c make.h filedef.h job.h commands.h variable.h
294 function.o: function.c make.h filedef.h variable.h dep.h job.h \
296 vpath.o: vpath.c make.h filedef.h variable.h
298 ar.o: ar.c make.h filedef.h dep.h
299 arscan.o: arscan.c make.h
300 signame.o: signame.c signame.h
301 remote-stub.o: remote-stub.c make.h filedef.h job.h commands.h
303 getopt1.o : getopt1.c getopt.h
304 getloadavg.o: getloadavg.c
305 amiga.o: amiga.c make.h variable.h amiga.h