make-dfsg/GNUmakefile

297 lines
8.3 KiB
Text
Raw Normal View History

1992-01-11 11:09:59 +00:00
# GNU Make-specific makefile for GNU Make.
# Copyright (C) 1990, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
1992-01-11 11:09:59 +00:00
# This file is part of GNU Make.
1995-12-12 05:47:27 +00:00
#
1992-01-11 11:09:59 +00:00
# GNU Make is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# GNU Make is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
1995-12-12 05:47:27 +00:00
#
1992-01-11 11:09:59 +00:00
# You should have received a copy of the GNU General Public License
# along with GNU Make; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
.PHONY: default
default:
1993-03-28 22:36:05 +00:00
# Set `ARCH' to a string for the type of machine.
ifndef ARCH
ifdef machine
ARCH = $(machine)
endif # machine
endif # not ARCH
1992-06-22 20:34:05 +00:00
override srcdir := .
1993-01-05 19:53:58 +00:00
override CC := $(CC)
1992-06-22 20:34:05 +00:00
1993-03-28 22:36:05 +00:00
ifeq ($(ARCH),hp300)
1994-04-25 23:37:12 +00:00
#customs=yes
1993-03-28 22:36:05 +00:00
endif
ifdef customs
override REMOTE := cstms
else
override REMOTE := stub
endif
1992-01-11 11:09:59 +00:00
# Get most of the information from the Unix-compatible makefile.
include compatMakefile
1994-02-16 23:58:49 +00:00
MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES)
1993-03-29 19:30:33 +00:00
# Remove autoconf magic.
prefix = /usr/local
exec_prefix = $(prefix)
1993-03-29 19:30:33 +00:00
extras := $(filter-out getloadavg.o @%@,$(extras)) getloadavg.o
LOADLIBES := $(filter-out @%@,$(LOADLIBES))
ALLOCA := $(filter-out @%@,$(ALLOCA))
1995-04-05 04:53:56 +00:00
CPPFLAGS := $(filter-out @%@,$(defines) $(CPPFLAGS)) -DHAVE_CONFIG_H
1993-03-29 19:30:33 +00:00
ifdef AC_MACRODIR
configure config.h.in: $(patsubst %,$(AC_MACRODIR)/%.m4,acspecific acgeneral)
config.h.in: $(AC_MACRODIR)/acconfig.h
endif
configure: configure.in aclocal.m4
autoconf $(ACFLAGS)
test -d CVS && cvs commit -m'autoconf $(ACFLAGS)' $@
config.h.in: configure.in aclocal.m4
autoheader $(ACFLAGS)
test -d CVS && cvs commit -m'autoheader $(ACFLAGS)' $@
1993-03-28 22:36:05 +00:00
ifdef customs
1993-03-29 19:30:33 +00:00
defines := $(defines) -Ipmake/customs -Ipmake/lib/include
LOADLIBES := $(addprefix pmake/customs/,customslib.o rpc.o xlog.o) \
pmake/lib/sprite/libsprite.a
1993-03-18 01:34:17 +00:00
endif
1992-01-11 11:09:59 +00:00
ifdef ARCH
ifndef no_libc
libc_dir = /home/gd2/gnu/libc/$(ARCH)
ifneq ($(wildcard $(libc_dir)),)
ifneq ($(wildcard $(libc_dir)/works-for-make),)
1992-05-28 05:03:09 +00:00
#CPPFLAGS := -I$(libc_dir)/include
#LDFLAGS := -nostdlib $(libc_dir)/lib/start.o
#LOADLIBES := $(LOADLIBES) \
# $(libc_dir)/lib/mcheck-init.o \
# $(libc_dir)/lib/libc.a \
# -lgcc \
# $(libc_dir)/lib/libc.a
1992-06-03 03:24:11 +00:00
CC := $(CC) -b glibc
1992-01-11 11:09:59 +00:00
1992-06-11 05:33:52 +00:00
# getopt is in libc.
1992-05-09 04:06:58 +00:00
GETOPT =
1992-08-27 23:25:59 +00:00
#GETOPT_SRC = Don't clear this or dist will break.
1992-05-09 04:06:58 +00:00
1992-10-12 18:16:07 +00:00
# glob is in libc too.
1995-12-12 05:47:27 +00:00
GLOB =
1992-10-12 18:16:07 +00:00
1992-01-11 11:09:59 +00:00
else
1992-10-12 18:16:07 +00:00
endif # works-for-make
endif # $(libc_dir)
endif # !no_libc
# We know the type of machine, so put the binaries in subdirectories.
$(ARCH)/%.o: %.c
1993-01-06 00:30:46 +00:00
$(COMPILE.c) -Iglob $< $(OUTPUT_OPTION)
1993-01-21 23:24:19 +00:00
$(ARCH)/glob/libglob.a: FORCE
$(MAKE) -C $(@D) $(@F)
1993-01-21 23:24:19 +00:00
FORCE:
1992-10-12 18:16:07 +00:00
objs := $(addprefix $(ARCH)/,$(objs))
prog := $(ARCH)/make
archpfx = $(ARCH)/
$(archpfx)load.o: load.c
$(COMPILE.c) $(LOAD_AVG) $< -o $@
$(archpfx)load.dep: load.c
$(mkdep) $(LOAD_AVG) $< | sed 's,$*\.o,& $@,' > $@
1995-12-12 05:47:27 +00:00
CPPFLAGS := -I$(ARCH) -Iglob -DHAVE_CONFIG_H $(filter-out @%@,$(CPPFLAGS))
1992-10-12 18:16:07 +00:00
ifneq "$(wildcard $(ARCH)/makefile)" ""
include $(ARCH)/makefile
1992-01-11 11:09:59 +00:00
endif
1992-12-29 02:36:27 +00:00
objs := $(objs) $(addprefix $(ARCH)/,$(ALLOCA) $(extras))
1992-01-11 11:09:59 +00:00
else # Not ARCH
prog := make
endif
ifneq "$(findstring gcc,$(CC))" ""
1995-08-01 18:48:58 +00:00
CFLAGS = -g -Wall -Wtraditional -Wid-clash-31 -Wpointer-arith \
1995-12-12 05:47:27 +00:00
-Wbad-function-cast -Wconversion
1992-05-14 20:05:17 +00:00
else
CFLAGS = -g
1992-01-11 11:09:59 +00:00
endif
1993-01-23 00:35:32 +00:00
LDFLAGS = -g
1992-01-11 11:09:59 +00:00
# Define the command to make dependencies.
mkdep-nolib = $(CC) -MM $(CPPFLAGS)
mkdep = $(CC) -M $(CPPFLAGS)
1992-12-29 02:36:27 +00:00
depfiles = $(patsubst %.o,%.dep,$(filter %.o,$(objs)))
1992-01-11 11:09:59 +00:00
.PHONY: default
default: $(prog)
1993-11-11 16:51:19 +00:00
$(prog): $(objs) $(globdep) #$(addprefix $(ARCH)/,gmalloc.o mcheck.o)
1992-01-11 11:09:59 +00:00
$(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new
mv -f $@.new $@
1996-05-09 18:10:49 +00:00
libc-srcdir = ../libc
globfiles = $(addprefix glob/,COPYING.LIB configure.in configure Makefile.in \
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * GNUmakefile (globfiles): Add AmigaDOS support files. (distfiles): Add $(amigafiles). (amigafiles): New variable. Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de> * Added Amiga support in commands.c, dir.c, function.c, job.c, main.c, make.h, read.c, remake.c * commands.c: Amiga has neither SIGHUP nor SIGQUIT * dir.c: Amiga has filenames with Upper- and Lowercase, but "FileName" is the same as "filename". Added strieq() which is use to compare filenames. This is like streq() on all other systems. Also there is no such thing as "." under AmigaDOS. * function.c: On Amiga, the environment is not passed as envp, there are no pipes and Amiga can't fork. Use my own function to create a new child. * job.c: default_shell is "" (The system automatically chooses a shell for me). Have to use the same workaround as MSDOS for running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't known on Amiga. Cloned code to run children from MSDOS. Own version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga. * main.c: Force stack to 20000 bytes. Read environment from ENV: device. On Amiga, exec_command() does return, so I exit() afterwards. * make.h: Added strieq() to compare filenames. * read.c: Amiga needs special extension to have passwd. Only one include-dir. "Makefile" and "makefile" are the same. Added "SMakefile". Added special code to handle device names (xxx:) and "./" in rules. * remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib" instead of "lib%s.a". * main.c, rule.c, variable.c: Avoid floats at all costs. * vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
Makefile.ami SCOPTIONS SMakefile \
configure.bat glob.c fnmatch.c glob.h fnmatch.h)
1993-06-09 22:06:20 +00:00
$(globfiles): stamp-glob ;
stamp-glob: $(libc-srcdir)/posix/glob.tar
1995-10-10 20:22:47 +00:00
-rm -f stamp-glob glob/*
1993-06-09 22:06:20 +00:00
tar xvf $< glob
1995-03-08 00:10:10 +00:00
cvs commit -m'Updated from libc' glob
1993-06-09 22:06:20 +00:00
touch $@
$(libc-srcdir)/posix/glob.tar: force
1992-01-11 11:09:59 +00:00
$(MAKE) -C $(@D) $(@F) no_deps=t
.PHONY: force
force:
# Make the Unix-compatible Makefile to be distributed by appending
# the automatically-generated dependencies to compatMakefile.
ifeq ($(mkdep),$(mkdep-nolib))
nolib-deps = $(depfiles)
else
%.dep: %.c
1993-12-22 22:18:14 +00:00
$(mkdep-nolib) $< | sed -e 's,$*\.o,$(@:.dep=.o) $@,' > $(@:.dep=.dtm)
mv -f $(@:.dep=.dtm) $@
1992-02-16 07:20:51 +00:00
nolib-deps = $(patsubst $(archpfx)%,%,$(depfiles))
1992-01-11 11:09:59 +00:00
endif
1993-04-22 22:42:00 +00:00
# The distributed Makefile.in should contain deps for remote-stub only.
Makefile.in: compatMakefile $(nolib-deps:remote-%.dep=remote-stub.dep)
(sed 's/^MAKE[ ]*=.*$$/@SET_MAKE@/' $<; \
1992-01-11 11:09:59 +00:00
echo '# Automatically generated dependencies.'; \
sed -e 's/ [^ ]*\.dep//' -e 's=$(archpfx)==' $(filter-out $<,$^) \
) > $@
1995-03-08 00:10:10 +00:00
cvs commit -mRegenerated $@
1992-01-11 11:09:59 +00:00
.SUFFIXES: .dep
# Maintain the automatically-generated dependencies.
ifndef no_deps
-include $(depfiles)
1992-10-25 02:43:22 +00:00
endif
1992-01-11 11:09:59 +00:00
$(archpfx)%.dep: %.c
$(mkdep) $< | sed 's,$*\.o,$(@:.dep=.o) $@,' > $@
1992-05-11 19:21:28 +00:00
ETAGS = etags -T # for v19 etags
1992-01-11 11:09:59 +00:00
# Run the tests.
.PHONY: tests
1992-05-04 22:54:21 +00:00
testdir := $(shell ls -d1 make-test-?.? | sort -n +0.10 -0.11 +0.12 | tail -1l)
1992-06-16 01:25:32 +00:00
tests:# $(testdir)/run_make_tests.pl $(prog)
1993-01-12 22:51:00 +00:00
# cd $(<D); MAKELEVEL=0 perl $(<F)
1993-08-16 21:40:16 +00:00
build.sh.in: build.template compatMakefile
1993-03-11 19:25:25 +00:00
sed -e 's@%objs%@$(filter-out remote-% $(GLOB) $(ALLOCA) $(extras),\
1993-01-13 21:05:06 +00:00
$(patsubst $(archpfx)%,%,$(objs)))\
$(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
1993-01-12 22:51:00 +00:00
$< > $@.new
1994-11-28 23:02:42 +00:00
chmod a+x $@.new
1993-01-12 22:51:00 +00:00
mv -f $@.new $@
1995-03-08 00:10:10 +00:00
cvs commit -mRegenerated $@
1993-01-12 22:51:00 +00:00
1992-01-11 11:09:59 +00:00
# Make the distribution tar files.
.PHONY: dist
# Figure out the version number from the source of `version.c'.
version := \
$(strip $(shell sed -e '/=/!d' -e 's/^.*"\(.*\)";$$/\1/' < version.c))
1994-01-12 00:30:18 +00:00
tarfiles := make # make-doc
1993-01-23 00:35:32 +00:00
tarfiles := $(addsuffix -$(version).tar,$(tarfiles))
1993-06-02 21:09:00 +00:00
tarfiles := $(tarfiles:%=%.gz) # no more compress $(tarfiles:%=%.Z)
1992-01-11 11:09:59 +00:00
# Depend on default and doc so we don't ship anything that won't compile.
1995-03-08 00:10:10 +00:00
dist: cvs-mark default info dvi tests tarfiles
1993-01-23 00:35:32 +00:00
.PHONY: tarfiles
tarfiles: $(tarfiles)
1992-01-11 11:09:59 +00:00
vmsfiles = config.h-vms makefile.com makefile.vms readme.vms \
vmsdir.h vmsfunctions.c vmsify.c
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * GNUmakefile (globfiles): Add AmigaDOS support files. (distfiles): Add $(amigafiles). (amigafiles): New variable. Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de> * Added Amiga support in commands.c, dir.c, function.c, job.c, main.c, make.h, read.c, remake.c * commands.c: Amiga has neither SIGHUP nor SIGQUIT * dir.c: Amiga has filenames with Upper- and Lowercase, but "FileName" is the same as "filename". Added strieq() which is use to compare filenames. This is like streq() on all other systems. Also there is no such thing as "." under AmigaDOS. * function.c: On Amiga, the environment is not passed as envp, there are no pipes and Amiga can't fork. Use my own function to create a new child. * job.c: default_shell is "" (The system automatically chooses a shell for me). Have to use the same workaround as MSDOS for running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't known on Amiga. Cloned code to run children from MSDOS. Own version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga. * main.c: Force stack to 20000 bytes. Read environment from ENV: device. On Amiga, exec_command() does return, so I exit() afterwards. * make.h: Added strieq() to compare filenames. * read.c: Amiga needs special extension to have passwd. Only one include-dir. "Makefile" and "makefile" are the same. Added "SMakefile". Added special code to handle device names (xxx:) and "./" in rules. * remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib" instead of "lib%s.a". * main.c, rule.c, variable.c: Avoid floats at all costs. * vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
amigafiles = README.Amiga config.ami Makefile.ami SCOPTIONS SMakefile \
amiga.c amiga.h make.lnk
win32files = README.WIN32 build_w32.bat config.h.WIN32 subproc.bat NMakefile \
$(addprefix w32/,pathstuff.c compat/dirent.c include/dirent.h \
include/pathstuff.h include/sub_proc.h \
include/w32err.h subproc/NMakefile \
subproc/build.bat subproc/misc.c \
subproc/proc.h subproc/sub_proc.c \
subproc/w32err.c)
1995-03-08 18:21:45 +00:00
distfiles=README INSTALL COPYING ChangeLog NEWS \
configure Makefile.in configure.in build.sh.in mkinstalldirs \
configh.dos configure.bat \
$(amigafiles) $(vmsfiles) $(win32files) \
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * GNUmakefile (globfiles): Add AmigaDOS support files. (distfiles): Add $(amigafiles). (amigafiles): New variable. Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de> * Added Amiga support in commands.c, dir.c, function.c, job.c, main.c, make.h, read.c, remake.c * commands.c: Amiga has neither SIGHUP nor SIGQUIT * dir.c: Amiga has filenames with Upper- and Lowercase, but "FileName" is the same as "filename". Added strieq() which is use to compare filenames. This is like streq() on all other systems. Also there is no such thing as "." under AmigaDOS. * function.c: On Amiga, the environment is not passed as envp, there are no pipes and Amiga can't fork. Use my own function to create a new child. * job.c: default_shell is "" (The system automatically chooses a shell for me). Have to use the same workaround as MSDOS for running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't known on Amiga. Cloned code to run children from MSDOS. Own version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga. * main.c: Force stack to 20000 bytes. Read environment from ENV: device. On Amiga, exec_command() does return, so I exit() afterwards. * make.h: Added strieq() to compare filenames. * read.c: Amiga needs special extension to have passwd. Only one include-dir. "Makefile" and "makefile" are the same. Added "SMakefile". Added special code to handle device names (xxx:) and "./" in rules. * remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib" instead of "lib%s.a". * main.c, rule.c, variable.c: Avoid floats at all costs. * vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
aclocal.m4 acconfig.h $(srcs) remote-*.c $(globfiles) \
1995-03-08 18:21:45 +00:00
make.texinfo make-stds.texi \
make.?? make.??s make.toc make.aux make.man texinfo.tex TAGS tags \
install-sh \
make.info make.info*
ifndef dist-flavor
dist-flavor = alpha
endif
1995-03-08 00:10:10 +00:00
.PHONY: cvs-mark
1995-03-08 18:21:45 +00:00
cvs-mark: $(distfiles)
1995-03-08 00:10:10 +00:00
cvs tag -F make-$(subst .,-,$(version))
1992-01-11 11:09:59 +00:00
dist: local-inst
.PHONY: local-inst
local-inst: $(prog)
install -c -g kmem -o $(USER) -m 2755 $< /usr/local/gnubin/make
# Put the alpha distribution files in the anonymous FTP directory.
1992-04-14 02:30:18 +00:00
alpha-files = $(tarfiles) GNUmakefile compatMakefile $(testdir).tar.Z
1992-01-11 11:09:59 +00:00
dist: alpha
.PHONY: alpha
alpha-dir := ~ftp/gnu
alpha-files := $(addprefix $(alpha-dir)/,$(alpha-files))
alpha: $(alpha-dir) $(alpha-files)
$(alpha-dir)/%: %
@rm -f $@
cp $< $@
# Implicit rule to make README and README-doc.
%: %.template version.c
1992-08-13 22:09:36 +00:00
rm -f $@
1992-01-11 11:09:59 +00:00
sed 's/VERSION/$(version)/' < $< > $@
1992-07-16 18:34:43 +00:00
# Make sure I don't edit it by accident.
chmod a-w $@
1995-03-08 18:21:45 +00:00
cvs commit -m'Regenerated for $(version)' $@
1992-01-11 11:09:59 +00:00
define make-tar
@rm -fr make-$(version)
ln -s . make-$(version)
1993-04-16 18:41:16 +00:00
tar cvhof $@ $(addprefix make-$(version)/,$^)
1992-01-11 11:09:59 +00:00
rm -f make-$(version)
endef
1993-01-23 00:35:32 +00:00
%.Z: %; compress -c $< > $@
1993-06-02 21:09:00 +00:00
%.gz: %; gzip -9 -c -v $< > $@
1993-01-23 00:35:32 +00:00
1995-03-08 18:21:45 +00:00
make-$(version).tar: $(distfiles)
1992-01-11 11:09:59 +00:00
$(make-tar)
1992-04-14 02:30:18 +00:00
ifneq (,)
1992-01-11 11:09:59 +00:00
tests := $(filter-out %~,$(wildcard tests/*))
make-tests-$(version).tar.Z: $(tests)
@rm -fr make-tests-$(version)
ln -s tests make-tests-$(version)
tar cvhf $(@:.Z=) $(patsubst tests/%,make-tests-$(version)/%,$^)
rm -f make-tests-$(version)
compress -f $(@:.Z=)
1992-04-14 02:30:18 +00:00
endif
1992-01-11 11:09:59 +00:00
$(archpfx)loadtest: $(archpfx)load.o