Home | History | Annotate | Download | only in decoder
      1 # Makefile for PngMinus (pngm2pnm)
      2 # Linux / Unix
      3 
      4 #CC=cc
      5 CC=gcc
      6 LD=$(CC)
      7 
      8 # If awk fails try
      9 # make AWK=nawk
     10 
     11 # If cpp fails try
     12 # make CPP=/lib/cpp
     13 
     14 RM=rm -f
     15 COPY=cp
     16 
     17 CPPFLAGS=-I. -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
     18 CFLAGS=-O1 -Wall
     19 
     20 C=.c
     21 O=.o
     22 L=.a
     23 E=
     24 
     25 # Where to find the source code:
     26 PNGSRC =../../..
     27 ZLIBSRC=$(PNGSRC)/../zlib
     28 PROGSRC=$(PNGSRC)/contrib/pngminus
     29 
     30 # Zlib (minimal inflate requirements - crc32 is used by libpng)
     31 # zutil can be eliminated if you provide your own zcalloc and zcfree
     32 ZSRCS  = adler32$(C) crc32$(C) \
     33 	 inffast$(C) inflate$(C) inftrees$(C) \
     34 	 zutil$(C)
     35 
     36 # Standard headers
     37 ZH     = zlib.h crc32.h inffast.h inffixed.h \
     38 	 inflate.h inftrees.h zutil.h
     39 
     40 # Machine generated headers
     41 ZCONF  = zconf.h
     42 
     43 # Headers callers use
     44 ZINC   = zlib.h $(ZCONF)
     45 
     46 # Headers the Zlib source uses
     47 ZHDRS  = $(ZH) $(ZCONF)
     48 
     49 ZOBJS  = adler32$(O) crc32$(O) \
     50 	 inffast$(O) inflate$(O) inftrees$(O) \
     51 	 zutil$(O)
     52 
     53 # libpng
     54 PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
     55 	pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
     56 	pngset$(C) pngtrans$(C)
     57 	
     58 # Standard headers
     59 PNGH   =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
     60 
     61 # Machine generated headers
     62 PNGCONF=pnglibconf.h
     63 
     64 # Headers callers use
     65 PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
     66 
     67 # Headers the PNG library uses
     68 PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
     69 
     70 PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
     71 	pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
     72 	pngset$(O) pngtrans$(O)
     73 
     74 PROGSRCS= pngm2pnm$(C)
     75 PROGHDRS=
     76 PROGDOCS=
     77 PROGOBJS= pngm2pnm$(O)
     78 
     79 OBJS    = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
     80 
     81 # implicit make rules -------------------------------------------------------
     82 
     83 # note: dependencies do not work on implicit rule lines
     84 .c$(O):
     85 	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
     86 
     87 # dependencies
     88 
     89 all: pngm2pnm$(E)
     90 
     91 pngm2pnm$(E): $(OBJS)
     92 	$(LD) -o pngm2pnm$(E) $(OBJS)
     93 
     94 # The DFA_XTRA setting turns all libpng options off then
     95 # turns on those required for this minimal build.
     96 # The CPP_FLAGS setting causes pngusr.h to be included in
     97 # both the build of pnglibconf.h and, subsequently, when
     98 # building libpng itself.
     99 $(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
    100 	$(PNGSRC)/scripts/pnglibconf.dfa \
    101 	$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
    102 	$(RM) pnglibconf.h pnglibconf.dfn
    103 	$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
    104 	    srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
    105 	    DFA_XTRA="pngusr.dfa" $@
    106 
    107 clean:
    108 	$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
    109 	    srcdir=$(PNGSRC) clean
    110 	$(RM) pngm2pnm$(O)
    111 	$(RM) pngm2pnm$(E)
    112 	$(RM) $(OBJS)
    113 
    114 # distclean also removes the copied source and headers
    115 distclean: clean
    116 	$(RM) -r scripts # historical reasons
    117 	$(RM) $(PNGSRCS) $(PNGH)
    118 	$(RM) $(ZSRCS) $(ZH) $(ZCONF)
    119 	$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
    120 
    121 # Header file dependencies:
    122 $(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
    123 $(PNGOBJS): $(PNGHDRS) $(ZINC)
    124 $(ZOBJS): $(ZHDRS)
    125 
    126 # Gather the source code from the respective directories
    127 $(PNGSRCS) $(PNGH): $(PNGSRC)/$@
    128 	$(RM) $@
    129 	$(COPY) $(PNGSRC)/$@ $@
    130 
    131 # No dependency on the ZLIBSRC target so that it only needs
    132 # to be specified once.
    133 $(ZSRCS) $(ZH):
    134 	$(RM) $@
    135 	$(COPY) $(ZLIBSRC)/$@ $@
    136 
    137 # The unconfigured zconf.h varies in name according to the
    138 # zlib release
    139 $(ZCONF):
    140 	$(RM) $@
    141 	@for f in zconf.h.in zconf.in.h zconf.h; do\
    142 	    test -r $(ZLIBSRC)/$$f &&\
    143 	    echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
    144 	    $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
    145 	done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
    146 
    147 pngm2pnm.c: $(PROGSRC)/png2pnm.c
    148 	$(RM) $@
    149 	$(COPY) $(PROGSRC)/png2pnm.c $@
    150 
    151 # End of makefile for pngm2pnm
    152