make-dfsg/GNUmakefile

248 lines
6.5 KiB
Makefile
Raw Normal View History

1992-01-11 11:09:59 +00:00
# GNU Make-specific makefile for GNU Make.
# Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# 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.
#
# 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:
1992-06-22 20:34:05 +00:00
override srcdir := .
1992-01-11 11:09:59 +00:00
# Get most of the information from the Unix-compatible makefile.
include compatMakefile
1992-07-13 22:17:50 +00:00
extras := $(sort $(filter-out @%@,$(extras)) getloadavg.o)
1992-07-01 22:37:12 +00:00
LOADLIBES := $(filter-out @%@,$(LOADLIBES))
1992-06-16 01:25:32 +00:00
1992-01-11 11:09:59 +00:00
# Set `ARCH' to a string for the type of machine.
ifndef ARCH
ifdef machine
ARCH = $(machine)
endif # machine
endif # not ARCH
ifdef ARCH
# We know the type of machine, so put the binaries in subdirectories.
$(ARCH)/%.o: %.c
$(COMPILE.c) $< $(OUTPUT_OPTION)
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,& $@,' > $@
$(archpfx)remote.o: remote.c
$(COMPILE.c) $(REMOTE) $< -o $@
$(archpfx)remote.dep: remote.c
$(mkdep) $(REMOTE) $< | sed 's,$*\.o,& $@,' > $@
1992-06-11 05:33:52 +00:00
ifneq "$(defines)" "@DEFS@"
1992-01-11 11:09:59 +00:00
CPPFLAGS = $(defines)
1992-06-11 05:33:52 +00:00
endif
1992-01-11 11:09:59 +00:00
ifneq "$(wildcard $(ARCH)/makefile)" ""
include $(ARCH)/makefile
1992-02-06 22:12:06 +00:00
objs := $(sort $(objs) $(addprefix $(ARCH)/,$(ALLOCA) $(extras)))
1992-01-11 11:09:59 +00:00
endif
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-07-05 01:55:13 +00:00
CPPFLAGS := -DSTDC_HEADERS -DHAVE_UNISTD_H -DHAVE_GLOB_H \
-DHAVE_GETDTABLESIZE -DHAVE_SYS_SIGLIST -DHAVE_DUP2 \
-DHAVE_GETCWD -DHAVE_SIGSETMASK -DHAVE_GETGROUPS -DHAVE_SETLINEBUF
1992-06-11 05:33:52 +00:00
1992-01-11 11:09:59 +00:00
else
1992-05-09 04:06:58 +00:00
globdep = glob/libglob.a
globlib = $(globdep)
1992-01-11 11:09:59 +00:00
CPPFLAGS := $(CPPFLAGS) -Iglob
endif
endif
endif
else # Not ARCH
prog := make
endif
ifneq "$(findstring gcc,$(CC))" ""
1992-05-14 20:05:17 +00:00
CFLAGS = -g -W -Wunused -Wpointer-arith -Wreturn-type -Wswitch
else
CFLAGS = -g
1992-01-11 11:09:59 +00:00
endif
ifdef yescustoms
REMOTE := -DCUSTOMS
LOADLIBES := libcustoms.a
endif
# Define the command to make dependencies.
ifneq "$(findstring gcc,$(CC))" ""
# Don't include system directories.
mkdep-nolib = $(CC) -MM $(CPPFLAGS)
else
mkdep-nolib = $(mkdep)
endif
mkdep = $(CC) -M $(CPPFLAGS)
depfiles = $(objs:.o=.dep)
ifdef yescustoms
prog := $(prog)-customs
endif
.PHONY: default
default: $(prog)
$(prog): $(objs) $(globdep)
$(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new
mv -f $@.new $@
1992-06-22 20:34:05 +00:00
globfiles = $(addprefix glob/,COPYING.LIB Makefile.in \
1992-01-11 11:09:59 +00:00
glob.c fnmatch.c glob.h fnmatch.h)
$(globfiles): /home/gd/gnu/libc/posix/glob.tar
tar xvfm $< $@
/home/gd/gnu/libc/posix/glob.tar: force
$(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
$(mkdep-nolib) $< | sed 's,$*\.o,$(@:.dep=.o) $@,' > $@
ifdef archpfx
load.dep: load.c
$(mkdep-nolib) $(LOAD_AVG) $< | sed 's,$*\.o,& $@,' > $@
remote.dep: remote.c
$(mkdep-nolib) $(REMOTE) $< | sed 's,$*\.o,& $@,' > $@
endif
1992-02-16 07:20:51 +00:00
nolib-deps = $(patsubst $(archpfx)%,%,$(depfiles))
1992-01-11 11:09:59 +00:00
endif
1992-06-11 05:33:52 +00:00
Makefile.in: compatMakefile $(nolib-deps)
1992-01-11 11:09:59 +00:00
(cat $<; \
echo '# Automatically generated dependencies.'; \
sed -e 's/ [^ ]*\.dep//' -e 's=$(archpfx)==' $(filter-out $<,$^) \
) > $@
.SUFFIXES: .dep
# Maintain the automatically-generated dependencies.
ifndef no_deps
include $(archpfx)depend
$(archpfx)depend: GNUmakefile compatMakefile
(for file in $(depfiles); \
do echo include $$file; done) > $@
$(archpfx)%.dep: %.c
$(mkdep) $< | sed 's,$*\.o,$(@:.dep=.o) $@,' > $@
endif
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)
# cd $(<D); perl $(<F)
1992-01-11 11:09:59 +00:00
1992-06-11 05:33:52 +00:00
configure: /home/gd/gnu/autoconf/make.conf
1992-07-05 01:55:13 +00:00
-cp $< $@
1992-06-11 05:33:52 +00:00
/home/gd/gnu/autoconf/%: force;$(MAKE) -C $(@D) $(@F)
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))
1992-04-14 02:30:18 +00:00
tarfiles := make make-doc
1992-01-11 11:09:59 +00:00
tarfiles := $(addsuffix -$(version).tar.Z,$(tarfiles))
# Depend on default and doc so we don't ship anything that won't compile.
dist: default doc tests $(tarfiles)
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
sed 's/VERSION/$(version)/' < $< > $@
1992-07-16 18:34:43 +00:00
# Make sure I don't edit it by accident.
chmod a-w $@
1992-01-11 11:09:59 +00:00
define make-tar
@rm -fr make-$(version)
ln -s . make-$(version)
tar cvhf $(@:.Z=) $(addprefix make-$(version)/,$^)
rm -f make-$(version)
compress -f $(@:.Z=)
endef
make-doc-$(version).tar.Z: README-doc COPYING make.dvi make.info make.info*
$(make-tar)
1992-07-16 19:17:12 +00:00
make-$(version).tar.Z: README INSTALL COPYING ChangeLog NEWS \
1992-06-26 00:54:04 +00:00
configure Makefile.in configure.in \
1992-01-11 11:09:59 +00:00
$(srcs) remote-*.c $(globfiles) make.texinfo gpl.texinfo \
make.cp* make.fn* make.ky* make.pg* make.toc make.tp* make.vr* \
1992-06-11 05:33:52 +00:00
make.aux make.man texinfo.tex TAGS tags
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