PACKAGE := @PACKAGE_NAME@ VERSION := @PACKAGE_VERSION@ RELEASE := @PACKAGE_RELEASE@ PACKAGE_BUGREPORT := @PACKAGE_BUGREPORT@ prefix := @prefix@ exec_prefix := @exec_prefix@ bindir := @bindir@ libdir := @libdir@ datadir := @datadir@ docdir := @docdir@ mandir := $(datadir)/man localedir := $(datadir)/locale etcdir := $(subst /usr/etc,/etc,$(prefix)/etc) QUILT_DIR = $(datadir)/$(PACKAGE) SCRIPTS_DIR = $(QUILT_DIR)/scripts LIB_DIR = $(libdir)/$(PACKAGE) INSTALL := @INSTALL@ PERL := @PERL@ BASH := @BASH@ SED := @SED@ AWK := @AWK@ DIFF := @DIFF@ PATCH := @PATCH@ MKTEMP := @MKTEMP@ MSGFMT := @MSGFMT@ DIFFSTAT := @DIFFSTAT@ RPMBUILD := @RPMBUILD@ MTA := @MTA@ ifeq "$(MSGFMT)" "" MAKE_NLS := @true else MAKE_NLS := $(MAKE) endif CFLAGS := @CFLAGS@ -Wall ISODATE := $(shell date +%Y-%m-%d) #----------------------------------------------------------------------- DIRT += $(shell find -name '*~') DIRT += $(shell find -name '.\#*') SRC += COPYING AUTHORS TODO BUGS Makefile.in \ configure.ac config/install-sh \ quilt.spec.in quilt.changes \ bash_completion quilt.quiltrc DIRT += quilt.spec BIN_IN := quilt guards BIN_SRC := $(BIN_IN:%=%.in) BIN := $(BIN_IN) SRC += $(BIN_SRC:%=bin/%) DIRT += $(BIN_IN:%=bin/%) QUILT_IN := add applied delete diff edit files fold fork graph grep \ import mail new next patches pop previous push refresh remove \ series setup snapshot top unapplied upgrade QUILT_SRC := $(QUILT_IN:%=%.in) QUILT := $(QUILT_IN) SRC += $(QUILT_SRC:%=quilt/%) DIRT += $(QUILT_IN:%=quilt/%) SCRIPTS_IN := patchfns parse-patch inspect dependency-graph edmail SCRIPTS_SRC := $(SCRIPTS_IN:%=%.in) SCRIPTS := $(SCRIPTS_IN) SRC += $(SCRIPTS_SRC:%=scripts/%) DIRT += $(SCRIPTS_IN:%=scripts/%) LIB_SRC := backup-files.c LIB := backup-files SRC += $(LIB_SRC:%=lib/%) DIRT += lib/backup-files lib/backup-files.o DOC_IN := README DOC_SRC := $(DOC_IN:%=doc/%.in) DOC := $(DOC_IN) SRC += $(DOC_SRC) SRC += doc/main.tex doc/quilt.pdf doc/Makefile \ doc/sample.quiltrc doc/quilt.1.in \ doc/README.MAIL DIRT += $(DOC_IN:%=doc/%) doc/quilt.1 MAN1 := bin/guards.1 doc/quilt.1 DIRT += $(MAN1) #DEBIAN := changelog control copyright rules # #SRC += $(DEBIAN:%=debian/%) LINGUAS := fr de ja PO := Makefile quilt.pot $(LINGUAS:%=%.po) SRC += $(PO:%=po/%) DIRT += po/*.mo SRC += $(wildcard test/*.test) test/run SRC += changes2changelog #----------------------------------------------------------------------- all : scripts $(MAKE_NLS) -C po all BUILD_ROOT=$(BUILD_ROOT) scripts : $(BIN:%=bin/%) $(QUILT:%=quilt/%) $(SCRIPTS:%=scripts/%) \ $(LIB:%=lib/%) $(DOC:%=doc/%) $(MAN1) $(QUILT:%=quilt/%) : $(SCRIPTS:%=scripts/%) dist : clean $(PACKAGE)-$(VERSION).tar.gz snapshot : $(PACKAGE)-$(ISODATE).tar.bz2 rpm rpmbuild : $(PACKAGE)-$(VERSION).tar.gz $(RPMBUILD) -ta $< doc/README : doc/README.in @echo "README.in -> README" @while read line; do \ case "$$line" in \ '@REFERENCE''@') \ $(MAKE) -s reference |egrep -v '^make'\ ;; \ *) \ echo $$line \ ;; \ esac ; \ done 2>&1 < $< > $@ doc/quilt.1: doc/quilt.1.in $(QUILT:%=quilt/%) @echo "quilt.1.in -> quilt.1" @here=`pwd`; \ while read line; do \ case "$$line" in \ '@REFERENCE''@') \ for cmd in $(sort $(QUILT:%=quilt/%)) ; do \ (bash -c ". scripts/patchfns ; LC_ALL=C . $$here/$$cmd -h")| \ sed -e 's/Usage: quilt //' \ -e 's/^\([^ ]*\)/\\fB\1\\fP/' \ -e 's/^/.IP "/' -e 's/$$/ " 4/' | \ head -n 1; \ echo ; \ (bash -c ". scripts/patchfns ; LC_ALL=C . $$here/$$cmd -h")| \ grep -v 'Usage: quilt' | \ sed -e $$'s/^\t//' \ -e $$'s/\t/\\\n/' | \ sed -e 's/^\(-.*\)$$/.IP " \1" 8/';\ echo; \ done \ ;; \ *) \ echo "$$line" \ ;; \ esac ; \ done 2>&1 < $< > $@ .PHONY :: reference reference : $(QUILT:%=quilt/%) scripts/patchfns @dir=$(CURDIR); \ for i in $(filter-out scripts/patchfns,$+); \ do \ echo; \ (bash -c ". scripts/patchfns ; cd $$dir ;LC_ALL=C . $$i -h"); \ echo; \ done | \ sed -e '/^Usage:/{s/^Usage: \?//;b}' -e '/^$$/!s/^/ /' bin/guards.1 : bin/guards mkdir -p $$(dirname $@) pod2man $< > $@ $(PACKAGE)-$(VERSION).tar.gz : $(SRC) configure $(PACKAGE).spec rm -f $(PACKAGE)-$(VERSION) $@ ln -s . $(PACKAGE)-$(VERSION) tar chf - $(+:%=$(PACKAGE)-$(VERSION)/%) | gzip -9 > $@ rm -f $(PACKAGE)-$(VERSION) @echo "File $@ created." $(PACKAGE)-$(ISODATE).tar.bz2 : $(SRC) configure $(PACKAGE).spec rm -f $(PACKAGE)-$(ISODATE) $@ ln -s . $(PACKAGE)-$(ISODATE) tar chf - $(+:%=$(PACKAGE)-$(ISODATE)/%) | bzip2 -9 > $@ rm -f $(PACKAGE)-$(ISODATE) @echo "File $@ created." configure : configure.ac autoconf $(PACKAGE).spec : $(PACKAGE).spec.in $(PACKAGE).changes Makefile \ scripts/parse-patch @echo "Generating spec file" @sed -e 's/^\(Version:[ \t]*\).*/\1$(VERSION)/' \ -e 's/^\(Release:[ \t]\).*/\1$(RELEASE)/' \ < $< > $@ @./changes2changelog $(PACKAGE).changes \ | scripts/parse-patch -u changelog $@ % : %.in @echo "$< -> $@" >&2 @sed -e 's:@LIB''@:$(LIB_DIR):g' \ -e 's:@QUILT''@:$(QUILT_DIR):g' \ -e 's:@SCRIPTS''@:$(SCRIPTS_DIR):g' \ -e 's:@PERL''@:$(PERL):g' \ -e 's:@BASH''@:$(BASH):g' \ -e 's:@SED''@:$(SED):g' \ -e 's:@AWK''@:$(AWK):g' \ -e 's:@DIFF''@:$(DIFF):g' \ -e 's:@PATCH''@:$(PATCH):g' \ -e 's:@MKTEMP''@:$(MKTEMP):g' \ -e 's:@PACKAGE_BUGREPORT''@:$(PACKAGE_BUGREPORT):g' \ -e 's:@VERSION''@:$(VERSION):g' \ -e 's:@RELEASE''@:$(RELEASE):g' \ -e 's:@RPMBUILD''@:$(RPMBUILD):g' \ -e 's:@DIFFSTAT''@:$(DIFFSTAT):g' \ -e 's:@MTA''@:$(MTA):g' \ -e 's:@LOCALEDIR''@:$(localedir):g' \ -e 's:@DOCSUBDIR''@:$(docdir)/$(PACKAGE)-$(VERSION):g' \ $< > $@ @chmod --reference=$< $@ Makefile : Makefile.in @echo "Please run ./configure by hand" @false install : scripts @INSTALL@ -d $(BUILD_ROOT)$(bindir) @INSTALL@ -m 755 $(BIN:%=bin/%) $(BUILD_ROOT)$(bindir)/ @INSTALL@ -d $(BUILD_ROOT)$(QUILT_DIR) @INSTALL@ -m 755 $(QUILT:%=quilt/%) $(BUILD_ROOT)$(QUILT_DIR)/ @INSTALL@ -d $(BUILD_ROOT)$(SCRIPTS_DIR) @INSTALL@ -m 755 $(filter-out scripts/patchfns, \ $(SCRIPTS:%=scripts/%)) \ $(BUILD_ROOT)$(SCRIPTS_DIR) @INSTALL@ -m 644 scripts/patchfns $(BUILD_ROOT)$(SCRIPTS_DIR) @INSTALL@ -d $(BUILD_ROOT)$(LIB_DIR) @INSTALL@ -m 755 -s $(LIB:%=lib/%) $(BUILD_ROOT)$(LIB_DIR)/ @INSTALL@ -d $(BUILD_ROOT)$(docdir)/$(PACKAGE)-$(VERSION)/ @INSTALL@ -m 644 doc/README \ $(BUILD_ROOT)$(docdir)/$(PACKAGE)-$(VERSION)/ @INSTALL@ -m 644 doc/quilt.pdf doc/README.MAIL \ $(BUILD_ROOT)$(docdir)/$(PACKAGE)-$(VERSION)/ @INSTALL@ -d $(BUILD_ROOT)$(mandir)/man1 @INSTALL@ -m 644 $(MAN1) $(BUILD_ROOT)$(mandir)/man1/ $(MAKE_NLS) -C po install BUILD_ROOT=$(BUILD_ROOT) \ LINGUAS="$(LINGUAS)" localedir=$(localedir) @INSTALL@ -d $(BUILD_ROOT)$(etcdir) @INSTALL@ -d $(BUILD_ROOT)$(etcdir)/bash_completion.d @INSTALL@ -m 644 bash_completion $(BUILD_ROOT)$(etcdir)/bash_completion.d/quilt @INSTALL@ -m 644 quilt.quiltrc $(BUILD_ROOT)$(etcdir)/ clean : rm -f $(DIRT) rm -f po/*.mo distclean : clean rm -f config.log config.status Makefile rm -rf autom4te.cache/