1 # GNU Make-specific makefile for GNU Make.
3 # Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 # This file is part of GNU Make.
6 # GNU Make is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # GNU Make is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Make; see the file COPYING. If not, write to
18 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 # Set `ARCH' to a string for the type of machine.
37 override REMOTE := cstms
39 override REMOTE := stub
42 # Get most of the information from the Unix-compatible makefile.
43 include compatMakefile
45 MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES)
47 # Remove autoconf magic.
49 exec_prefix = $(prefix)
50 extras := $(filter-out getloadavg.o @%@,$(extras)) getloadavg.o
51 LOADLIBES := $(filter-out @%@,$(LOADLIBES))
52 ALLOCA := $(filter-out @%@,$(ALLOCA))
55 configure config.h.in: $(patsubst %,$(AC_MACRODIR)/%.m4,acspecific acgeneral)
56 config.h.in: $(AC_MACRODIR)/acconfig.h
58 configure: configure.in; autoconf $(ACFLAGS)
59 config.h.in: configure.in; autoheader $(ACFLAGS)
62 defines := $(defines) -Ipmake/customs -Ipmake/lib/include
63 LOADLIBES := $(addprefix pmake/customs/,customslib.o rpc.o xlog.o) \
64 pmake/lib/sprite/libsprite.a
70 libc_dir = /home/gd2/gnu/libc/$(ARCH)
71 ifneq ($(wildcard $(libc_dir)),)
72 ifneq ($(wildcard $(libc_dir)/works-for-make),)
73 #CPPFLAGS := -I$(libc_dir)/include
74 #LDFLAGS := -nostdlib $(libc_dir)/lib/start.o
75 #LOADLIBES := $(LOADLIBES) \
76 # $(libc_dir)/lib/mcheck-init.o \
77 # $(libc_dir)/lib/libc.a \
79 # $(libc_dir)/lib/libc.a
84 #GETOPT_SRC = Don't clear this or dist will break.
86 # glob is in libc too.
91 CPPFLAGS := $(filter-out @%@,$(CPPFLAGS)) -Iglob
93 endif # works-for-make
97 # We know the type of machine, so put the binaries in subdirectories.
99 $(COMPILE.c) -Iglob $< $(OUTPUT_OPTION)
100 $(ARCH)/glob/libglob.a: FORCE
101 $(MAKE) -C $(@D) $(@F)
103 objs := $(addprefix $(ARCH)/,$(objs))
108 $(archpfx)load.o: load.c
109 $(COMPILE.c) $(LOAD_AVG) $< -o $@
110 $(archpfx)load.dep: load.c
111 $(mkdep) $(LOAD_AVG) $< | sed 's,$*\.o,& $@,' > $@
113 CPPFLAGS := -I$(ARCH) $(CPPFLAGS) -DHAVE_CONFIG_H $(filter-out @%@,$(defines))
115 ifneq "$(wildcard $(ARCH)/makefile)" ""
116 include $(ARCH)/makefile
118 objs := $(objs) $(addprefix $(ARCH)/,$(ALLOCA) $(extras))
124 ifneq "$(findstring gcc,$(CC))" ""
125 CFLAGS = -g -W -Wunused -Wpointer-arith -Wreturn-type -Wswitch
131 # Define the command to make dependencies.
132 ifneq "$(findstring gcc,$(CC))" ""
133 # Don't include system directories.
134 mkdep-nolib = $(CC) -MM $(CPPFLAGS)
136 mkdep-nolib = $(mkdep)
138 mkdep = $(CC) -M $(CPPFLAGS)
140 depfiles = $(patsubst %.o,%.dep,$(filter %.o,$(objs)))
146 $(prog): $(objs) $(globdep) #$(addprefix $(ARCH)/,gmalloc.o mcheck.o)
147 $(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new
150 globfiles = $(addprefix glob/,COPYING.LIB Makefile.in \
151 glob.c fnmatch.c glob.h fnmatch.h)
152 $(globfiles): stamp-glob ;
153 stamp-glob: /home/gd/gnu/libc/posix/glob.tar
157 /home/gd/gnu/libc/posix/glob.tar: force
158 $(MAKE) -C $(@D) $(@F) no_deps=t
162 # Make the Unix-compatible Makefile to be distributed by appending
163 # the automatically-generated dependencies to compatMakefile.
164 ifeq ($(mkdep),$(mkdep-nolib))
165 nolib-deps = $(depfiles)
168 $(mkdep-nolib) $< | sed -e 's,$*\.o,$(@:.dep=.o) $@,' > $(@:.dep=.dtm)
169 mv -f $(@:.dep=.dtm) $@
170 nolib-deps = $(patsubst $(archpfx)%,%,$(depfiles))
172 # The distributed Makefile.in should contain deps for remote-stub only.
173 Makefile.in: compatMakefile $(nolib-deps:remote-%.dep=remote-stub.dep)
174 (sed 's/^MAKE[ ]*=.*$$/@SET_MAKE@/' $<; \
175 echo '# Automatically generated dependencies.'; \
176 sed -e 's/ [^ ]*\.dep//' -e 's=$(archpfx)==' $(filter-out $<,$^) \
180 # Maintain the automatically-generated dependencies.
185 $(mkdep) $< | sed 's,$*\.o,$(@:.dep=.o) $@,' > $@
187 ETAGS = etags -T # for v19 etags
191 testdir := $(shell ls -d1 make-test-?.? | sort -n +0.10 -0.11 +0.12 | tail -1l)
192 tests:# $(testdir)/run_make_tests.pl $(prog)
193 # cd $(<D); MAKELEVEL=0 perl $(<F)
195 build.sh.in: build.template compatMakefile
196 sed -e 's@%objs%@$(filter-out remote-% $(GLOB) $(ALLOCA) $(extras),\
197 $(patsubst $(archpfx)%,%,$(objs)))\
198 $(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
202 # Make the distribution tar files.
205 # Figure out the version number from the source of `version.c'.
207 $(strip $(shell sed -e '/=/!d' -e 's/^.*"\(.*\)";$$/\1/' < version.c))
208 tarfiles := make # make-doc
209 tarfiles := $(addsuffix -$(version).tar,$(tarfiles))
210 tarfiles := $(tarfiles:%=%.gz) # no more compress $(tarfiles:%=%.Z)
211 # Depend on default and doc so we don't ship anything that won't compile.
212 dist: rcs-mark default info dvi tests tarfiles
214 tarfiles: $(tarfiles)
219 .PHONY: rcs-mark rcs-mark-alpha rcs-mark-beta
220 rcs-mark: rcs-mark-$(dist-flavor)
221 rcs-mark-alpha: RCS/[!=]*,v;rcs -sAlpha -Nmake-$(version-): $^
222 rcs-mark-beta: RCS/[!=]*,v;rcs -sBeta -Nmake-$(version-): $^
223 version- = $(subst .,-,$(version))
228 install -c -g kmem -o $(USER) -m 2755 $< /usr/local/gnubin/make
230 # Put the alpha distribution files in the anonymous FTP directory.
231 alpha-files = $(tarfiles) GNUmakefile compatMakefile $(testdir).tar.Z
234 alpha-dir := ~ftp/gnu
235 alpha-files := $(addprefix $(alpha-dir)/,$(alpha-files))
236 alpha: $(alpha-dir) $(alpha-files)
241 # Implicit rule to make README and README-doc.
242 %: %.template version.c
244 sed 's/VERSION/$(version)/' < $< > $@
245 # Make sure I don't edit it by accident.
249 @rm -fr make-$(version)
250 ln -s . make-$(version)
251 tar cvhof $@ $(addprefix make-$(version)/,$^)
252 rm -f make-$(version)
255 %.Z: %; compress -c $< > $@
256 %.gz: %; gzip -9 -c -v $< > $@
258 make-doc-$(version).tar: README-doc COPYING make.dvi make.info make.info*
260 make-$(version).tar: README INSTALL COPYING ChangeLog NEWS \
261 configure Makefile.in configure.in build.sh.in mkinstalldirs \
262 acconfig.h $(srcs) remote-*.c $(globfiles) \
263 make.texinfo make-stds.texi \
264 make.?? make.??s make.toc make.aux make.man texinfo.tex TAGS tags \
270 tests := $(filter-out %~,$(wildcard tests/*))
271 make-tests-$(version).tar.Z: $(tests)
272 @rm -fr make-tests-$(version)
273 ln -s tests make-tests-$(version)
274 tar cvhf $(@:.Z=) $(patsubst tests/%,make-tests-$(version)/%,$^)
275 rm -f make-tests-$(version)
279 $(archpfx)loadtest: $(archpfx)load.o