Add VMS updates from Martin Zinser.
[make.git] / maintMakefile
blob2bc19497502a7b6d4e93e05a4a3ef2378d46be23
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
25         rm -f $@
26         sed -e 's@%VERSION%@$(VERSION)@g' \
27             -e 's@%PACKAGE%@$(PACKAGE)@g' \
28           $< > $@
29         chmod a-w $@
31 # Construct Makefiles by adding on dependencies, etc.
33 $(MTEMPLATES) : % : %.template .dep_segment Makefile
34         rm -f $@
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' \
41           $< > $@
42         echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
43           cat $(word 2,$^) >>$@
44         chmod a-w $@
46 NMakefile: NMakefile.template .dep_segment Makefile
47         rm -f $@
48         cp $< $@
49         echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
50           sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
51         chmod a-w $@
53 # Construct build.sh.in
55 build.sh.in: build.template Makefile
56         rm -f $@
57         sed -e 's@%objs%@$(filter-out remote-%,$(make_OBJECTS)@g' \
58             -e 's@%globobjs%@$(patsubst %.c,%.o,$(globsrc)))@g' \
59           $< > $@
60         chmod a-w+x $@
63 # Use automake to build a dependency list file, for "foreign" makefiles like
64 # Makefile.DOS.
66 # Automake used to have a --generate-deps flag, but it's gone now, so we have
67 # to do it ourselves.
69 .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
70         cat $(DEP_FILES) \
71           | sed -e '/^[^:]*\.[ch] *:/d' \
72                 -e 's, /usr/[^ ]*,,g' \
73                 -e 's, $(srcdir)/, ,g' \
74                 -e '/^ \\$$/d' \
75           > $@
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.
87 .PHONY: cvs-clean
88 cvs-clean: maintainer-clean
89         -rm -f *~
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 \
93                 doc/texinfo.tex
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; \
113                   else \
114                     mv $(target).t $(target); \
115                   fi
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
123 do-po-update:
124         tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
125         rm -rf $$tmppo && \
126         mkdir $$tmppo && \
127         (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
128         cp $$tmppo/*.po po
129         cd po && $(MAKE) update-po
130         $(MAKE) po-check
132 po-update:
133         if test -d "po"; then \
134           $(MAKE) do-po-update; \
135         fi
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)
168 $(wget-targets):
169         @echo $(WGET) $(url) -O $(target) \
170           && $(WGET) $(url) -O $(target).t \
171           && $(move_if_change)
173 .PHONY: wget-update
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)
183 $(cvs-targets):
184         $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
185           >$(target).t \
186             && $(move_if_change)
188 .PHONY: cvs-update
189 cvs-update: $(cvs-targets)
192 # --------------------- #
193 # Updating everything.  #
194 # --------------------- #
196 .PHONY: update
197 update: wget-update po-update
199 # cvs-update
202 ## --------------- ##
203 ## Sanity checks.  ##
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
212 changelog-check:
213         if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
214           :; \
215         else \
216           echo "$(VERSION) not in ChangeLog" 1>&2; \
217           exit 1; \
218         fi
220 # Verify that all source files using _() are listed in po/POTFILES.in.
221 po-check:
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; \
226           rm -f $@-1 $@-2; \
227         fi