summaryrefslogtreecommitdiff
path: root/maintMakefile
blob: a2c9cc79099696514d18ff128d202924fd229c89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Maintainer-only makefile segment.  This contains things that are relevant
# only if you have the full copy of the GNU make sources from the CVS
# tree, not a dist copy.
#

# Find the glob source files... this might be dangerous, but we're maintainers!
#
globsrc := $(wildcard glob/*.c)
globhdr := $(wildcard glob/*.h)

TEMPLATES = README README.DOS README.W32 \
	    config.ami configh.dos config.h.W32 config.h-vms
MTEMPLATES = Makefile.DOS SMakefile

# We need this to ensure that README and build.sh.in are created on time to
# avoid errors by automake.
#
#Makefile.in: README build.sh.in

# General rule for turning a .template into a regular file.
#
$(TEMPLATES) : % : %.template Makefile
	rm -f $@
	sed -e 's@%VERSION%@$(VERSION)@g' \
	    -e 's@%PACKAGE%@$(PACKAGE)@g' \
	  $< > $@
	chmod a-w $@

# Construct Makefiles by adding on dependencies, etc.
#
$(MTEMPLATES) : % : %.template .dep_segment Makefile
	rm -f $@
	sed -e 's@%VERSION%@$(VERSION)@g' \
	    -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
	    -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
	    -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
	    -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
	    -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
	  $< > $@
	echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
	  cat $(word 2,$^) >>$@
	chmod a-w $@

NMakefile: NMakefile.template .dep_segment Makefile
	rm -f $@
	cp $< $@
	echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
	  sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
	chmod a-w $@

# Construct build.sh.in
#
build.sh.in: build.template Makefile
	rm -f $@
	sed -e 's@%objs%@$(filter-out remote-%,$(make_OBJECTS)@g' \
	    -e 's@%globobjs%@$(patsubst %.c,%.o,$(globsrc)))@g' \
	  $< > $@
	chmod a-w+x $@


# Use automake to build a dependency list file, for "foreign" makefiles like
# Makefile.DOS.
#
# Automake used to have a --generate-deps flag, but it's gone now, so we have
# to do it ourselves.
#
.dep_segment: Makefile.am maintMakefile $(DEP_FILES)
	cat $(DEP_FILES) \
	  | sed -e '/^[^:]*\.[ch] *:/d' \
		-e 's, /usr/[^ ]*,,g' \
		-e 's, $(srcdir)/, ,g' \
		-e '/^ \\$$/d' \
	  > $@

# Get rid of everything "else".
#
maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in

MAINTAINERCLEANFILES +=	$(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
			missing build.sh.in .dep_segment

# Put the alpha distribution files up for anonymous FTP.
#
ALPHA	:= ~ftp/gnu
TARFILE	:= $(distdir).tar.gz

.PHONY: alpha
alpha: $(ALPHA) $(TARFILE)
	@rm -f $(ALPHA)/$(TARFILE)
	cp -p $(TARFILE) $(ALPHA)