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.
48 extras
:= $(filter-out getloadavg.o @
%@
,$(extras
)) getloadavg.o
49 LOADLIBES
:= $(filter-out @
%@
,$(LOADLIBES
))
50 ALLOCA
:= $(filter-out @
%@
,$(ALLOCA
))
52 # Tell autoconf/autoheader to use m4 files from the master source.
53 ACFLAGS
:= -m
/home
/gd
/gnu
/autoconf
54 configure config.h.in
: $(patsubst %,/home
/gd
/gnu
/autoconf
/%.m4
,\
56 config.h.in
: /home
/gd
/gnu
/autoconf
/acconfig.h
57 configure
: configure.in
; autoconf
$(ACFLAGS
)
58 config.h.in
: configure.in
; autoheader
$(ACFLAGS
)
61 defines
:= $(defines
) -Ipmake
/customs
-Ipmake
/lib
/include
62 LOADLIBES
:= $(addprefix pmake
/customs
/,customslib.o rpc.o xlog.o
) \
63 pmake
/lib
/sprite
/libsprite.a
69 libc_dir
= /home
/gd2
/gnu
/libc
/$(ARCH
)
70 ifneq ($(wildcard $(libc_dir
)),)
71 ifneq ($(wildcard $(libc_dir
)/works-for-make
),)
72 #CPPFLAGS := -I$(libc_dir)/include
73 #LDFLAGS := -nostdlib $(libc_dir)/lib/start.o
74 #LOADLIBES := $(LOADLIBES) \
75 # $(libc_dir)/lib/mcheck-init.o \
76 # $(libc_dir)/lib/libc.a \
78 # $(libc_dir)/lib/libc.a
83 #GETOPT_SRC = Don't clear this or dist will break.
85 # glob is in libc too.
90 CPPFLAGS
:= $(CPPFLAGS
) -Iglob
92 endif # works-for-make
96 # We know the type of machine, so put the binaries in subdirectories.
98 $(COMPILE.c
) -Iglob
$< $(OUTPUT_OPTION
)
99 $(ARCH
)/glob
/libglob.a
: FORCE
100 $(MAKE
) -C
$(@D
) $(@F
) \
101 CC
='$(CC)' CFLAGS
='$(CFLAGS) -I..' \
102 CPPFLAGS
='$(CPPFLAGS) -DHAVE_CONFIG_H'
104 objs
:= $(addprefix $(ARCH
)/,$(objs
))
109 $(archpfx
)load.o
: load.c
110 $(COMPILE.c
) $(LOAD_AVG
) $< -o
$@
111 $(archpfx
)load.dep
: load.c
112 $(mkdep
) $(LOAD_AVG
) $< | sed
's,$*\.o,& $@,' > $@
114 CPPFLAGS
:= -I
$(ARCH
) $(CPPFLAGS
) -DHAVE_CONFIG_H
$(filter-out @
%@
,$(defines
))
116 ifneq "$(wildcard $(ARCH)/makefile)" ""
117 include $(ARCH
)/makefile
119 objs
:= $(objs
) $(addprefix $(ARCH
)/,$(ALLOCA
) $(extras
))
125 ifneq "$(findstring gcc,$(CC))" ""
126 CFLAGS
= -g
-W
-Wunused
-Wpointer-arith
-Wreturn-type
-Wswitch
132 # Define the command to make dependencies.
133 ifneq "$(findstring gcc,$(CC))" ""
134 # Don't include system directories.
135 mkdep-nolib
= $(CC
) -MM
$(CPPFLAGS
)
137 mkdep-nolib
= $(mkdep
)
139 mkdep
= $(CC
) -M
$(CPPFLAGS
)
141 depfiles
= $(patsubst %.o
,%.dep
,$(filter %.o
,$(objs
)))
147 $(prog
): $(objs
) $(globdep
) #$(addprefix $(ARCH)/,gmalloc.o mcheck.o)
148 $(CC
) $(LDFLAGS
) $^
$(globlib
) $(LOADLIBES
) -o
$@.new
151 globfiles
= $(addprefix glob
/,COPYING.LIB Makefile.in \
152 glob.c fnmatch.c glob.h fnmatch.h
)
153 $(globfiles
): stamp-glob
;
154 stamp-glob
: /home
/gd
/gnu
/libc
/posix
/glob.
tar
158 /home
/gd
/gnu
/libc
/posix
/glob.
tar: force
159 $(MAKE
) -C
$(@D
) $(@F
) no_deps
=t
163 # Make the Unix-compatible Makefile to be distributed by appending
164 # the automatically-generated dependencies to compatMakefile.
165 ifeq ($(mkdep
),$(mkdep-nolib
))
166 nolib-deps
= $(depfiles
)
169 $(mkdep-nolib
) $< | sed
-e
's,$*\.o,$(@:.dep=.o) $@,' > $(@
:.dep
=.dtm
)
170 mv
-f
$(@
:.dep
=.dtm
) $@
171 nolib-deps
= $(patsubst $(archpfx
)%,%,$(depfiles
))
173 # The distributed Makefile.in should contain deps for remote-stub only.
174 Makefile.in
: compatMakefile
$(nolib-deps
:remote-
%.dep
=remote-stub.dep
)
175 (sed
's/^MAKE[ ]*=.*$$/@SET_MAKE@/' $<; \
176 echo
'# Automatically generated dependencies.'; \
177 sed
-e
's/ [^ ]*\.dep//' -e
's=$(archpfx)==' $(filter-out $<,$^
) \
181 # Maintain the automatically-generated dependencies.
186 $(mkdep
) $< | sed
's,$*\.o,$(@:.dep=.o) $@,' > $@
188 ETAGS
= etags
-T
# for v19 etags
192 testdir
:= $(shell ls
-d1 make-test-?.? |
sort -n
+0.10 -0.11 +0.12 | tail
-1l)
193 tests
:# $(testdir)/run_make_tests.pl $(prog)
194 # cd $(<D); MAKELEVEL=0 perl $(<F)
196 build.sh.in
: build.template compatMakefile
197 sed
-e
's@%objs%@$(filter-out remote-% $(GLOB) $(ALLOCA) $(extras),\
198 $(patsubst $(archpfx)%,%,$(objs)))\
199 $(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
203 # Make the distribution tar files.
206 # Figure out the version number from the source of `version.c'.
208 $(strip $(shell sed
-e
'/=/!d' -e
's/^.*"\(.*\)";$$/\1/' < version.c
))
209 tarfiles
:= make
# make-doc
210 tarfiles
:= $(addsuffix -$(version
).
tar,$(tarfiles
))
211 tarfiles
:= $(tarfiles
:%=%.gz
) # no more compress $(tarfiles:%=%.Z)
212 # Depend on default and doc so we don't ship anything that won't compile.
213 dist: default
info dvi tests tarfiles
215 tarfiles
: $(tarfiles
)
217 .PHONY
: rcs-mark-alpha
220 rcs
-sAlpha
-Nmake-
$(version
) RCS
/[!=]*,v
225 install -c
-g kmem
-o
$(USER
) -m
2755 $< /usr
/local
/gnubin
/make
227 # Put the alpha distribution files in the anonymous FTP directory.
228 alpha-files
= $(tarfiles
) GNUmakefile compatMakefile
$(testdir
).
tar.Z
231 alpha-dir
:= ~ftp
/gnu
232 alpha-files
:= $(addprefix $(alpha-dir
)/,$(alpha-files
))
233 alpha
: $(alpha-dir
) $(alpha-files
)
238 # Implicit rule to make README and README-doc.
239 %: %.template version.c
241 sed
's/VERSION/$(version)/' < $< > $@
242 # Make sure I don't edit it by accident.
246 @
rm -fr make-
$(version
)
247 ln
-s . make-
$(version
)
248 tar cvhof
$@
$(addprefix make-
$(version
)/,$^
)
249 rm -f make-
$(version
)
252 %.Z
: %; compress
-c
$< > $@
253 %.gz
: %; gzip
-9 -c
-v
$< > $@
255 make-doc-
$(version
).
tar: README-doc COPYING make.
dvi make.
info make.
info*
257 make-
$(version
).
tar: README INSTALL COPYING ChangeLog NEWS \
258 configure Makefile.in configure.in build.sh.in mkinstalldirs \
259 acconfig.h
$(srcs
) remote-
*.c
$(globfiles
) \
260 make.texinfo make-stds.texi \
261 make.?? make.??s make.toc make.aux make.man texinfo.
tex TAGS
tags \
267 tests
:= $(filter-out %~
,$(wildcard tests
/*))
268 make-tests-
$(version
).
tar.Z
: $(tests
)
269 @
rm -fr make-tests-
$(version
)
270 ln
-s tests make-tests-
$(version
)
271 tar cvhf
$(@
:.Z
=) $(patsubst tests
/%,make-tests-
$(version
)/%,$^
)
272 rm -f make-tests-
$(version
)
276 $(archpfx
)loadtest
: $(archpfx
)load.o