1# NOTE: If you have no `make' program at all to process this makefile, run
2# `build.sh' instead.
3#
4# Copyright (C) 1988, 89, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
5# This file is part of GNU Make.
6#
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)
10# any later version.
11#
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.
16#
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.
21
22#
23#	Makefile for GNU Make
24#
25
26CC = sc
27RM = delete
28
29CFLAGS =
30CPPFLAGS =
31LDFLAGS =
32
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,
39#				so beware.
40# NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
41# See also `config.h'.
42defines =
43
44# Which flavor of remote job execution support to use.
45# The code is found in `remote-$(REMOTE).c'.
46REMOTE = stub
47
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.
50GETOPT = getopt.o getopt1.o
51GETOPT_SRC = $(srcdir)getopt.c $(srcdir)getopt1.c $(srcdir)getopt.h
52
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.
59GLOB = glob/glob.lib
60
61# If your system doesn't have alloca, or the one provided is bad, define this.
62ALLOCA = alloca.o
63ALLOCA_SRC = $(srcdir)alloca.c
64
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.
69LOADLIBES =
70
71# Any extra object files your system needs.
72extras = amiga.o
73
74# Common prefix for machine-independent installed files.
75prefix =
76# Common prefix for machine-dependent installed files.
77exec_prefix =
78
79# Directory to install `make' in.
80bindir = sc:c
81# Directory to find libraries in for `-lXXX'.
82libdir = lib:
83# Directory to search by default for included makefiles.
84includedir = include:
85# Directory to install the Info files in.
86infodir = doc:
87# Directory to install the man page in.
88mandir = t:
89# Number to put on the man page filename.
90manext = 1
91# Prefix to put on installed `make' binary file name.
92binprefix =
93# Prefix to put on installed `make' man page file name.
94manprefix = $(binprefix)
95
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.
100install_setgid = false
101# Install make setgid to this group so it can read /dev/kmem.
102group = sys
103
104# Program to install `make'.
105INSTALL_PROGRAM = copy
106# Program to install the man page.
107INSTALL_DATA = copy
108# Generic install program.
109INSTALL = copy
110
111# Program to format Texinfo source into Info files.
112MAKEINFO = makeinfo
113# Program to format Texinfo source into DVI files.
114TEXI2DVI = texi2dvi
115
116# Programs to make tags files.
117ETAGS = etags -w
118CTAGS = ctags -w
119
120objs = 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)
124srcs = $(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
136
137
138.SUFFIXES:
139.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
140
141all: make
142info: make.info
143dvi: make.dvi
144# Some makes apparently use .PHONY as the default goal if it is before `all'.
145.PHONY: all check info dvi
146
147make.info: make.texinfo
148	$(MAKEINFO) -I$(srcdir) $(srcdir)make.texinfo -o make.info
149
150make.dvi: make.texinfo
151	$(TEXI2DVI) $(srcdir)make.texinfo
152
153make.ps: make.dvi
154	dvi2ps make.dvi > make.ps
155
156make: $(objs) $(GLOB)
157	$(CC) Link $(LDFLAGS) $(objs) Lib $(GLOB) $(LOADLIBES) To make.new
158	-delete make
159	rename make.new make
160
161TMPFILE = t:Make$$
162
163$(GLOB):
164	cd glob @@\
165	$(MAKE) -$(MAKEFLAGS) -f Makefile
166
167# -I. is needed to find config.h in the build directory.
168OUTPUT_OPTION =
169.c.o:
170	$(CC) $(defines) IDir "" IDir glob \
171	      $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
172
173# For some losing Unix makes.
174SHELL = /bin/sh
175#@SET_MAKE@
176
177glob/libglob.a: FORCE config.h
178	cd glob; $(MAKE) libglob.a
179FORCE:
180
181tagsrcs = $(srcs) $(srcdir)remote-*.c
182
183.PHONY: install installdirs
184install: installdirs \
185	 $(bindir)$(binprefix)make $(infodir)make.info \
186	 $(mandir)$(manprefix)make.$(manext)
187
188installdirs:
189	$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(mandir)
190
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"; \
196	   else \
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 $@."; \
200	   fi; \
201	 else true; fi
202# Some systems can't deal with renaming onto a running binary.
203	-$(RM) $@.old
204	-mv $@ $@.old
205	mv $@.new $@
206
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,"`; \
213	done
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; \
222	else true; fi
223
224$(mandir)$(manprefix)make.$(manext): make.man
225	$(INSTALL_DATA) $(srcdir)make.man $@
226
227
228loadavg: 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.
233loadavg.c: getloadavg.c
234	ln $(srcdir)getloadavg.c loadavg.c || \
235	cp $(srcdir)getloadavg.c loadavg.c
236check-loadavg: loadavg
237	@echo The system uptime program believes the load average to be:
238	-uptime
239	@echo The GNU load average checking code believes:
240	./loadavg
241check: check-loadavg
242
243
244.PHONY: clean realclean distclean mostlyclean
245clean: glob-clean
246	-$(RM) make loadavg "#?.o" core make.dvi
247
248distclean: clean glob-realclean
249	-$(RM) Makefile config.h config.status build.sh
250	-$(RM) config.log config.cache
251	-$(RM) TAGS tags
252	-$(RM) make.?? make.??s make.log make.toc make.*aux
253	-$(RM) loadavg.c
254
255realclean: distclean
256	-$(RM) make.info*
257mostlyclean: clean
258
259.PHONY: glob-clean glob-realclean
260glob-clean glob-realclean:
261	cd glob @@\
262	$(MAKE) $@
263
264# This tells versions [3.59,3.63) of GNU make not to export all variables.
265.NOEXPORT:
266
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.
270$(objs): config.h
271
272# Automatically generated dependencies will be put at the end of the file.
273
274# Automatically generated dependencies.
275commands.o: commands.c make.h dep.h filedef.h variable.h job.h \
276 commands.h
277job.o: job.c make.h job.h filedef.h commands.h variable.h
278dir.o: dir.c make.h
279file.o: file.c make.h dep.h filedef.h job.h commands.h variable.h
280misc.o: misc.c make.h dep.h
281main.o: main.c make.h dep.h filedef.h variable.h job.h commands.h \
282 getopt.h
283read.o: read.c make.h dep.h filedef.h job.h commands.h variable.h \
284 glob/glob.h
285remake.o: remake.c make.h filedef.h job.h commands.h dep.h
286rule.o: rule.c make.h dep.h filedef.h job.h commands.h variable.h \
287 rule.h
288implicit.o: implicit.c make.h rule.h dep.h filedef.h
289default.o: default.c make.h rule.h dep.h filedef.h job.h commands.h \
290 variable.h
291variable.o: variable.c make.h dep.h filedef.h job.h commands.h \
292 variable.h
293expand.o: expand.c make.h filedef.h job.h commands.h variable.h
294function.o: function.c make.h filedef.h variable.h dep.h job.h \
295 commands.h amiga.h
296vpath.o: vpath.c make.h filedef.h variable.h
297version.o: version.c
298ar.o: ar.c make.h filedef.h dep.h
299arscan.o: arscan.c make.h
300signame.o: signame.c signame.h
301remote-stub.o: remote-stub.c make.h filedef.h job.h commands.h
302getopt.o: getopt.c
303getopt1.o : getopt1.c getopt.h
304getloadavg.o: getloadavg.c
305amiga.o: amiga.c make.h variable.h amiga.h
306