1 # NOTE: If you have no `make' program at all to process this makefile, run
4 # Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994 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, 675 Mass Ave, Cambridge, MA 02139, USA.
22 # Makefile for GNU Make
25 # Ultrix 2.2 make doesn't expand the value of VPATH.
27 # This must repeat the value, because configure will remove `VPATH = .'.
35 # How to invoke ranlib. This is only used by the `glob' subdirectory.
38 # Define these for your system as follows:
39 # -DNO_ARCHIVES To disable `ar' archive support.
40 # -DNO_FLOAT To avoid using floating-point numbers.
41 # -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2.
42 # Some compilers apparently accept this
43 # without complaint but produce losing code,
45 # NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
46 # See also `config.h'.
47 defines = @DEFS@ -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\"
49 # Which flavor of remote job execution support to use.
50 # The code is found in `remote-$(REMOTE).c'.
53 # If you are using the GNU C library, or have the GNU getopt functions in
54 # your C library, you can comment these out.
55 GETOPT = getopt.o getopt1.o
56 GETOPT_SRC = $(srcdir)/getopt.c $(srcdir)/getopt1.c $(srcdir)/getopt.h
58 # If you are using the GNU C library, or have the GNU glob functions in
59 # your C library, you can comment this out. GNU make uses special hooks
60 # into the glob functions to be more efficient (by using make's directory
61 # cache for globbing), so you must use the GNU functions even if your
62 # system's C library has the 1003.2 glob functions already. Also, the glob
63 # functions in the AIX and HPUX C libraries are said to be buggy.
66 # If your system doesn't have alloca, or the one provided is bad, define this.
68 ALLOCA_SRC = $(srcdir)/alloca.c
70 # If your system needs extra libraries loaded in, define them here.
71 # System V probably need -lPW for alloca. HP-UX 7.0's alloca in
72 # libPW.a is broken on HP9000s300 and HP9000s400 machines. Use
73 # alloca.c instead on those machines.
76 # Any extra object files your system needs.
79 # Common prefix for machine-independent installed files.
81 # Common prefix for machine-dependent installed files.
82 exec_prefix = $(prefix)
84 # Directory to install `make' in.
85 bindir = $(exec_prefix)/bin
86 # Directory to find libraries in for `-lXXX'.
87 libdir = $(exec_prefix)/lib
88 # Directory to search by default for included makefiles.
89 includedir = $(prefix)/include
90 # Directory to install the Info files in.
91 infodir = $(prefix)/info
92 # Directory to install the man page in.
93 mandir = $(prefix)/man/man$(manext)
94 # Number to put on the man page filename.
96 # Prefix to put on installed `make' binary file name.
98 # Prefix to put on installed `make' man page file name.
99 manprefix = $(binprefix)
101 # Whether or not make needs to be installed setgid.
102 # The value should be either `true' or `false'.
103 # On many systems, the getloadavg function (used to implement the `-l'
104 # switch) will not work unless make is installed setgid kmem.
105 install_setgid = @NEED_SETGID@
106 # Install make setgid to this group so it can read /dev/kmem.
109 # Program to install `make'.
110 INSTALL_PROGRAM = @INSTALL_PROGRAM@
111 # Program to install the man page.
112 INSTALL_DATA = @INSTALL_DATA@
113 # Generic install program.
116 # Program to format Texinfo source into Info files.
118 # Program to format Texinfo source into DVI files.
121 # Programs to make tags files.
125 objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \
126 rule.o implicit.o default.o variable.o expand.o function.o \
127 vpath.o version.o ar.o arscan.o signame.o remote-$(REMOTE).o \
128 $(GLOB) $(GETOPT) $(ALLOCA) $(extras)
129 srcs = $(srcdir)/commands.c $(srcdir)/job.c $(srcdir)/dir.c \
130 $(srcdir)/file.c $(srcdir)/getloadavg.c $(srcdir)/misc.c \
131 $(srcdir)/main.c $(srcdir)/read.c $(srcdir)/remake.c \
132 $(srcdir)/rule.c $(srcdir)/implicit.c $(srcdir)/default.c \
133 $(srcdir)/variable.c $(srcdir)/expand.c $(srcdir)/function.c \
134 $(srcdir)/vpath.c $(srcdir)/version.c \
135 $(srcdir)/remote-$(REMOTE).c \
136 $(srcdir)/ar.c $(srcdir)/arscan.c \
137 $(srcdir)/signame.c $(srcdir)/signame.h $(GETOPT_SRC) \
138 $(srcdir)/commands.h $(srcdir)/dep.h $(srcdir)/file.h \
139 $(srcdir)/job.h $(srcdir)/make.h $(srcdir)/rule.h \
140 $(srcdir)/variable.h $(ALLOCA_SRC) $(srcdir)/config.h.in
144 .SUFFIXES: .o .c .h .ps .dvi .info .texinfo
150 # Some makes apparently use .PHONY as the default goal is it is before `all'.
151 .PHONY: all check info dvi
153 make.info: make.texinfo
154 $(MAKEINFO) -I$(srcdir) $(srcdir)/make.texinfo -o make.info
156 make.dvi: make.texinfo
157 $(TEXI2DVI) $(srcdir)/make.texinfo
160 dvi2ps make.dvi > make.ps
163 $(CC) $(LDFLAGS) $(objs) $(LOADLIBES) -o make.new
166 # -I. is needed to find config.h in the build directory.
168 $(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \
169 $(CFLAGS) $< $(OUTPUT_OPTION)
171 # For some losing Unix makes.
175 glob/libglob.a: FORCE config.h
176 cd glob; $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS) -I..' \
177 CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H' \
182 tagsrcs = $(srcs) $(srcdir)/remote-*.c
188 .PHONY: install installdirs
189 install: installdirs \
190 $(bindir)/$(binprefix)make $(infodir)/make.info \
191 $(mandir)/$(manprefix)make.$(manext)
194 $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(mandir)
196 $(bindir)/$(binprefix)make: make
197 $(INSTALL_PROGRAM) make $@.new
198 @if $(install_setgid); then \
199 if chgrp $(group) $@.new && chmod g+s $@.new; then \
200 echo "chgrp $(group) $@.new && chmod g+s $@.new"; \
202 echo "$@ needs to be owned by group $(group) and setgid;"; \
203 echo "otherwise the \`-l' option will probably not work."; \
204 echo "You may need special priveleges to install $@."; \
207 # Some systems can't deal with renaming onto a running binary.
212 $(infodir)/make.info: make.info
213 if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
214 for file in $${dir}/make.info*; do \
215 name="`basename $$file`"; \
216 $(INSTALL_DATA) $$file \
217 `echo $@ | sed "s,make.info\$$,$$name,"`; \
219 # Run install-info only if it exists.
220 # Use `if' instead of just prepending `-' to the
221 # line so we notice real errors from install-info.
222 # We use `$(SHELL) -c' because some shells do not
223 # fail gracefully when there is an unknown command.
224 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
225 install-info --infodir=$(infodir) $$dir/make.info; \
228 $(mandir)/$(manprefix)make.$(manext): make.man
229 $(INSTALL_DATA) $(srcdir)/make.man $@
232 loadavg: loadavg.c config.h
233 $(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
234 loadavg.c $(LOADLIBES) -o $@
235 # We copy getloadavg.c into a different file rather than compiling it
236 # directly because some compilers clobber getloadavg.o in the process.
237 loadavg.c: getloadavg.c
238 ln $(srcdir)/getloadavg.c loadavg.c || \
239 cp $(srcdir)/getloadavg.c loadavg.c
240 check-loadavg: loadavg
241 @echo The system uptime program believes the load average to be:
243 @echo The GNU load average checking code believes:
248 .PHONY: clean realclean distclean mostlyclean
250 -rm -f make loadavg *.o core make.info* make.dvi
251 distclean: clean glob-realclean
252 -rm -f Makefile config.h config.status build.sh stamp-config
254 -rm -f make.?? make.??s make.log make.toc make.*aux
259 .PHONY: glob-clean glob-realclean
260 glob-clean glob-realclean:
263 Makefile: config.status $(srcdir)/Makefile.in
264 $(SHELL) config.status
265 glob/Makefile: config.status $(srcdir)/glob/Makefile.in
266 $(SHELL) config.status
267 config.h: stamp-config ;
268 stamp-config: config.status $(srcdir)/config.h.in
269 $(SHELL) config.status
272 # These rules cause too much trouble.
273 #configure: configure.in
274 # autoconf $(ACFLAGS)
275 #config.h.in: configure.in
276 # autoheader $(ACFLAGS)
278 # This tells versions [3.59,3.63) of GNU make not to export all variables.
281 # The automatically generated dependencies below may omit config.h
282 # because it is included with ``#include <config.h>'' rather than
283 # ``#include "config.h"''. So we add the explicit dependency to make sure.
286 # Automatically generated dependencies will be put at the end of the file.