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.
|
---|
4 |
|
---|
5 | # We like mondo-warnings!
|
---|
6 | AM_CFLAGS += -Wall -W
|
---|
7 |
|
---|
8 | # Find the glob source files... this might be dangerous, but we're maintainers!
|
---|
9 | globsrc := $(wildcard glob/*.c)
|
---|
10 | globhdr := $(wildcard glob/*.h)
|
---|
11 |
|
---|
12 | TEMPLATES = README README.DOS README.W32 README.OS2 \
|
---|
13 | config.ami configh.dos config.h.W32 config.h-vms
|
---|
14 | MTEMPLATES = Makefile.DOS SMakefile
|
---|
15 |
|
---|
16 | all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
|
---|
17 |
|
---|
18 | # General rule for turning a .template into a regular file.
|
---|
19 | #
|
---|
20 | $(TEMPLATES) : % : %.template Makefile
|
---|
21 | rm -f $@
|
---|
22 | sed -e 's@%VERSION%@$(VERSION)@g' \
|
---|
23 | -e 's@%PACKAGE%@$(PACKAGE)@g' \
|
---|
24 | $< > $@
|
---|
25 | chmod a-w $@
|
---|
26 |
|
---|
27 | # Construct Makefiles by adding on dependencies, etc.
|
---|
28 | #
|
---|
29 | $(MTEMPLATES) : % : %.template .dep_segment Makefile
|
---|
30 | rm -f $@
|
---|
31 | sed -e 's@%VERSION%@$(VERSION)@g' \
|
---|
32 | -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
|
---|
33 | -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
|
---|
34 | -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
|
---|
35 | -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
|
---|
36 | -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
|
---|
37 | $< > $@
|
---|
38 | echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
|
---|
39 | cat $(word 2,$^) >>$@
|
---|
40 | chmod a-w $@
|
---|
41 |
|
---|
42 | NMakefile: NMakefile.template .dep_segment Makefile
|
---|
43 | rm -f $@
|
---|
44 | cp $< $@
|
---|
45 | echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
|
---|
46 | sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
|
---|
47 | chmod a-w $@
|
---|
48 |
|
---|
49 | # Construct build.sh.in
|
---|
50 | #
|
---|
51 | build.sh.in: build.template Makefile
|
---|
52 | rm -f $@
|
---|
53 | sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out remote-%,$(make_OBJECTS)))@g' \
|
---|
54 | -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(globsrc))@g' \
|
---|
55 | $< > $@
|
---|
56 | chmod a-w+x $@
|
---|
57 |
|
---|
58 |
|
---|
59 | # Use automake to build a dependency list file, for "foreign" makefiles like
|
---|
60 | # Makefile.DOS.
|
---|
61 | #
|
---|
62 | # Automake used to have a --generate-deps flag, but it's gone now, so we have
|
---|
63 | # to do it ourselves.
|
---|
64 | #
|
---|
65 | DEP_FILES := $(wildcard $(DEPDIR)/*.Po)
|
---|
66 | .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
|
---|
67 | (for f in $(DEPDIR)/*.Po; do \
|
---|
68 | echo ""; \
|
---|
69 | echo "# $$f"; \
|
---|
70 | cat $$f \
|
---|
71 | | sed -e '/^[^:]*\.[ch] *:/d' \
|
---|
72 | -e 's, /usr/[^ ]*,,g' \
|
---|
73 | -e 's, $(srcdir)/, ,g' \
|
---|
74 | -e '/^ *\\$$/d' \
|
---|
75 | -e '/^ *$$/d'; \
|
---|
76 | done) > $@
|
---|
77 |
|
---|
78 | # Get rid of everything "else".
|
---|
79 | #
|
---|
80 | maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in
|
---|
81 |
|
---|
82 | CVS-CLEAN-FILES += $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
|
---|
83 | build.sh.in .deps .dep_segment ABOUT-NLS \
|
---|
84 | ansi2knr.*
|
---|
85 |
|
---|
86 | # This rule tries to clean the tree right down to how it looks when you do a
|
---|
87 | # virgin CVS checkout.
|
---|
88 |
|
---|
89 | # This is potentially dangerous since it removes _ANY FILE_ that is not in
|
---|
90 | # CVS. Including files you might mean to add to CVS but haven't yet...
|
---|
91 | # I only use this in subdirectories where it's unlikely we have any new
|
---|
92 | # files. Stil...
|
---|
93 | cvsclean = perl -e '$$k{CVS} = 1; open(E,"< CVS/Entries") || die "CVS/Entries: $$!\n"; while (defined ($$_ = <E>)) { m%^/([^/]*)% or next; $$k{$$1} = 1; } close(E) || die "CVS/Entries: $$!\n"; opendir(D, ".") || die ".: $$!\n"; while (defined ($$_ = readdir(D))) { -f $$_ && ! exists $$k{$$_} && unlink($$_); } closedir(D) || die ".: $$!\n";'
|
---|
94 |
|
---|
95 | .PHONY: cvs-clean
|
---|
96 | cvs-clean: maintainer-clean
|
---|
97 | -rm -rf *~ $(CVS-CLEAN-FILES)
|
---|
98 | -cd config && $(cvsclean)
|
---|
99 | -cd po && $(cvsclean)
|
---|
100 | -cd doc && $(cvsclean)
|
---|
101 | -cd glob && $(cvsclean)
|
---|
102 |
|
---|
103 |
|
---|
104 | # ----------------------------------------------------------------------
|
---|
105 | #
|
---|
106 | # The sections below were stolen from the Makefile.maint used by fileutils,
|
---|
107 | # sh-utils, textutils, CPPI, Bison, and Autoconf.
|
---|
108 |
|
---|
109 |
|
---|
110 | ## ---------------- ##
|
---|
111 | ## Updating files. ##
|
---|
112 | ## ---------------- ##
|
---|
113 |
|
---|
114 | WGET = wget --passive-ftp --non-verbose
|
---|
115 | ftp-gnu = ftp://ftp.gnu.org/gnu
|
---|
116 |
|
---|
117 | move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
|
---|
118 | echo $(target) is unchanged; rm -f $(target).t; \
|
---|
119 | else \
|
---|
120 | mv $(target).t $(target); \
|
---|
121 | fi
|
---|
122 |
|
---|
123 | # ------------------- #
|
---|
124 | # Updating PO files. #
|
---|
125 | # ------------------- #
|
---|
126 |
|
---|
127 | po_repo = http://www.iro.umontreal.ca/translation/maint/$(PACKAGE)
|
---|
128 | .PHONY: do-po-update po-update
|
---|
129 | do-po-update:
|
---|
130 | tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
|
---|
131 | rm -rf $$tmppo && \
|
---|
132 | mkdir $$tmppo && \
|
---|
133 | (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
|
---|
134 | cp $$tmppo/*.po po
|
---|
135 | cd po && $(MAKE) update-po
|
---|
136 | $(MAKE) po-check
|
---|
137 |
|
---|
138 | po-update:
|
---|
139 | if test -d "po"; then \
|
---|
140 | $(MAKE) do-po-update; \
|
---|
141 | fi
|
---|
142 |
|
---|
143 | # -------------------------- #
|
---|
144 | # Updating GNU build files. #
|
---|
145 | # -------------------------- #
|
---|
146 |
|
---|
147 | # The following pseudo table associates a local directory and a URL
|
---|
148 | # with each of the files that belongs to some other package and is
|
---|
149 | # regularly updated from the specified URL.
|
---|
150 |
|
---|
151 | savannah-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
|
---|
152 | target = $(patsubst get-%,%,$@)
|
---|
153 |
|
---|
154 | config-url = $(savannah-url)/config/config/$(patsubst get-config/%,%,$@)
|
---|
155 | get-config/config.guess get-config/config.sub:
|
---|
156 | @echo $(WGET) $(config-url) -O $(target) \
|
---|
157 | && $(WGET) $(config-url) -O $(target).t \
|
---|
158 | && $(move_if_change)
|
---|
159 |
|
---|
160 | gnulib-url = $(savannah-url)/gnulib/gnulib/build-aux/$(patsubst get-config/%,%,$@)
|
---|
161 | get-config/texinfo.tex:
|
---|
162 | @echo $(WGET) $(gnulib-url) -O $(target) \
|
---|
163 | && $(WGET) $(gnulib-url) -O $(target).t \
|
---|
164 | && $(move_if_change)
|
---|
165 |
|
---|
166 | gnustandards-url = $(savannah-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@)
|
---|
167 | get-doc/make-stds.texi get-doc/fdl.texi:
|
---|
168 | @echo $(WGET) $(gnustandards-url) -O $(target) \
|
---|
169 | && $(WGET) $(gnustandards-url) -O $(target).t \
|
---|
170 | && $(move_if_change)
|
---|
171 |
|
---|
172 | .PHONY: cvs-update
|
---|
173 | cvs-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi
|
---|
174 |
|
---|
175 |
|
---|
176 | # --------------------- #
|
---|
177 | # Updating everything. #
|
---|
178 | # --------------------- #
|
---|
179 |
|
---|
180 | .PHONY: update
|
---|
181 | update: po-update cvs-update
|
---|
182 |
|
---|
183 |
|
---|
184 | ## --------------- ##
|
---|
185 | ## Sanity checks. ##
|
---|
186 | ## --------------- ##
|
---|
187 |
|
---|
188 | # Checks that don't require cvs. Run `changelog-check' last as
|
---|
189 | # previous test may reveal problems requiring new ChangeLog entries.
|
---|
190 | local-check: po-check changelog-check
|
---|
191 |
|
---|
192 | # copyright-check writable-files
|
---|
193 |
|
---|
194 | changelog-check:
|
---|
195 | if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
|
---|
196 | :; \
|
---|
197 | else \
|
---|
198 | echo "$(VERSION) not in ChangeLog" 1>&2; \
|
---|
199 | exit 1; \
|
---|
200 | fi
|
---|
201 |
|
---|
202 | # Verify that all source files using _() are listed in po/POTFILES.in.
|
---|
203 | # Ignore make.h; it defines _().
|
---|
204 | po-check:
|
---|
205 | if test -f po/POTFILES.in; then \
|
---|
206 | grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
|
---|
207 | grep -E -l '\b_\(' *.c *.h | grep -v make.h | sort > $@-2; \
|
---|
208 | diff -u $@-1 $@-2 || exit 1; \
|
---|
209 | rm -f $@-1 $@-2; \
|
---|
210 | fi
|
---|
211 |
|
---|
212 | ## ------------------------- ##
|
---|
213 | ## GNU FTP upload artifacts. ##
|
---|
214 | ## ------------------------- ##
|
---|
215 |
|
---|
216 | # This target creates the upload artifacts.
|
---|
217 | # Sign it with my key.
|
---|
218 |
|
---|
219 | GPG = gpg
|
---|
220 | GPGFLAGS = -u 6338B6D4
|
---|
221 |
|
---|
222 | DIST_ARCHIVES_SIG = $(addsuffix .sig,$(DIST_ARCHIVES))
|
---|
223 | DIST_ARCHIVES_DIRECTIVE = $(addsuffix .directive.asc,$(DIST_ARCHIVES))
|
---|
224 |
|
---|
225 | .PHONY: distsign
|
---|
226 | distsign: $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
|
---|
227 |
|
---|
228 | $(DIST_ARCHIVES_DIRECTIVE): .directive.asc
|
---|
229 | cp $< $@
|
---|
230 |
|
---|
231 | %.sig : %
|
---|
232 | @echo "Signing file '$<':"
|
---|
233 | $(GPG) $(GPGFLAGS) -o $@ -b $<
|
---|
234 |
|
---|
235 | .directive.asc:
|
---|
236 | @echo "Creating directive file '$@':"
|
---|
237 | @echo 'directory: make' > .directive
|
---|
238 | $(GPG) $(GPGFLAGS) -o $@ --clearsign .directive
|
---|
239 | @rm -f .directive
|
---|
240 |
|
---|
241 | # Upload the artifacts
|
---|
242 |
|
---|
243 | FTPPUT = ncftpput
|
---|
244 | gnu-url = ftp-upload.gnu.org /incoming
|
---|
245 |
|
---|
246 | UPLOADS = upload-alpha upload-ftp
|
---|
247 | .PHONY: $(UPLOADS)
|
---|
248 | $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
|
---|
249 | $(FTPPUT) $(gnu-url)/$(@:upload-%=%) $^
|
---|