1 # GNU Make-specific makefile for GNU Make.
3 # Copyright (C) 1990, 1991, 1992, 1993 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 # Remove autoconf magic.
46 extras
:= $(filter-out getloadavg.o @
%@
,$(extras
)) getloadavg.o
47 LOADLIBES
:= $(filter-out @
%@
,$(LOADLIBES
))
48 ALLOCA
:= $(filter-out @
%@
,$(ALLOCA
))
50 # Tell autoconf/autoheader to use m4 files from the master source.
51 ACFLAGS
:= -m
/home
/gd
/gnu
/autoconf
52 configure config.h.in
: $(patsubst %,/home
/gd
/gnu
/autoconf
/%.m4
,\
54 config.h.in
: /home
/gd
/gnu
/autoconf
/acconfig.h
57 defines
:= $(defines
) -Ipmake
/customs
-Ipmake
/lib
/include
58 LOADLIBES
:= $(addprefix pmake
/customs
/,customslib.o rpc.o xlog.o
) \
59 pmake
/lib
/sprite
/libsprite.a
65 libc_dir
= /home
/gd2
/gnu
/libc
/$(ARCH
)
66 ifneq ($(wildcard $(libc_dir
)),)
67 ifneq ($(wildcard $(libc_dir
)/works-for-make
),)
68 #CPPFLAGS := -I$(libc_dir)/include
69 #LDFLAGS := -nostdlib $(libc_dir)/lib/start.o
70 #LOADLIBES := $(LOADLIBES) \
71 # $(libc_dir)/lib/mcheck-init.o \
72 # $(libc_dir)/lib/libc.a \
74 # $(libc_dir)/lib/libc.a
79 #GETOPT_SRC = Don't clear this or dist will break.
81 # glob is in libc too.
86 CPPFLAGS
:= $(CPPFLAGS
) -Iglob
88 endif # works-for-make
92 # We know the type of machine, so put the binaries in subdirectories.
94 $(COMPILE.c
) -Iglob
$< $(OUTPUT_OPTION
)
95 $(ARCH
)/glob
/libglob.a
: FORCE
96 $(MAKE
) -C
$(@D
) $(@F
) \
97 CC
='$(CC)' CFLAGS
='$(CFLAGS) -I..' \
98 CPPFLAGS
='$(CPPFLAGS) -DHAVE_CONFIG_H'
100 objs
:= $(addprefix $(ARCH
)/,$(objs
))
105 $(archpfx
)load.o
: load.c
106 $(COMPILE.c
) $(LOAD_AVG
) $< -o
$@
107 $(archpfx
)load.dep
: load.c
108 $(mkdep
) $(LOAD_AVG
) $< | sed
's,$*\.o,& $@,' > $@
110 CPPFLAGS
:= -I
$(ARCH
) $(CPPFLAGS
) -DHAVE_CONFIG_H
$(filter-out @
%@
,$(defines
))
112 ifneq "$(wildcard $(ARCH)/makefile)" ""
113 include $(ARCH
)/makefile
115 objs
:= $(objs
) $(addprefix $(ARCH
)/,$(ALLOCA
) $(extras
))
121 ifneq "$(findstring gcc,$(CC))" ""
122 CFLAGS
= -g
-W
-Wunused
-Wpointer-arith
-Wreturn-type
-Wswitch
128 # Define the command to make dependencies.
129 ifneq "$(findstring gcc,$(CC))" ""
130 # Don't include system directories.
131 mkdep-nolib
= $(CC
) -MM
$(CPPFLAGS
)
133 mkdep-nolib
= $(mkdep
)
135 mkdep
= $(CC
) -M
$(CPPFLAGS
)
137 depfiles
= $(patsubst %.o
,%.dep
,$(filter %.o
,$(objs
)))
143 $(prog
): $(objs
) $(globdep
) $(addprefix $(ARCH
)/,gmalloc.o mcheck.o
)
144 $(CC
) $(LDFLAGS
) $^
$(globlib
) $(LOADLIBES
) -o
$@.new
147 globfiles
= $(addprefix glob
/,COPYING.LIB Makefile.in \
148 glob.c fnmatch.c glob.h fnmatch.h
)
149 $(globfiles
): stamp-glob
;
150 stamp-glob
: /home
/gd
/gnu
/libc
/posix
/glob.
tar
154 /home
/gd
/gnu
/libc
/posix
/glob.
tar: force
155 $(MAKE
) -C
$(@D
) $(@F
) no_deps
=t
159 # Make the Unix-compatible Makefile to be distributed by appending
160 # the automatically-generated dependencies to compatMakefile.
161 ifeq ($(mkdep
),$(mkdep-nolib
))
162 nolib-deps
= $(depfiles
)
165 $(mkdep-nolib
) $< | sed
-e
's,$*\.o,$(@:.dep=.o) $@,' > $@
166 nolib-deps
= $(patsubst $(archpfx
)%,%,$(depfiles
))
168 # The distributed Makefile.in should contain deps for remote-stub only.
169 Makefile.in
: compatMakefile
$(nolib-deps
:remote-
%.dep
=remote-stub.dep
)
171 echo
'# Automatically generated dependencies.'; \
172 sed
-e
's/ [^ ]*\.dep//' -e
's=$(archpfx)==' $(filter-out $<,$^
) \
176 # Maintain the automatically-generated dependencies.
181 $(mkdep
) $< | sed
's,$*\.o,$(@:.dep=.o) $@,' > $@
183 ETAGS
= etags
-T
# for v19 etags
187 testdir
:= $(shell ls
-d1 make-test-?.? |
sort -n
+0.10 -0.11 +0.12 | tail
-1l)
188 tests
:# $(testdir)/run_make_tests.pl $(prog)
189 # cd $(<D); MAKELEVEL=0 perl $(<F)
191 build.sh.in
: build.template compatMakefile
192 sed
-e
's@%objs%@$(filter-out remote-% $(GLOB) $(ALLOCA) $(extras),\
193 $(patsubst $(archpfx)%,%,$(objs)))\
194 $(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
198 # Make the distribution tar files.
201 # Figure out the version number from the source of `version.c'.
203 $(strip $(shell sed
-e
'/=/!d' -e
's/^.*"\(.*\)";$$/\1/' < version.c
))
204 tarfiles
:= make make-doc
205 tarfiles
:= $(addsuffix -$(version
).
tar,$(tarfiles
))
206 tarfiles
:= $(tarfiles
:%=%.gz
) # no more compress $(tarfiles:%=%.Z)
207 # Depend on default and doc so we don't ship anything that won't compile.
208 dist: default
info dvi tests tarfiles
210 tarfiles
: $(tarfiles
)
215 install -c
-g kmem
-o
$(USER
) -m
2755 $< /usr
/local
/gnubin
/make
217 # Put the alpha distribution files in the anonymous FTP directory.
218 alpha-files
= $(tarfiles
) GNUmakefile compatMakefile
$(testdir
).
tar.Z
221 alpha-dir
:= ~ftp
/gnu
222 alpha-files
:= $(addprefix $(alpha-dir
)/,$(alpha-files
))
223 alpha
: $(alpha-dir
) $(alpha-files
)
228 # Implicit rule to make README and README-doc.
229 %: %.template version.c
231 sed
's/VERSION/$(version)/' < $< > $@
232 # Make sure I don't edit it by accident.
236 @
rm -fr make-
$(version
)
237 ln
-s . make-
$(version
)
238 tar cvhof
$@
$(addprefix make-
$(version
)/,$^
)
239 rm -f make-
$(version
)
242 %.Z
: %; compress
-c
$< > $@
243 %.gz
: %; gzip
-9 -c
-v
$< > $@
245 make-doc-
$(version
).
tar: README-doc COPYING make.
dvi make.
info make.
info*
247 make-
$(version
).
tar: README INSTALL COPYING ChangeLog NEWS \
248 configure Makefile.in configure.in build.sh.in mkinstalldirs \
249 acconfig.h
$(srcs
) remote-
*.c
$(globfiles
) \
250 make.texinfo make-stds.texi \
251 make.?? make.??s make.toc make.aux make.man texinfo.
tex TAGS
tags
255 tests
:= $(filter-out %~
,$(wildcard tests
/*))
256 make-tests-
$(version
).
tar.Z
: $(tests
)
257 @
rm -fr make-tests-
$(version
)
258 ln
-s tests make-tests-
$(version
)
259 tar cvhf
$(@
:.Z
=) $(patsubst tests
/%,make-tests-
$(version
)/%,$^
)
260 rm -f make-tests-
$(version
)
264 $(archpfx
)loadtest
: $(archpfx
)load.o