From d511432dfd6974e43b054e98334cf529a42f600b Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 16 Sep 2006 18:57:40 +0000 Subject: Fix include order git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@61 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- Makefile.common | 22 ++++++++++++++-------- converter/other/Makefile | 15 +++++++-------- converter/other/cameratopam/Makefile | 3 ++- converter/other/fiasco/Makefile | 2 +- converter/other/fiasco/codec/Makefile | 2 +- converter/other/fiasco/input/Makefile | 4 ++-- converter/other/fiasco/lib/Makefile | 2 +- converter/other/fiasco/output/Makefile | 7 ++++--- converter/other/jbig/Makefile | 4 ++-- converter/other/jpeg2000/Makefile | 4 ++-- converter/other/jpeg2000/libjasper/Makefile.common | 4 ++-- converter/other/pnmtopalm/Makefile | 4 ++-- converter/ppm/ppmtompeg/Makefile | 5 +++-- lib/Makefile | 4 ++-- lib/util/Makefile | 4 ++-- other/Makefile | 3 ++- other/pamx/Makefile | 3 ++- 17 files changed, 51 insertions(+), 41 deletions(-) diff --git a/Makefile.common b/Makefile.common index 2e5d2833..c31013c6 100644 --- a/Makefile.common +++ b/Makefile.common @@ -52,10 +52,14 @@ # front end, so takes linker options in a different format # LDFLAGS: linker options # LIBS or LOADLIBES: names of libraries to be added to all links -# INCLUDES: Compiler option string to establish the search path for include -# files when compiling things or computing dependencies (make dep). -# current directory, corresponding source tree directory, and ./importinc -# are implied, so should not be in here. +# COMP_INCLUDES: Compiler option string to establish the search path for +# component-specific include files when compiling things or computing +# dependencies (make dep). Header files from this part of the search +# path take precedence over general Netpbm header files and external +# library header files. +# EXTERN_INCLUDES: Like COMP_INCLUDES, but for external libraries, e.g. +# libjpeg. All header files from the Netpbm source tree take precedence +# over these. # In addition, there is CADD, which is extra C compilation flags and # is intended to be set on a make command line (e.g. 'make CADD=-g') @@ -68,8 +72,10 @@ include $(SRCDIR)/Makefile.version +NETPBM_INCLUDES := -I importinc -I$(SRCDIR)/$(SUBDIR) + # -I. is needed when builddir != srcdir -INCLUDES2 := -I. -I importinc -I$(SRCDIR)/$(SUBDIR) $(INCLUDES) +INCLUDES = -I. $(COMP_INCLUDES) $(NETPBM_INCLUDES) $(EXTERN_INCLUDES) ifeq ($(NETPBMLIBTYPE),unixstatic) NETPBMLIBFNAME = libnetpbm.$(STATICLIBSUFFIX) @@ -210,7 +216,7 @@ $(OBJECTS): %.o: %.c importinc # assertion and crash the program if it isn't really true. You can add # -UNDEBUG (in any of various ways) to override this. # - $(CC) -c $(INCLUDES2) -DNDEBUG \ + $(CC) -c $(INCLUDES) -DNDEBUG \ $(CPPFLAGS) $(CFLAGS) $(CFLAGS_PERSONAL) $(CADD) -o $@ $< # libopt is a utility program used in the make file below. @@ -314,7 +320,7 @@ $(PORTBINARIES) $(MATHBINARIES): %: %.o $(NETPBMLIB) $(LIBOPT) %.o2: %.c importinc # Note that the user may have configured -I options into CFLAGS. - $(CC) -c $(INCLUDES2) -DNDEBUG $(CFLAGS) \ + $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) \ "-Dmain=main_$*" \ $(CFLAGS_MERGE) $(CFLAGS_PERSONAL) $(CADD) -o $@ $< @@ -469,7 +475,7 @@ dep: $(SUBDIRS:%=%/dep) importinc # before the first make after a clean. ifneq ($(DEP_SOURCES)x,x) - $(CC) -MM -MG $(INCLUDES2) $(DEP_SOURCES) >Makefile.depend + $(CC) -MM -MG $(INCLUDES) $(DEP_SOURCES) >Makefile.depend endif # Note: if I stack all these subdirectory targets into one rule, I get diff --git a/converter/other/Makefile b/converter/other/Makefile index 4585c45d..6cde424d 100644 --- a/converter/other/Makefile +++ b/converter/other/Makefile @@ -20,10 +20,9 @@ ifneq ($(BUILD_FIASCO), N) SUBDIRS += fiasco endif -INCLUDES = -I$(SRCDIR)/util ifneq ($(TIFFLIB),NONE) ifneq ($(TIFFHDR_DIR)x,x) - INCLUDES += -I$(TIFFHDR_DIR) + EXTERN_INCLUDES += -I$(TIFFHDR_DIR) endif endif @@ -31,30 +30,30 @@ ifeq ($(shell libpng-config --version),) ifneq ($(PNGLIB),NONE) HAVE_PNGLIB = Y ifneq ($(PNGHDR_DIR)x,x) - INCLUDES += -I$(PNGHDR_DIR) + EXTERN_INCLUDES += -I$(PNGHDR_DIR) endif ifneq ($(ZHDR_DIR)x,x) - INCLUDES += -I$(ZHDR_DIR) + EXTERN_INCLUDES += -I$(ZHDR_DIR) endif endif else HAVE_PNGLIB = Y - INCLUDES += $(shell libpng-config --cflags) + EXTERN_INCLUDES += $(shell libpng-config --cflags) endif ifneq ($(JPEGLIB),NONE) ifneq ($(JPEGHDR_DIR)x,x) - INCLUDES += -I$(JPEGHDR_DIR) + EXTERN_INCLUDES += -I$(JPEGHDR_DIR) endif endif ifneq ($(URTLIB),NONE) ifneq ($(URTHDR_DIR)x,x) - INCLUDES += -I$(URTHDR_DIR) + EXTERN_INCLUDES += -I$(URTHDR_DIR) endif endif ifneq ($(XML2_LIBS),NONE) ifneq ($(XML2_CFLAGS),NONE) - INCLUDES += $(XML2_CFLAGS) + EXTERN_INCLUDES += $(XML2_CFLAGS) endif endif diff --git a/converter/other/cameratopam/Makefile b/converter/other/cameratopam/Makefile index c50c9176..178b4fff 100644 --- a/converter/other/cameratopam/Makefile +++ b/converter/other/cameratopam/Makefile @@ -5,9 +5,10 @@ endif SUBDIR = converter/other/cameratopam VPATH=.:$(SRCDIR)/$(SUBDIR) +EXTERN_INCLUDES = ifneq ($(JPEGLIB),NONE) ifneq ($(JPEGHDR_DIR)x,x) - INCLUDES += -I$(JPEGHDR_DIR) + EXTERN_INCLUDES += -I$(JPEGHDR_DIR) CFLAGS += -DHAVE_JPEG endif endif diff --git a/converter/other/fiasco/Makefile b/converter/other/fiasco/Makefile index 0dd945ed..0330802c 100644 --- a/converter/other/fiasco/Makefile +++ b/converter/other/fiasco/Makefile @@ -7,7 +7,7 @@ VPATH=.:$(SRCDIR)/$(SUBDIR) include $(BUILDDIR)/Makefile.config -INCLUDES = \ +COMP_INCLUDES = \ -I$(SRCDIR)/$(SUBDIR)/codec -I$(SRCDIR)/$(SUBDIR)/input \ -I$(SRCDIR)/$(SUBDIR)/output -I$(SRCDIR)/$(SUBDIR)/lib \ diff --git a/converter/other/fiasco/codec/Makefile b/converter/other/fiasco/codec/Makefile index 9a9d502a..c5f94c28 100644 --- a/converter/other/fiasco/codec/Makefile +++ b/converter/other/fiasco/codec/Makefile @@ -8,7 +8,7 @@ VPATH=.:$(SRCDIR)/$(SUBDIR) include $(BUILDDIR)/Makefile.config -INCLUDES = -I$(SRCDIR)/$(FIASCOSUBDIR) -I$(SRCDIR)/$(FIASCOSUBDIR)/lib \ +COMP_INCLUDES = -I$(SRCDIR)/$(FIASCOSUBDIR) -I$(SRCDIR)/$(FIASCOSUBDIR)/lib \ -I$(SRCDIR)/$(FIASCOSUBDIR)/input -I$(SRCDIR)/$(FIASCOSUBDIR)/output OBJECTS = approx.o bintree.o coder.o coeff.o \ diff --git a/converter/other/fiasco/input/Makefile b/converter/other/fiasco/input/Makefile index c01af772..6cd8e34b 100644 --- a/converter/other/fiasco/input/Makefile +++ b/converter/other/fiasco/input/Makefile @@ -13,8 +13,8 @@ OBJECTS = basis.o matrices.o mc.o nd.o read.o tree.o weights.o MERGE_OBJECTS = $(OBJECTS) -INCLUDES = -I$(SRCDIR)/$(FIASCOSUBDIR) -I$(SRCDIR)/$(FIASCOSUBDIR)/lib \ - -I$(SRCDIR)/$(FIASCOSUBDIR)/codec +COMP_INCLUDES = -I$(SRCDIR)/$(FIASCOSUBDIR) -I$(SRCDIR)/$(FIASCOSUBDIR)/lib \ + -I$(SRCDIR)/$(FIASCOSUBDIR)/codec all: libfiasco_input.a diff --git a/converter/other/fiasco/lib/Makefile b/converter/other/fiasco/lib/Makefile index 99d7c1d7..bd129016 100644 --- a/converter/other/fiasco/lib/Makefile +++ b/converter/other/fiasco/lib/Makefile @@ -21,7 +21,7 @@ OBJECTS = \ MERGE_OBJECTS = $(OBJECTS) -INCLUDES = -I$(SRCDIR)/$(FIASCOSUBDIR) +COMP_INCLUDES = -I$(SRCDIR)/$(FIASCOSUBDIR) all: libfiasco_lib.a diff --git a/converter/other/fiasco/output/Makefile b/converter/other/fiasco/output/Makefile index 3bdc4635..fc1d4155 100644 --- a/converter/other/fiasco/output/Makefile +++ b/converter/other/fiasco/output/Makefile @@ -12,9 +12,10 @@ OBJECTS = matrices.o mc.o nd.o tree.o weights.o write.o MERGE_OBJECTS = $(OBJECTS) -INCLUDES = -I$(SRCDIR)/$(FIASCOSUBDIR) \ - -I$(SRCDIR)/$(FIASCOSUBDIR)/lib \ - -I$(SRCDIR)/$(FIASCOSUBDIR)/codec +COMP_INCLUDES = \ + -I$(SRCDIR)/$(FIASCOSUBDIR) \ + -I$(SRCDIR)/$(FIASCOSUBDIR)/lib \ + -I$(SRCDIR)/$(FIASCOSUBDIR)/codec all: libfiasco_output.a diff --git a/converter/other/jbig/Makefile b/converter/other/jbig/Makefile index ca98ef29..4be21582 100644 --- a/converter/other/jbig/Makefile +++ b/converter/other/jbig/Makefile @@ -9,9 +9,9 @@ include $(BUILDDIR)/Makefile.config LIBJBIG_OBJECTS = jbig.o jbig_tab.o -INCLUDES = +EXTERN_INCLUDES = ifneq ($(JBIGHDR_DIR),NONE) - INCLUDES += -I$(JBIGHDR_DIR) + EXTERN_INCLUDES += -I$(JBIGHDR_DIR) endif ifneq ($(JBIGHDR_DIR),NONE) diff --git a/converter/other/jpeg2000/Makefile b/converter/other/jpeg2000/Makefile index 70cfafb7..c5e74361 100644 --- a/converter/other/jpeg2000/Makefile +++ b/converter/other/jpeg2000/Makefile @@ -9,9 +9,9 @@ SUBDIRS = libjasper include $(BUILDDIR)/Makefile.config -INCLUDES = +EXTERN_INCLUDES = ifneq ($(JASPERHDR_DIR),NONE) - INCLUDES += -I$(JASPERHDR_DIR) + EXTERN_INCLUDES += -I$(JASPERHDR_DIR) endif diff --git a/converter/other/jpeg2000/libjasper/Makefile.common b/converter/other/jpeg2000/libjasper/Makefile.common index 71a11832..84781769 100644 --- a/converter/other/jpeg2000/libjasper/Makefile.common +++ b/converter/other/jpeg2000/libjasper/Makefile.common @@ -17,10 +17,10 @@ $(SUBDIRS:%=%/partlist): %/partlist: $(CURDIR)/% $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \ SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) $(notdir $@) -INCLUDES = -I$(JASPERSRCDIR)/include -I$(JASPERSRCDIR)/importinc - include $(SRCDIR)/Makefile.common +INCLUDES = -I$(JASPERSRCDIR)/include -I$(JASPERSRCDIR)/importinc + DEFS = -DHAVE_LIBM=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STDDEF_H=1 -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_MIF_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT -DEXCLUDE_PNM_SUPPORT $(LIB_OBJECTS):%.o:%.c diff --git a/converter/other/pnmtopalm/Makefile b/converter/other/pnmtopalm/Makefile index 2a76297e..d7bf2829 100644 --- a/converter/other/pnmtopalm/Makefile +++ b/converter/other/pnmtopalm/Makefile @@ -24,8 +24,8 @@ $(BINARIES): %: %.o palmcolormap.o $(NETPBMLIB) $(LIBOPT) $(LD) $(LDFLAGS) -o $@ $< palmcolormap.o $(LIBOPTS) \ $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD) -gen_palm_colormap : $(SUBDIR)/gen_palm_colormap.c palmcolormap.o - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $< palmcolormap.o \ +gen_palm_colormap : % : %.c palmcolormap.o + $(CC) -I importinc $(CFLAGS) $(LDFLAGS) -o $@ $< palmcolormap.o \ $(LIBOPTS) $(MATHLIB) $(LDLIBS) $(LADD) diff --git a/converter/ppm/ppmtompeg/Makefile b/converter/ppm/ppmtompeg/Makefile index 5e923fee..6db72ea9 100644 --- a/converter/ppm/ppmtompeg/Makefile +++ b/converter/ppm/ppmtompeg/Makefile @@ -18,11 +18,12 @@ else JPEGLIBX = $(JPEGLIB) endif -INCLUDES = -I$(SRCDIR)/$(SUBDIR)/headers +COMP_INCLUDES = -I$(SRCDIR)/$(SUBDIR)/headers +EXTERN_INCLUDES = ifneq ($(JPEGHDR_DIR),NONE) ifneq ($(JPEGHDR_DIR)x,x) - INCLUDES += -I$(JPEGHDR_DIR) + EXTERN_INCLUDES += -I$(JPEGHDR_DIR) endif endif diff --git a/lib/Makefile b/lib/Makefile index 87ad860a..704b838a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -55,8 +55,6 @@ DATAFILES = rgb.txt .PHONY: all all: libnetpbm extra_staticlib -INCLUDES = -I$(SRCDIR)/$(SUBDIR) -I. -Iimportinc - SUBDIRS = util SCRIPTS = BINARIES = @@ -64,6 +62,8 @@ BINARIES = OMIT_LIBRARY_RULE = 1 include $(SRCDIR)/Makefile.common +INCLUDES = -I$(SRCDIR)/$(SUBDIR) -I. -Iimportinc + # The following must go after Makefile.common because $(LIBNETPBM) may # contain a reference to $(NETPBM_MAJOR_RELEASE). .PHONY: libnetpbm diff --git a/lib/util/Makefile b/lib/util/Makefile index 4ba60ba2..ffa1db5b 100644 --- a/lib/util/Makefile +++ b/lib/util/Makefile @@ -7,8 +7,6 @@ VPATH=.:$(SRCDIR)/$(SUBDIR) include $(BUILDDIR)/Makefile.config -INCLUDES = -I $(BUILDDIR) -I $(SRCDIR)/$(SUBDIR)/.. - # nstring is required for asprintf(), etc. Also some systems don't have # snprintf(), e.g. Solaris 2.5.1. 2002.03.29. UTILOBJECTS = shhopt.o nstring.o vasprintf.o filename.o @@ -19,6 +17,8 @@ all: $(UTILOBJECTS) include $(SRCDIR)/Makefile.common +INCLUDES = -I $(BUILDDIR) -I $(SRCDIR)/$(SUBDIR)/.. + $(UTILOBJECTS):%.o:%.c importinc $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) $(CFLAGS_SHLIB) \ $(CFLAGS_PERSONAL) $(CADD) -o $@ $< diff --git a/other/Makefile b/other/Makefile index 87f92f96..139527e3 100644 --- a/other/Makefile +++ b/other/Makefile @@ -9,9 +9,10 @@ include $(BUILDDIR)/Makefile.config SUBDIRS = pamx +EXTERN_INCLUDES = ifneq ($(LINUXSVGALIB),NONE) ifneq ($(LINUXSVGAHDR_DIR),) - INCLUDES += -I$(LINUXSVGAHDR_DIR) + EXTERN_INCLUDES += -I$(LINUXSVGAHDR_DIR) endif endif diff --git a/other/pamx/Makefile b/other/pamx/Makefile index a86a3331..8aab2608 100644 --- a/other/pamx/Makefile +++ b/other/pamx/Makefile @@ -7,9 +7,10 @@ VPATH=.:$(SRCDIR)/$(SUBDIR) include $(BUILDDIR)/Makefile.config +EXTERN_INCLUDE = ifneq ($(X11LIB),NONE) ifneq ($(X11HDR_DIR),) - INCLUDES += -I$(X11HDR_DIR) + EXTERN_INCLUDES += -I$(X11HDR_DIR) endif endif -- cgit 1.4.1