On Monday 19 September 2005 22:42, Jean Delvare wrote:
> I still don't get why we want this to be run on each make invocation
> rather than right after generating these compatibility programs?

I wanted to reuse the "% : %.in" rule.

> This change doesn't even stop the repeated generation of doc/quilt.1,
> although I can't seem to figure out why.

The compat-programs target was phony.

Makefile.in deserves a lot of cleanups. How does the attached cleanup work for 
starters?

-- Andreas.

PS.
I won't be working on Quilt much the next couple of days.
Index: Makefile.in
===================================================================
RCS file: /cvsroot/quilt/quilt/Makefile.in,v
retrieving revision 1.90
diff -u -r1.90 Makefile.in
--- Makefile.in	19 Sep 2005 19:02:52 -0000	1.90
+++ Makefile.in	19 Sep 2005 22:06:54 -0000
@@ -40,14 +40,6 @@
 
 default: all
 
-define COMPAT_SYMLINK_install
-install-compat-symlink-$(strip $(1)): install-compat
-	ln -sf $($(shell echo $(1) | $(AWK) '{print toupper($$1)}')) \
-	       $(BUILD_ROOT)$(COMPAT_DIR)/$(strip $(1))
-endef
-
-$(foreach symlink, $(COMPAT_SYMLINKS), $(eval $(call COMPAT_SYMLINK_install, $(symlink))))
-
 CC :=		@CC@
 CPPFLAGS +=	@CPPFLAGS@ @DEFS@
 CFLAGS +=	@CFLAGS@
@@ -113,7 +105,7 @@
 LINGUAS :=	fr de ja
 PO :=		quilt.pot $(LINGUAS:%=%.po)
 SRC +=		$(PO:%=po/%)
-DIRT +=         po/*.mo po/*~
+DIRT +=         po/*.mo
 
 SRC +=		$(wildcard test/*.test) test/run test/Makefile \
 		test/test.quiltrc
@@ -121,13 +113,14 @@
 
 #-----------------------------------------------------------------------
 
-all : scripts compat-programs $(if $(MSGFMT),$(LINGUAS:%=po/%.mo))
-
-.PHONY :: compat-programs
-compat-programs : $(COMPAT_PROGRAMS:%=compat/%)
-	@for program in $+; do \
-	    test -x $$program || chmod +x $$program; \
-	done
+all : $(BIN:%=bin/%) \
+      $(QUILT:%=quilt/%) \
+      $(SCRIPTS:%=scripts/%) \
+      $(LIB:%=lib/%) \
+      $(DOC:%=doc/%) \
+      $(MAN1) \
+      $(COMPAT_PROGRAMS:%=compat/%) \
+      $(if $(MSGFMT),$(LINGUAS:%=po/%.mo))
 
 $(LIB:%=lib/%) : $(LIB_SRC:%.c=lib/%.o)
 	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
@@ -138,9 +131,6 @@
 %.po : po/quilt.pot
 	msgmerge -o $@ $@ $^
 
-scripts : $(BIN:%=bin/%) $(QUILT:%=quilt/%) $(SCRIPTS:%=scripts/%) compat \
-	  $(LIB:%=lib/%) $(DOC:%=doc/%) $(MAN1)
-
 dist : clean $(PACKAGE)-$(VERSION).tar.gz
 
 snapshot : $(PACKAGE)-$(ISODATE).tar.bz2
@@ -169,8 +159,8 @@
 	@echo "README.in -> README"
 	@while read line; do \
 		case "$$line" in \
-		'@REFERENCE''@') \
-			$(MAKE) -s reference |egrep -v '^make'\
+		@REFERENCE@) \
+			$(MAKE) -s reference | grep -v '^make' \
 			;; \
 		*) \
 			echo $$line \
@@ -178,13 +168,13 @@
 		esac ; \
 	done 2>&1 < $< > $@
 
-doc/quilt.1: doc/quilt.1.in $(QUILT:%=quilt/%) compat-programs
+doc/quilt.1 : doc/quilt.1.in $(QUILT:%=quilt/%)
 	@echo "quilt.1.in -> quilt.1"
 	@export PATH="`pwd`/compat:$$PATH";		\
 	here=`pwd`;                                     \
 	 while read line; do                             \
 	  case "$$line" in                               \
-	    '@REFERENCE''@')                             \
+	    @REFERENCE@)                             \
 	       for cmd in $(sort $(QUILT:%=quilt/%)) ; do \
 		($(BASH) -c ". scripts/patchfns ; LC_ALL=C . $$here/$$cmd -h")| \
 		   sed -e 's/Usage: quilt //'            \
@@ -207,8 +197,8 @@
 	   esac ;                                        \
 	done 2>&1 < $< > $@
 
-.PHONY :: reference
-reference : $(QUILT:%=quilt/%) compat-programs scripts/patchfns
+.PHONY : reference
+reference : $(QUILT:%=quilt/%) scripts/patchfns
 	@export PATH="`pwd`/compat:$$PATH"; \
 	dir=$(CURDIR); \
 	for i in $(QUILT:%=quilt/%); \
@@ -248,8 +238,7 @@
 	       gsub(/@CHANGELOG''@/, changelog) ; \
 	       print }' changelog="$$changelog" $< > $@
 
-$(patsubst %.in,%,$(wildcard quilt/*.in scripts/*.in)) :: Makefile
-% :: %.in
+define substitute
 	@echo "$< -> $@" >&2
 	@sed -e 's:@LIB''@:$(LIB_DIR):g' \
 	     -e 's:@QUILT''@:$(QUILT_DIR):g' \
@@ -262,8 +251,16 @@
 	     -e 's:@LOCALEDIR''@:$(localedir):g' \
 	     -e 's:@DOCSUBDIR''@:$(docdir)/$(PACKAGE)-$(VERSION):g' \
 	     $< > $@
+endef
+
+$(patsubst %.in,%,$(wildcard */*.in)) : Makefile
+compat/% : compat/%.in
+	$(call substitute)
+	chmod +x $@
+% : %.in
+	$(call substitute)
 
-lib/backup-files.o :: Makefile
+lib/backup-files.o : Makefile
 
 Makefile : Makefile.in
 	@echo "Please run ./configure"
@@ -308,7 +305,15 @@
 endif
 endif
 
-install: scripts install-main install-compat \
+define COMPAT_SYMLINK_install
+install-compat-symlink-$(strip $(1)): install-compat
+	ln -sf $($(shell echo $(1) | $(AWK) '{print toupper($$1)}')) \
+	       $(BUILD_ROOT)$(COMPAT_DIR)/$(strip $(1))
+endef
+
+$(foreach symlink, $(COMPAT_SYMLINKS), $(eval $(call COMPAT_SYMLINK_install, $(symlink))))
+
+install: all install-main install-compat \
 	 $(COMPAT_SYMLINKS:%=install-compat-symlink-%)
 
 uninstall ::
@@ -342,4 +347,4 @@
 	done
 endif
 
-.PHONY :: all install uninstall clean distclean
+.PHONY : all install uninstall clean distclean
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to