about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile28
-rw-r--r--Makefile.common6
-rw-r--r--lib/Makefile2
3 files changed, 21 insertions, 15 deletions
diff --git a/GNUmakefile b/GNUmakefile
index a65ac0d4..0103aa9f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -106,10 +106,8 @@ $(TYPEGEN) $(ENDIANGEN): $(BUILDDIR)/buildtools
 	$(MAKE) -C $(dir $@) -f $(SRCDIR)/buildtools/Makefile \
 	    SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) $(notdir $@) 
 
-DELETEIT = (rm -f $@ || false)
-
 inttypes_netpbm.h: $(TYPEGEN)
-	$(TYPEGEN) >$@ || $(DELETEIT)
+	$(TYPEGEN) >$@
 
 # We run a couple of programs on the build machine in computing the
 # contents of pm_config.h.  We need to give the user a way not to do
@@ -119,27 +117,29 @@ inttypes_netpbm.h: $(TYPEGEN)
 pm_config.h: \
   $(SRCDIR)/pm_config.in.h Makefile.config inttypes_netpbm.h \
   $(ENDIANGEN)
-	echo '/* pm_config.h GENERATED BY A MAKE RULE */' >$@ || $(DELETEIT)
-	echo '#ifndef PM_CONFIG_H' >>$@ || $(DELETEIT)
-	echo '#define PM_CONFIG_H' >>$@ || $(DELETEIT)
+# Note that this rule depends on the effect of the .DELETE_ON_ERROR
+# target we get from Makefile.common
+	echo '/* pm_config.h GENERATED BY A MAKE RULE */' >$@
+	echo '#ifndef PM_CONFIG_H' >>$@
+	echo '#define PM_CONFIG_H' >>$@
 ifeq ($(INTTYPES_H)x,x)
 	echo '/* Don't need to #include any inttypes.h-type thing */
 else
   ifeq ($(INTTYPES_H),"inttypes_netpbm.h")
-	cat inttypes_netpbm.h >>$@ || $(DELETEIT)
+	cat inttypes_netpbm.h >>$@
   else
-	echo '#include $(INTTYPES_H)' >>$@ || $(DELETEIT)
+	echo '#include $(INTTYPES_H)' >>$@
   endif
 endif
 ifeq ($(HAVE_INT64),Y)
-	echo "#define HAVE_INT64 1" >>$@ || $(DELETEIT)
+	echo "#define HAVE_INT64 1" >>$@
 else
-	echo "#define HAVE_INT64 0" >>$@ || $(DELETEIT)
+	echo "#define HAVE_INT64 0" >>$@
 endif	
-	echo '/* pm_config.h.in FOLLOWS ... */' >>$@ || $(DELETEIT)
-	cat $(SRCDIR)/pm_config.in.h >>$@ || $(DELETEIT)
-	$(ENDIANGEN) >>$@ || $(DELETEIT)
-	echo '#endif' >>$@ || $(DELETEIT)
+	echo '/* pm_config.h.in FOLLOWS ... */' >>$@
+	cat $(SRCDIR)/pm_config.in.h >>$@
+	$(ENDIANGEN) >>$@
+	echo '#endif' >>$@
 
 
 MAJOR := $(NETPBM_MAJOR_RELEASE)
diff --git a/Makefile.common b/Makefile.common
index ed9f2066..16bb58ef 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -72,6 +72,12 @@
 
 include $(SRCDIR)/Makefile.version
 
+# .DELETE_ON_ERROR is a special predefined Make target that says to delete
+# the target if a command in the rule for it fails.  That's important,
+# because we don't want a half-made target sitting around looking like it's
+# fully made.
+.DELETE_ON_ERROR:
+
 NETPBM_INCLUDES := -I importinc -I$(SRCDIR)/$(SUBDIR)
 
 # -I. is needed when builddir != srcdir
diff --git a/lib/Makefile b/lib/Makefile
index 0f333c2b..69b3b1d0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -183,7 +183,7 @@ endif
 # ship a pre-made standardppmfont.c, so this rule will not normally be
 # used.
 standardppmdfont.c:standard.ppmdfont
-	ppmdcfont <$< >$@ || (rm $@ && false)
+	ppmdcfont <$< >$@
 
 # Note that we create a new compile.h only for the first make after a
 # make clean.  This is good enough.  We used to do stamp-date for