about summary refs log tree commit diff
path: root/GNUmakefile
diff options
context:
space:
mode:
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile97
1 files changed, 52 insertions, 45 deletions
diff --git a/GNUmakefile b/GNUmakefile
index a1484786..c1c2d0a3 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,6 +1,6 @@
 # Makefile for Netpbm
  
-# Configuration should normally be done in the included file Makefile.config.
+# Configuration should normally be done in the included file config.mk.
 
 # Targets in this file:
 #
@@ -9,7 +9,7 @@
 #   package:      Make a package of Netpbm files ready to install
 #   
 #   The default target is either "merge" or "nonmerge", as determined by
-#   the DEFAULT_TARGET variable set by Makefile.config.
+#   the DEFAULT_TARGET variable set by config.mk.
 
 # About the "merge" target: Normally the Makefiles build separate
 # executables for each program.  However, on some systems (especially
@@ -27,7 +27,7 @@
 # 2949K to 1663K.
 
 # To build a "merge" system, just set DEFAULT_TARGET to "merge" instead
-# of "nomerge" in Makefile.config.  In that case, you should probably also
+# of "nomerge" in config.mk.  In that case, you should probably also
 # set NETPBMLIBTYPE to "unixstatic", since a shared library doesn't do you 
 # much good.
 
@@ -48,16 +48,17 @@ all package install:
 	@echo "You can get a current GNU Make via http://www.gnu.org/software"
 	@echo 
 	@echo "If upgrading is impossible, try modifying GNUMakefile and "
-	@echo "Makefile.common to replace \$(CURDIR) with \$(shell /bin/pwd) "
+	@echo "common.mk to replace \$(CURDIR) with \$(shell /bin/pwd) "
 else
 
 
-include Makefile.srcdir
+# srcdir.mk defines SRCDIR .
+include srcdir.mk
 BUILDDIR = $(CURDIR)
 SUBDIR = 
 VPATH=.:$(SRCDIR)
 
-include $(BUILDDIR)/Makefile.config
+include $(BUILDDIR)/config.mk
 
 PROG_SUBDIRS = converter analyzer editor generator other
 PRODUCT_SUBDIRS = lib $(PROG_SUBDIRS)
@@ -103,10 +104,10 @@ $(PROG_SUBDIRS:%=%/all): lib/all $(SUPPORT_SUBDIRS:%=%/all)
 OMIT_CONFIG_RULE = 1
 OMIT_VERSION_H_RULE = 1
 OMIT_INTTYPES_RULE = 1
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
 
-$(BUILDDIR)/Makefile.config: $(SRCDIR)/Makefile.config.in
-	$(SRCDIR)/configure $(SRCDIR)/Makefile.config.in
+$(BUILDDIR)/config.mk: $(SRCDIR)/config.mk.in
+	$(SRCDIR)/configure $(SRCDIR)/config.mk.in
 
 
 # typegen is a utility program used by the make file below.
@@ -119,10 +120,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
@@ -130,38 +129,41 @@ inttypes_netpbm.h: $(TYPEGEN)
 # cross compiling.
 
 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)
+  $(SRCDIR)/pm_config.in.h config.mk inttypes_netpbm.h \
+  $(ENDIANGEN)
+# Note that this rule depends on the effect of the .DELETE_ON_ERROR
+# target we get from common.mk
+	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 '/* Dont 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)
 MINOR := $(NETPBM_MINOR_RELEASE)
 POINT := $(NETPBM_POINT_RELEASE)
-version.h:
+version.h: $(SRCDIR)/version.mk
 	@rm -f $@
-	@echo "/* Generated by make file rule */" >$@
+	@echo "/* Generated by make file rule */" >>$@
 	@echo "#define NETPBM_VERSION" \
-	  \"Netpbm $(MAJOR).$(MINOR).$(POINT)"\"" >$@
+	  \"Netpbm $(MAJOR).$(MINOR).$(POINT)"\"" >>$@
 
 
 .PHONY: install
@@ -186,7 +188,7 @@ package: build_complete package_build advise_installnetpbm
 
 build_complete:
 # The regular build creates this file as its last act, so if it doesn't exist,
-# that means either the user skipping the build step, or the build failed.
+# that means either the user skipped the build step, or the build failed.
 	@echo "You must build Netpbm before you can package Netpbm. "
 	@echo "The usual way to do this is to type 'make' with no arguments."
 	@echo "If you did that, then the build apparently failed.  There "
@@ -265,10 +267,10 @@ ifneq ($(X11LIB),NONE)
   MERGELIBS += $(X11LIB)
 endif
 
-ifeq ($(shell libpng-config --version),)
+ifeq ($(shell libpng$(PNGVER)-config --version),)
   PNGLD = $(shell $(LIBOPT) $(LIBOPTR) $(PNGLIB) $(ZLIB))
 else
-  PNGLD = $(shell libpng-config --ldflags)
+  PNGLD = $(shell libpng$(PNGVER)-config --ldflags)
 endif
 
 ifeq ($(shell xml2-config --version),)
@@ -342,9 +344,9 @@ install.lib:
 endif
 
 .PHONY: install.manweb
-install.manweb: $(PKGDIR)/man/web/netpbm.url $(PKGDIR)/bin/doc.url
+install.manweb: $(PKGDIR)/$(PKGMANDIR)/web/netpbm.url $(PKGDIR)/bin/doc.url
 
-$(PKGDIR)/man/web/netpbm.url: $(PKGDIR)/man/web
+$(PKGDIR)/$(PKGMANDIR)/web/netpbm.url: $(PKGDIR)/$(PKGMANDIR)/web
 	echo "$(NETPBM_DOCURL)" > $@
 	chmod $(INSTALL_PERM_MAN) $@
 
@@ -360,11 +362,14 @@ $(PKGDIR)/bin/doc.url: $(PKGDIR)/bin
 install-dev: install.hdr install.staticlib install.lib install.sharedlibstub
 
 .PHONY: install.hdr
-install.hdr: $(PKGDIR)/include
-	$(MAKE) -C lib -f $(SRCDIR)/lib/Makefile \
-	    SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) install.hdr
+install.hdr: lib/install.hdr $(PKGDIR)/include/netpbm
 	$(INSTALL) -c -m $(INSTALL_PERM_HDR) \
-	    $(BUILDDIR)/pm_config.h $(PKGDIR)/include
+	    $(BUILDDIR)/pm_config.h $(PKGDIR)/include/netpbm
+
+.PHONY: lib/install.hdr
+lib/install.hdr:
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/Makefile \
+	    SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) $(notdir $@)
 
 ifeq ($(STATICLIB_TOO),y)
 BUILD_STATIC = y
@@ -388,27 +393,29 @@ install.sharedlibstub:
 	$(MAKE) -C lib -f $(SRCDIR)/lib/Makefile \
 	    SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) install.sharedlibstub 
 
-# Make the 'deb' target after making 'package'.  It generates a .deb
-# file in the current directory.
-.PHONY: deb
-deb:
-	buildtools/debian/mkdeb --buildtools=buildtools --pkgdir=$(PKGDIR)
-
 clean: localclean
 
 .PHONY: localclean
 localclean:
 	rm -f netpbm build_started build_complete
 	rm -f pm_config.h inttypes_netpbm.h version.h
-	rm -f *.deb
 
-# Note that removing Makefile.config must be the last thing we do,
+# Note that removing config.mk must be the last thing we do,
 # because no other makes will work after that is done.
 distclean: localdistclean
 .PHONY: localdistclean
 localdistclean: localclean
 	-rm -f `find -type l`
-	-rm -f Makefile.config
+	-rm -f TAGS
+	-rm -f config.mk
+
+# 'tags' generates/updates an Emacs tags file, anmed TAGS, in the current
+# directory.  Use with Emacs command 'find-tag'.
+
+.PHONY: tags
+tags:
+	find . -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" | \
+	  etags -
 
 # The following endif is for the else block that contains virtually the
 # whole file, for the test of the existence of CURDIR.