|
1 # Makefile for GNU patch. |
|
2 |
|
3 # Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2009 |
|
4 # Free Software Foundation, Inc. |
|
5 |
|
6 # This program is free software; you can redistribute it and/or modify |
|
7 # it under the terms of the GNU General Public License as published by |
|
8 # the Free Software Foundation; either version 2, or (at your option) |
|
9 # any later version. |
|
10 |
|
11 # This program is distributed in the hope that it will be useful, |
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 # GNU General Public License for more details. |
|
15 |
|
16 # You should have received a copy of the GNU General Public License |
|
17 # along with this program; see the file COPYING. |
|
18 # If not, write to the Free Software Foundation, |
|
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 |
|
21 #### Start of system configuration section. #### |
|
22 |
|
23 srcdir = @srcdir@ |
|
24 VPATH = @srcdir@ |
|
25 |
|
26 @SET_MAKE@ |
|
27 |
|
28 CC = @CC@ |
|
29 ed_PROGRAM = @ed_PROGRAM@ |
|
30 INSTALL = @INSTALL@ |
|
31 INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
|
32 INSTALL_DATA = @INSTALL_DATA@ |
|
33 TEST_SHELL = @TEST_SHELL@ |
|
34 transform = @program_transform_name@ |
|
35 |
|
36 CFLAGS = @CFLAGS@ |
|
37 CPPFLAGS = @CPPFLAGS@ |
|
38 DEFS = @DEFS@ |
|
39 EXEEXT = @EXEEXT@ |
|
40 LDFLAGS = @LDFLAGS@ |
|
41 LIBOBJDIR = gl/lib/ |
|
42 LIBOBJS = @LIBOBJS@ ${LIBOBJDIR}full-write$U.o |
|
43 LIBS = @LIBS@ |
|
44 OBJEXT = @OBJEXT@ |
|
45 PACKAGE_NAME = @PACKAGE_NAME@ |
|
46 PACKAGE_VERSION = @PACKAGE_VERSION@ |
|
47 STDBOOL_H = @STDBOOL_H@ |
|
48 GETOPT_H = @GETOPT_H@ |
|
49 HAVE__BOOL = @HAVE__BOOL@ |
|
50 ENABLE_MERGE = @ENABLE_MERGE@ |
|
51 |
|
52 prefix = @prefix@ |
|
53 exec_prefix = @exec_prefix@ |
|
54 bindir = @bindir@ |
|
55 |
|
56 # Where to put the manual pages. |
|
57 datarootdir = @datarootdir@ |
|
58 mandir = @mandir@ |
|
59 man1dir = $(mandir)/man1 |
|
60 # Extension (including `.') for the manual page filenames. |
|
61 man1ext = .1 |
|
62 |
|
63 # Hook for nonstandard builds. |
|
64 CONFIG_STATUS = config.status |
|
65 |
|
66 #### End of system configuration section. #### |
|
67 |
|
68 SHELL = /bin/sh |
|
69 |
|
70 LIBSRCS = \ |
|
71 gl/lib/argmatch.c \ |
|
72 gl/lib/backupfile.c \ |
|
73 gl/lib/basename.c \ |
|
74 gl/lib/dirname.c \ |
|
75 gl/lib/error.c \ |
|
76 gl/lib/exitfail.c \ |
|
77 gl/lib/full-write.c \ |
|
78 gl/lib/getopt1.c \ |
|
79 gl/lib/getopt.c \ |
|
80 gl/lib/hash.c \ |
|
81 gl/lib/malloc.c \ |
|
82 gl/lib/mbrtowc.c \ |
|
83 gl/lib/memchr.c \ |
|
84 gl/lib/quotearg.c \ |
|
85 gl/lib/quote.c \ |
|
86 gl/lib/realloc.c \ |
|
87 gl/lib/rename.c \ |
|
88 gl/lib/safe-read.c \ |
|
89 gl/lib/safe-write.c \ |
|
90 gl/lib/strcasecmp.c \ |
|
91 gl/lib/stripslash.c \ |
|
92 gl/lib/strncasecmp.c \ |
|
93 gl/lib/strndup.c \ |
|
94 gl/lib/xmalloc.c \ |
|
95 gl/lib/xstrndup.c |
|
96 |
|
97 SRCS = $(LIBSRCS) \ |
|
98 src/inp.c \ |
|
99 src/maketime.c \ |
|
100 src/merge.c \ |
|
101 src/partime.c \ |
|
102 src/patch.c \ |
|
103 src/pch.c \ |
|
104 src/quotesys.c \ |
|
105 src/util.c \ |
|
106 src/version.c |
|
107 |
|
108 MERGEOBJ = src/merge.$(OBJEXT) |
|
109 |
|
110 OBJS = $(LIBOBJS) $(MERGEOBJ) \ |
|
111 src/inp.$(OBJEXT) \ |
|
112 src/maketime.$(OBJEXT) \ |
|
113 src/partime.$(OBJEXT) \ |
|
114 src/patch.$(OBJEXT) \ |
|
115 src/pch.$(OBJEXT) \ |
|
116 src/quotesys.$(OBJEXT) \ |
|
117 src/util.$(OBJEXT) \ |
|
118 src/version.$(OBJEXT) |
|
119 |
|
120 LIBHDRS = \ |
|
121 gl/lib/argmatch.h \ |
|
122 gl/lib/backupfile.h \ |
|
123 gl/lib/dirname.h \ |
|
124 gl/lib/error.h \ |
|
125 gl/lib/exitfail.h \ |
|
126 gl/lib/full-write.h \ |
|
127 gl/lib/getopt.hin \ |
|
128 gl/lib/getopt_int.h \ |
|
129 gl/lib/gettext.h \ |
|
130 gl/lib/hash.h \ |
|
131 gl/lib/minmax.h \ |
|
132 gl/lib/quotearg.h \ |
|
133 gl/lib/quote.h \ |
|
134 gl/lib/safe-write.h \ |
|
135 gl/lib/stdbool.hin \ |
|
136 gl/lib/unlocked-io.h \ |
|
137 gl/lib/verify.h \ |
|
138 gl/lib/xalloc.h \ |
|
139 gl/lib/xstrndup.h |
|
140 |
|
141 HDRS = $(LIBHDRS) \ |
|
142 src/bestmatch.h \ |
|
143 src/common.h \ |
|
144 src/diffseq.h \ |
|
145 src/inp.h \ |
|
146 src/maketime.h \ |
|
147 src/partime.h \ |
|
148 src/pch.h \ |
|
149 src/quotesys.h \ |
|
150 src/util.h \ |
|
151 src/version.h |
|
152 |
|
153 MISC = \ |
|
154 AUTHORS \ |
|
155 COPYING \ |
|
156 ChangeLog \ |
|
157 INSTALL \ |
|
158 Makefile.in \ |
|
159 NEWS \ |
|
160 README \ |
|
161 VERSION \ |
|
162 aclocal.m4 \ |
|
163 config.guess\ |
|
164 config.hin \ |
|
165 config.sub \ |
|
166 configure \ |
|
167 configure.ac \ |
|
168 install-sh \ |
|
169 mkinstalldirs \ |
|
170 patch.man \ |
|
171 tests/test-lib.sh \ |
|
172 update-version.sh |
|
173 |
|
174 DISTFILES = $(MISC) $(SRCS) $(HDRS) $(M4FILES) \ |
|
175 pc/chdirsaf.c \ |
|
176 pc/djgpp/config.sed \ |
|
177 pc/djgpp/configure.bat \ |
|
178 pc/djgpp/configure.sed \ |
|
179 pc/djgpp/README |
|
180 |
|
181 MORE_DISTFILES = $(TESTS) $(BROKEN_TESTS) |
|
182 |
|
183 patch_name = `echo patch | sed '$(transform)'` |
|
184 |
|
185 all:: src/patch$(EXEEXT) |
|
186 |
|
187 info:: |
|
188 installcheck:: |
|
189 |
|
190 TESTS = \ |
|
191 tests/asymmetric-hunks \ |
|
192 tests/backup-prefix-suffix \ |
|
193 tests/corrupt-reject-files \ |
|
194 tests/create-delete \ |
|
195 tests/crlf-handling \ |
|
196 tests/filename-choice \ |
|
197 tests/global-reject-files \ |
|
198 tests/inname \ |
|
199 tests/line-numbers \ |
|
200 tests/merge \ |
|
201 tests/munged-context-format \ |
|
202 tests/need-filename \ |
|
203 tests/no-newline-triggers-assert \ |
|
204 tests/preserve-c-function-names \ |
|
205 tests/preserve-mode-and-timestamp \ |
|
206 tests/reject-format \ |
|
207 tests/remember-backup-files \ |
|
208 tests/remember-reject-files \ |
|
209 tests/unmodified-files |
|
210 |
|
211 BROKEN_TESTS = \ |
|
212 tests/dash-o-append |
|
213 |
|
214 check:: $(TESTS) |
|
215 @echo All tests succeeded! |
|
216 |
|
217 .PHONY: $(TESTS) $(BROKEN_TESTS) |
|
218 $(TESTS) $(BROKEN_TESTS): all |
|
219 @echo "[$@]" |
|
220 @srcdir=$(srcdir)/tests $(TEST_SHELL) $(srcdir)/$@ |
|
221 |
|
222 DEFINE_ENABLE_MERGE = -DENABLE_MERGE |
|
223 COMPILE = $(CC) -c $(CPPFLAGS) $(DEFS) -Ded_PROGRAM=\"$(ed_PROGRAM)\" \ |
|
224 $(DEFINE_ENABLE_MERGE) -I. -I$(srcdir)/src -I$(srcdir)/gl/lib $(CFLAGS) |
|
225 |
|
226 .c.$(OBJEXT): |
|
227 @mkdir -p $(@D) |
|
228 $(COMPILE) -o $@ $< |
|
229 |
|
230 src/patch$(EXEEXT): $(OBJS) |
|
231 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) |
|
232 |
|
233 install:: all |
|
234 $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) |
|
235 $(INSTALL_PROGRAM) src/patch$(EXEEXT) $(DESTDIR)$(bindir)/$(patch_name)$(EXEEXT) |
|
236 $(INSTALL_DATA) $(srcdir)/patch.man $(DESTDIR)$(man1dir)/$(patch_name)$(man1ext) |
|
237 |
|
238 install-strip:: |
|
239 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install |
|
240 |
|
241 uninstall:: |
|
242 rm -f $(DESTDIR)$(bindir)/$(patch_name)$(EXEEXT) \ |
|
243 $(DESTDIR)$(man1dir)/$(patch_name)$(man1ext) |
|
244 |
|
245 Makefile: Makefile.in $(CONFIG_STATUS) |
|
246 $(SHELL) $(CONFIG_STATUS) |
|
247 FORCE: |
|
248 VERSION: FORCE |
|
249 @cd $(srcdir) && $(SHELL) ./update-version.sh VERSION |
|
250 config.status: configure |
|
251 $(SHELL) $(CONFIG_STATUS) --recheck |
|
252 configure: configure.ac $(srcdir)/aclocal.m4 $(srcdir)/VERSION |
|
253 cd $(srcdir) && autoconf --force |
|
254 config.hin: configure.ac $(srcdir)/aclocal.m4 |
|
255 cd $(srcdir) && autoheader --force |
|
256 |
|
257 # We need the following in order to create <getopt.h> when the system |
|
258 # doesn't have one that works with the given compiler. |
|
259 getopt.h: gl/lib/getopt.hin |
|
260 rm -f $@-t $@ |
|
261 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ |
|
262 cat $(srcdir)/gl/lib/getopt.hin; \ |
|
263 } > $@-t |
|
264 mv -f $@-t $@ |
|
265 |
|
266 # We need the following in order to create <stdbool.h> when the system |
|
267 # doesn't have one that works. |
|
268 #gl/lib/stdbool.h: gl/lib/stdbool.hin |
|
269 stdbool.h: gl/lib/stdbool.hin |
|
270 rm -f $@-t $@ |
|
271 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ |
|
272 sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' \ |
|
273 < $(srcdir)/gl/lib/stdbool.hin; \ |
|
274 } > $@-t |
|
275 mv $@-t $@ |
|
276 |
|
277 LIBM4FILES = \ |
|
278 gl/m4/argmatch.m4 \ |
|
279 gl/m4/backupfile.m4 \ |
|
280 gl/m4/d-ino.m4 \ |
|
281 gl/m4/dirname.m4 \ |
|
282 gl/m4/dos.m4 \ |
|
283 gl/m4/double-slash-root.m4 \ |
|
284 gl/m4/error.m4 \ |
|
285 gl/m4/exitfail.m4 \ |
|
286 gl/m4/extensions.m4 \ |
|
287 gl/m4/getopt.m4 \ |
|
288 gl/m4/gettext.m4 \ |
|
289 gl/m4/hash.m4 \ |
|
290 gl/m4/inline.m4 \ |
|
291 gl/m4/malloc.m4 \ |
|
292 gl/m4/mbrtowc.m4 \ |
|
293 gl/m4/mbstate_t.m4 \ |
|
294 gl/m4/memchr.m4 \ |
|
295 gl/m4/minmax.m4 \ |
|
296 gl/m4/onceonly.m4 \ |
|
297 gl/m4/quotearg.m4 \ |
|
298 gl/m4/quote.m4 \ |
|
299 gl/m4/realloc.m4 \ |
|
300 gl/m4/rename.m4 \ |
|
301 gl/m4/safe-write.m4 \ |
|
302 gl/m4/ssize_t.m4 \ |
|
303 gl/m4/stdbool.m4 \ |
|
304 gl/m4/strcase.m4 \ |
|
305 gl/m4/strndup.m4 \ |
|
306 gl/m4/unlocked-io.m4 \ |
|
307 gl/m4/utimbuf.m4 \ |
|
308 gl/m4/xalloc.m4 \ |
|
309 gl/m4/xstrndup.m4 |
|
310 |
|
311 M4FILES = $(LIBM4FILES) \ |
|
312 m4/mkdir.m4 \ |
|
313 m4/setmode.m4 |
|
314 |
|
315 $(srcdir)/aclocal.m4: $(M4FILES) |
|
316 aclocal -I m4 -I gl/m4 |
|
317 |
|
318 TAGS: $(HDRS) $(SRCS) |
|
319 etags $(HDRS) $(SRCS) |
|
320 |
|
321 mostlyclean:: |
|
322 rm -f core* *core src/*.$(OBJEXT) gl/lib/*.$(OBJEXT) \ |
|
323 stdbool.h getopt.h gl/lib/*.h-t |
|
324 |
|
325 clean:: mostlyclean |
|
326 rm -f src/patch$(EXEEXT) |
|
327 |
|
328 distclean:: clean |
|
329 rm -f Makefile config.cache config.hin~ config.log config.status \ |
|
330 config.h |
|
331 rm -rf autom4te.cache/ |
|
332 |
|
333 maintainer-clean:: |
|
334 @echo "This command is intended for maintainers to use;" |
|
335 @echo "rebuilding the deleted files requires special tools." |
|
336 $(MAKE) distclean |
|
337 rm -f TAGS VERSION aclocal.m4 config.hin configure \ |
|
338 patch-*.tar.gz patch-*.tar.gz.sig |
|
339 |
|
340 PV = $(PACKAGE_NAME)-$(PACKAGE_VERSION) |
|
341 |
|
342 dist:: $(DISTFILES) |
|
343 @rm -rf $(PV) |
|
344 @ln -s . $(PV) |
|
345 @tar -cf - `( printf "%s\n" $(DISTFILES) $(MORE_DISTFILES); \ |
|
346 grep -q -E -- '-[0-9]+-[0-9a-z]+(-dirty)?$$' VERSION \ |
|
347 && echo README-alpha \ |
|
348 ) | sed -e 's,^$(srcdir)/,,' -e "s,^,$(PV)/," \ |
|
349 | LC_ALL=C sort` \ |
|
350 | gzip -9 > $(PV).tar.gz |
|
351 @if which bzip2 >/dev/null 2>/dev/null; then \ |
|
352 gzip -d < $(PV).tar.gz | bzip2 -9 > $(PV).tar.bz2; fi |
|
353 @if which xz >/dev/null 2>/dev/null; then \ |
|
354 gzip -d < $(PV).tar.gz | xz -9 > $(PV).tar.xz; fi |
|
355 @rm -rf $(PV) |
|
356 @whereto=$$(if grep -q -E -- '-[0-9]+-[0-9a-z]+(-dirty)?$$' VERSION; \ |
|
357 then echo alpha; else echo ftp; fi); \ |
|
358 echo; \ |
|
359 echo "# gnupload --to $$whereto.gnu.org:patch $(PV).tar.gz"; \ |
|
360 test ! -e $(PV).tar.bz2 || echo "# gnupload" \ |
|
361 "--to $$whereto.gnu.org:patch $(PV).tar.bz2"; \ |
|
362 test ! -e $(PV).tar.xz || echo "# gnupload" \ |
|
363 "--to $$whereto.gnu.org:patch $(PV).tar.xz"; \ |
|
364 echo |
|
365 |
|
366 $(OBJS): config.h |
|
367 COMMON = src/common.h $(STDBOOL_H) |
|
368 |
|
369 gl/lib/addext.$(OBJEXT): gl/lib/backupfile.h gl/lib/dirname.h |
|
370 gl/lib/argmatch.$(OBJEXT): $(STDBOOL_H) gl/lib/argmatch.h gl/lib/gettext.h \ |
|
371 gl/lib/error.h gl/lib/quote.h gl/lib/quotearg.h gl/lib/unlocked-io.h |
|
372 gl/lib/backupfile.$(OBJEXT): gl/lib/argmatch.h gl/lib/backupfile.h \ |
|
373 gl/lib/dirname.h |
|
374 gl/lib/basename.$(OBJEXT): gl/lib/dirname.h |
|
375 gl/lib/dirname.$(OBJEXT): gl/lib/dirname.h gl/lib/xalloc.h |
|
376 gl/lib/error.$(OBJEXT): gl/lib/error.h gl/lib/gettext.h gl/lib/unlocked-io.h |
|
377 gl/lib/exitfail.$(OBJEXT): gl/lib/exitfail.h |
|
378 gl/lib/full-write.$(OBJEXT): gl/lib/full-write.h gl/lib/safe-write.h |
|
379 gl/lib/getopt.$(OBJEXT) gl/lib/getopt1.$(OBJEXT): getopt.h |
|
380 gl/lib/hash.$(OBJEXT): $(STDBOOL_H) gl/lib/hash.h |
|
381 gl/lib/safe-read.$(OBJEXT): gl/lib/safe-write.h |
|
382 gl/lib/safe-write.$(OBJEXT): gl/lib/safe-read.c |
|
383 |
|
384 src/inp.$(OBJEXT): gl/lib/backupfile.h $(COMMON) src/inp.h src/pch.h \ |
|
385 gl/lib/quotearg.h src/util.h gl/lib/xalloc.h |
|
386 src/maketime.$(OBJEXT): src/maketime.h src/partime.h |
|
387 src/partime.$(OBJEXT): src/partime.h |
|
388 src/patch.$(OBJEXT): gl/lib/argmatch.h gl/lib/backupfile.h $(COMMON) \ |
|
389 gl/lib/exitfail.h $(GETOPT_H) src/inp.h src/pch.h \ |
|
390 gl/lib/quotearg.h src/util.h src/version.h gl/lib/xalloc.h |
|
391 src/pch.$(OBJEXT): gl/lib/backupfile.h $(COMMON) gl/lib/dirname.h src/inp.h \ |
|
392 src/pch.h gl/lib/quotearg.h src/util.h |
|
393 gl/lib/quote.$(OBJECT): gl/lib/quote.h gl/lib/quotearg.h |
|
394 gl/lib/quotearg.$(OBJEXT): gl/lib/gettext.h gl/lib/quotearg.h gl/lib/xalloc.h |
|
395 src/quotesys.$(OBJEXT): src/quotesys.h |
|
396 gl/lib/strncasecmp.$(OBJEXT): gl/lib/strcasecmp.c |
|
397 src/util.$(OBJEXT): gl/lib/backupfile.h $(COMMON) gl/lib/dirname.h gl/lib/full-write.h \ |
|
398 gl/lib/hash.h src/maketime.h src/partime.h gl/lib/quotearg.h \ |
|
399 src/quotesys.h src/util.h src/version.h gl/lib/xalloc.h |
|
400 src/version.$(OBJEXT): $(COMMON) src/version.h |
|
401 gl/lib/xmalloc.$(OBJEXT): gl/lib/error.h gl/lib/exitfail.h gl/lib/gettext.h \ |
|
402 gl/lib/xalloc.h |