1 # Maintainer-only makefile segment. This contains things that are relevant
2 # only if you have the full copy of the GNU make sources from the CVS
3 # tree, not a dist copy.
6 # Find the glob source files... this might be dangerous, but we're maintainers!
8 globsrc := $(wildcard glob/*.c)
9 globhdr := $(wildcard glob/*.h)
11 TEMPLATES = README README.DOS README.W32 \
12 config.ami configh.dos config.h.W32 config.h-vms
13 MTEMPLATES = Makefile.DOS SMakefile
15 all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
17 # We need this to ensure that README and build.sh.in are created on time to
18 # avoid errors by automake.
20 #Makefile.in: README build.sh.in
22 # General rule for turning a .template into a regular file.
24 $(TEMPLATES) : % : %.template Makefile
26 sed -e 's@%VERSION%@$(VERSION)@g' \
27 -e 's@%PACKAGE%@$(PACKAGE)@g' \
31 # Construct Makefiles by adding on dependencies, etc.
33 $(MTEMPLATES) : % : %.template .dep_segment Makefile
35 sed -e 's@%VERSION%@$(VERSION)@g' \
36 -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
37 -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
38 -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
39 -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
40 -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
42 echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
46 NMakefile: NMakefile.template .dep_segment Makefile
49 echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
50 sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
53 # Construct build.sh.in
55 build.sh.in: build.template Makefile
57 sed -e 's@%objs%@$(filter-out remote-%,$(make_OBJECTS)@g' \
58 -e 's@%globobjs%@$(patsubst %.c,%.o,$(globsrc)))@g' \
63 # Use automake to build a dependency list file, for "foreign" makefiles like
66 # Automake used to have a --generate-deps flag, but it's gone now, so we have
69 .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
71 | sed -e '/^[^:]*\.[ch] *:/d' \
72 -e 's, /usr/[^ ]*,,g' \
73 -e 's, $(srcdir)/, ,g' \
77 # Get rid of everything "else".
79 maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in
81 CVS-CLEAN-FILES += $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
82 missing build.sh.in .dep_segment
84 # This rule tries to clean the tree right down to how it looks when you do a
85 # virgin CVS checkout.
88 cvs-clean: maintainer-clean
90 -rm -f config/*~ config/Makefile.in config/[a-z]*
91 -rm -f po/*~ po/Makefile.in.in po/Rules-quot po/[a-z]*
92 -rm -f doc/*~ doc/Makefile.in doc/fdl.texi doc/make-stds.texi \
94 -rm -f glob/*~ glob/Makefile.in
95 -rm -f ABOUT-NLS $(CVS-CLEAN-FILES)
98 # ----------------------------------------------------------------------
100 # The sections below were stolen from the Makefile.maint used by fileutils,
101 # sh-utils, textutils, CPPI, Bison, and Autoconf.
104 ## ---------------- ##
105 ## Updating files. ##
106 ## ---------------- ##
108 WGET = wget --passive-ftp --non-verbose
109 ftp-gnu = ftp://ftp.gnu.org/gnu
111 move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
112 echo $(target) is unchanged; rm -f $(target).t; \
114 mv $(target).t $(target); \
117 # ------------------- #
118 # Updating PO files. #
119 # ------------------- #
121 po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
122 .PHONY: do-po-update po-update
124 tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
127 (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
129 cd po && $(MAKE) update-po
133 if test -d "po"; then \
134 $(MAKE) do-po-update; \
137 # -------------------------- #
138 # Updating GNU build tools. #
139 # -------------------------- #
141 # The following pseudo table associates a local directory and a URL
142 # with each of the files that belongs to some other package and is
143 # regularly updated from the specified URL.
144 # $(srcdir)/src/ansi2knr.c
147 wget_files ?= $(srcdir)/config/config.guess $(srcdir)/config/config.sub \
148 $(srcdir)/doc/texinfo.tex $(srcdir)/doc/make-stds.texi \
149 $(srcdir)/doc/fdl.texi
151 wget-targets = $(patsubst %, get-%, $(wget_files))
153 config.guess-url_prefix = $(ftp-gnu)/config/
154 config.sub-url_prefix = $(ftp-gnu)/config/
156 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
158 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
160 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
161 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
162 fdl.texi-url_prefix = $(ftp-gnu)/GNUinfo/
164 target = $(patsubst get-%,%,$@)
165 url = $($(notdir $(target))-url_prefix)$(notdir $(target))
167 .PHONY: $(wget-targets)
169 @echo $(WGET) $(url) -O $(target) \
170 && $(WGET) $(url) -O $(target).t \
174 wget-update: $(wget-targets)
177 # Updating tools via CVS.
178 cvs_files ?= depcomp missing
179 cvs-targets = $(patsubst %, get-%, $(cvs_files))
181 automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
182 .PHONY: $(cvs-targets)
184 $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
189 cvs-update: $(cvs-targets)
192 # --------------------- #
193 # Updating everything. #
194 # --------------------- #
197 update: wget-update po-update
202 ## --------------- ##
204 ## --------------- ##
206 # Checks that don't require cvs. Run `changelog-check' last as
207 # previous test may reveal problems requiring new ChangeLog entries.
208 local-check: po-check changelog-check
210 # copyright-check writable-files
213 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
216 echo "$(VERSION) not in ChangeLog" 1>&2; \
220 # Verify that all source files using _() are listed in po/POTFILES.in.
222 if test -f po/POTFILES.in; then \
223 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
224 grep -E -l '\b_\(' *.c | sort > $@-2; \
225 diff -u $@-1 $@-2 || exit 1; \