Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: phony make targets



Zefram wrote:
> Peter Stephenson wrote:
> >GNU make sometimes creates empty files with the names of phony targets such
> >as `FORCE' and `all'.  This should help in this case, I hope other forms of
> >make will just ignore it.
> 
> makes that don't recognise it will ignore it, except that it will become
> the default target if it is the first rule in the Makefile.  It should
> go at the end of the Makefile.  Or for greater maintainability, put a
> .PHONY pseudo-rule after the rule for each phony target.

Yes, I should have thought of that.

> But I'd like to know when make will actually create a file for a phony
> target.  It shouldn't be possible for it to do that; there's something
> seriously wrong if that's happening.

I've never found out when it's happening, since I only find them lying
round every now and then.  But make is the only thing that even knows about
these files, so it must be there.  I've seen on it various different
systems.  Could be `make -t'.

Index: Src/Makefile.in
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Src/Makefile.in,v
retrieving revision 1.10
diff -u -r1.10 Makefile.in
--- Src/Makefile.in	2000/01/02 17:59:10	1.10
+++ Src/Makefile.in	2000/01/04 20:33:33
@@ -39,12 +39,6 @@
 
 @DEFS_MK@
 
-.PHONY: all bin headers modules modobjs modules prep rm-modobjs-tmp \
-	FORCE mostlyclean-here clean-here distclean-here mostlyclean \
-	clean distclean realclean mostlyclean-modules clean-modules \
-	distclean-modules realclean-modules install.modules \
-	uninstall.modules proto
-
 sdir_src      = $(sdir)
 dir_src       = .
 
@@ -54,10 +48,13 @@
 DLLINK      = $(DLLD) $(LDFLAGS) $(LIBLDFLAGS) $(DLLDFLAGS) -o $@
 
 all: bin modules
+.PHONY: all
 
 bin: zsh
+.PHONY: bin
 
 modules: headers
+.PHONY: modules
 
 MAIN_OBJS = main.o
 
@@ -95,9 +92,11 @@
 	fi
 
 modobjs: headers rm-modobjs-tmp
+.PHONY: modobjs
 
 rm-modobjs-tmp:
 	rm -f stamp-modobjs.tmp
+.PHONY: rm-modobjs-tmp
 
 @CONFIG_MK@
 
@@ -121,8 +120,10 @@
 	cd $(dir_top) && \
 	    $(SHELL) $$top_srcdir/$(subdir)/mkmakemod.sh $(subdir) Makemod
 	@$(MAKE) -f Makemod $(MAKEDEFS) prep || rm -f Makemod
+.PHONY: prep
 
 FORCE:
+.PHONY: FORCE
 
 # ========== LINKING IN MODULES ==========
 
@@ -158,9 +159,11 @@
 
 install: install.bin install.modules
 uninstall: uninstall.bin uninstall.modules
+.PHONY: install uninstall
 
 install.bin: install.bin-here
 uninstall.bin: uninstall.bin-here
+.PHONY: install.bin uninstall.bin
 
 # install binary, creating install directory if necessary
 install.bin-here: zsh install.bin-@L@
@@ -173,19 +176,23 @@
 	rm -f $(DESTDIR)$(bindir)/$(tzsh).new
 	$(LN) $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION) $(DESTDIR)$(bindir)/$(tzsh).new
 	mv $(DESTDIR)$(bindir)/$(tzsh).new $(DESTDIR)$(bindir)/$(tzsh)
+.PHONY: install.bin-here
 
 install.bin-N:
 install.bin-L: $(LIBZSH)
 	$(sdir_top)/mkinstalldirs $(DESTDIR)$(libdir)/$(tzsh)
 	$(INSTALL_PROGRAM) $(LIBZSH) $(DESTDIR)$(libdir)/$(tzsh)/$(LIBZSH)
+.PHONY: install.bin-N install.bin-L
 
 # uninstall binary
 uninstall.bin-here: uninstall.bin-@L@
 	rm -f $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION) $(DESTDIR)$(bindir)/$(tzsh)
+.PHONY: uninstall.bin-here uninstall.bin-@L@
 
 uninstall.bin-N:
 uninstall.bin-L:
 	rm -f $(DESTDIR)$(libdir)/$(tzsh)/$(LIBZSH)
+.PHONY: uninstall.bin-N uninstall.bin-L
 
 # ========== DEPENDENCIES FOR CLEANUP ==========
 
@@ -195,20 +202,24 @@
 
 mostlyclean-here:
 	rm -f stamp-modobjs stamp-modobjs.tmp
+.PHONY: mostlyclean-here
 
 clean-here:
 	rm -f modules.index.tmp modules.stamp zsh ansi2knr.o ansi2knr
 	rm -f modules.index modules-bltin
 	rm -f libzsh-*.$(DL_EXT)
+.PHONY: clean-here
 
 distclean-here:
 	rm -f TAGS tags
 	rm -f Makefile mymods.conf
+.PHONY: distclean-here
 
 mostlyclean: mostlyclean-modules
 clean: clean-modules
 distclean: distclean-modules
 realclean: realclean-modules
+.PHONY: mostlyclean clean distclean realclean
 
 # Don't remake Makemod just to delete things, even if it doesn't exist.
 mostlyclean-modules clean-modules distclean-modules realclean-modules: modules.index
@@ -216,6 +227,8 @@
 	  $(MAKE) -f Makemod $(MAKEDEFS) `echo $@ | sed 's/-modules//'`; \
 	fi; \
 	exit 0
+.PHONY: mostlyclean-modules clean-modules distclean-modules \
+	realclean-modules
 
 @CLEAN_MK@
 
@@ -224,5 +237,6 @@
 install.modules uninstall.modules \
 modobjs modules headers proto $(MAIN_OBJS) zsh.export: Makemod
 	@$(MAKE) -f Makemod $(MAKEDEFS) $@
+.PHONY: install.modules uninstall.modules
 
 $(MAIN_OBJS): $(sdir)/zsh.h
Index: Src/Makemod.in.in
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Src/Makemod.in.in,v
retrieving revision 1.5
diff -u -r1.5 Makemod.in.in
--- Src/Makemod.in.in	2000/01/02 17:59:10	1.5
+++ Src/Makemod.in.in	2000/01/04 20:36:40
@@ -39,13 +39,7 @@
 INSTALL         = @INSTALL@
 
 @DEFS_MK@
-
-.PHONY: all modobjs modules headers proto prep FORCE install uninstall \
-	install.bin uninstall.bin install.modules uninstall.modules \
-	install.bin-here uninstall.bin-here install.modules-here \
-	uninstall.modules-here mostlyclean-here clean-here distclean-here \
 	
-
 sdir_src      = $(sdir_top)/Src
 dir_src       = $(dir_top)/Src
 
@@ -96,11 +90,13 @@
 # ========== DEPENDENCIES FOR BUILDING ==========
 
 all: modobjs modules
+.PHONY: all
 
 modobjs: $(MODOBJS)
 modules: $(MODULES)
 headers: $(MDHS)
 proto: $(PROTOS)
+.PHONY: modobjs modules headers proto
 
 prep:
 	@case $(sdir_top) in \
@@ -116,25 +112,31 @@
 	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh $$dir Makefile || exit 1; \
 	    ( cd $$dir && $(MAKE) $(MAKEDEFS) $@ ) || exit 1; \
 	done
+.PHONY: prep
 
 headers prep: $(dir_src)/modules.stamp
 $(dir_src)/modules.stamp: $(MDDS)
 	echo 'timestamp for *.mdd files' > $@
+.PHONY: headers
 
 FORCE:
+.PHONY: FORCE
 
 # ========== DEPENDENCIES FOR INSTALLING ==========
 
 install: install.bin install.modules
 uninstall: uninstall.bin uninstall.modules
+.PHONY: install uninstall
 
 install.bin: install.bin-here
 uninstall.bin: uninstall.bin-here
 install.modules: install.modules-here
 uninstall.modules: uninstall.modules-here
+.PHONY: install.bin uninstall.bin install.modules uninstall.modules
 
 install.bin-here uninstall.bin-here:
 install.modules-here uninstall.modules-here:
+.PHONY: install.bin-here install.modules-here
 
 # ========== DEPENDENCIES FOR CLEANUP ==========
 
@@ -142,12 +144,15 @@
 
 mostlyclean-here:
 	rm -f *.o *.export *.$(DL_EXT)
+.PHONY: mostlyclean-here
 
 clean-here:
 	rm -f *.o.c *.syms *.pro *.epro *.mdh *.mdhi *.mdhs *.mdh.tmp
+.PHONY: clean-here
 
 distclean-here:
 	rm -f $(makefile) $(makefile).in
+.PHONY: distclean-here
 
 # ========== RECURSIVE MAKES ==========
 
Index: Doc/Makefile.in
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Doc/Makefile.in,v
retrieving revision 1.18
diff -u -r1.18 Makefile.in
--- Doc/Makefile.in	2000/01/02 17:59:10	1.18
+++ Doc/Makefile.in	2000/01/04 20:38:45
@@ -37,10 +37,6 @@
 
 @DEFS_MK@
 
-.PHONY: all everything install uninstall install.man uninstall.man \
-	install.info uninstall.info install.html uninstall.html \
-	clean-here distclean-here realclean-here
-
 MAKEINFO = makeinfo
 TEXI2DVI = texi2dvi
 DVIPS = dvips -D 300
@@ -78,8 +74,10 @@
 # ========== DEPENDENCIES FOR BUILDING ==========
 
 all: $(MAN) zsh.texi ../META-FAQ
+.PHONY: all
 
 everything: all zsh.dvi zsh_us.ps zsh_a4.ps zsh_toc.html
+.PHONY: everything
 
 zsh.dvi: zsh.texi
 	$(TEXI2DVI) $(sdir)/zsh.texi
@@ -212,9 +210,11 @@
 
 # install just installs the manual pages
 install: install.man
+.PHONY: install
 
 # uninstall just unistalls the manual pages
 uninstall: uninstall.man
+.PHONY: uninstall
 
 # install man pages, creating install directory if necessary
 install.man: $(MAN)
@@ -222,6 +222,7 @@
 	for file in $(MAN); do \
 	    $(INSTALL_DATA) $(sdir)/$$file $(DESTDIR)$(mandir)/man1/`echo $$file | sed 's|zsh|$(tzsh)|'` || exit 1; \
 	done
+.PHONY: install.man
 
 # install info pages, creating install directory if necessary
 install.info: zsh.texi
@@ -242,17 +243,20 @@
 	    rm -rf infodir; \
 	    exit 1; \
 	fi
+.PHONY: install.info
 
 # uninstall man pages
 uninstall.man:
 	for file in $(MAN); do \
 	    rm -f $(DESTDIR)$(mandir)/man1/`echo $$file | sed 's|zsh|$(tzsh)|'`; \
 	done
+.PHONY: uninstall.man
 
 # uninstall info pages
 uninstall.info:
 	rm -f $(DESTDIR)$(infodir)/$(tzsh).info
 	rm -f $(DESTDIR)$(infodir)/$(tzsh).info-[1-9]*
+.PHONY: uninstall.info
 
 # install HTML manual
 install.html: zsh_toc.html
@@ -260,10 +264,12 @@
 	for file in zsh_*.html; do \
 	    $(INSTALL_DATA) $$file $(DESTDIR)$(htmldir) || exit 1; \
 	done
+.PHONY: install.html
 
 # uninstall HTML manual
 uninstall.html:
 	rm -f $(DESTDIR)$(htmldir)/zsh_*.html
+.PHONY: uninstall.html
 
 # ========== DEPENDENCIES FOR CLEANUP ==========
 
@@ -272,13 +278,16 @@
 	rm -f *.aux *.cp *.cps *.fn *.fns *.ky *.log
 	rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs
 	rm -rf infodir
+.PHONY: clean-here
 
 distclean-here: clean-here
 	rm -f Makefile
+.PHONY: distclean-here
 
 realclean-here: distclean-here
 	cd $(sdir) && rm -f Zsh/modlist.yo Zsh/modmenu.yo
 	cd $(sdir) && rm -f version.yo ../META-FAQ zsh.texi $(MAN)
+.PHONY: realclean-here
 
 @CLEAN_MK@
 
-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>



Messages sorted by: Reverse Date, Date, Thread, Author