1*a67afe4dSAndroid Build Coastguard Worker# Makefile for PngMinus (pnm2pngm) 2*a67afe4dSAndroid Build Coastguard Worker# Linux / Unix 3*a67afe4dSAndroid Build Coastguard Worker 4*a67afe4dSAndroid Build Coastguard Worker#CC=cc 5*a67afe4dSAndroid Build Coastguard WorkerCC=gcc 6*a67afe4dSAndroid Build Coastguard WorkerLD=$(CC) 7*a67afe4dSAndroid Build Coastguard Worker 8*a67afe4dSAndroid Build Coastguard Worker# If awk fails try 9*a67afe4dSAndroid Build Coastguard Worker# make AWK=nawk 10*a67afe4dSAndroid Build Coastguard Worker 11*a67afe4dSAndroid Build Coastguard Worker# If cpp fails try 12*a67afe4dSAndroid Build Coastguard Worker# make CPP=/lib/cpp 13*a67afe4dSAndroid Build Coastguard Worker 14*a67afe4dSAndroid Build Coastguard WorkerRM=rm -f 15*a67afe4dSAndroid Build Coastguard WorkerCOPY=cp 16*a67afe4dSAndroid Build Coastguard Worker 17*a67afe4dSAndroid Build Coastguard WorkerCPPFLAGS=-I. -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP 18*a67afe4dSAndroid Build Coastguard WorkerCFLAGS=-O1 -Wall 19*a67afe4dSAndroid Build Coastguard Worker 20*a67afe4dSAndroid Build Coastguard WorkerC=.c 21*a67afe4dSAndroid Build Coastguard WorkerO=.o 22*a67afe4dSAndroid Build Coastguard WorkerL=.a 23*a67afe4dSAndroid Build Coastguard WorkerE= 24*a67afe4dSAndroid Build Coastguard Worker 25*a67afe4dSAndroid Build Coastguard Worker# Where to find the source code: 26*a67afe4dSAndroid Build Coastguard WorkerPNGSRC =../../.. 27*a67afe4dSAndroid Build Coastguard WorkerZLIBSRC=$(PNGSRC)/../zlib 28*a67afe4dSAndroid Build Coastguard WorkerPROGSRC=$(PNGSRC)/contrib/pngminus 29*a67afe4dSAndroid Build Coastguard Worker 30*a67afe4dSAndroid Build Coastguard Worker# Zlib 31*a67afe4dSAndroid Build Coastguard WorkerZSRCS = adler32$(C) compress$(C) crc32$(C) deflate$(C) \ 32*a67afe4dSAndroid Build Coastguard Worker trees$(C) zutil$(C) 33*a67afe4dSAndroid Build Coastguard Worker 34*a67afe4dSAndroid Build Coastguard Worker# Standard headers 35*a67afe4dSAndroid Build Coastguard Worker#ZH = zlib.h crc32.h deflate.h trees.h zutil.h 36*a67afe4dSAndroid Build Coastguard WorkerZH = zlib.h crc32.h deflate.h trees.h zutil.h 37*a67afe4dSAndroid Build Coastguard Worker 38*a67afe4dSAndroid Build Coastguard Worker# Machine generated headers 39*a67afe4dSAndroid Build Coastguard WorkerZCONF = zconf.h 40*a67afe4dSAndroid Build Coastguard Worker 41*a67afe4dSAndroid Build Coastguard Worker# Headers callers use 42*a67afe4dSAndroid Build Coastguard WorkerZINC = zlib.h $(ZCONF) 43*a67afe4dSAndroid Build Coastguard Worker 44*a67afe4dSAndroid Build Coastguard Worker# Headers the Zlib source uses 45*a67afe4dSAndroid Build Coastguard WorkerZHDRS = $(ZH) $(ZCONF) 46*a67afe4dSAndroid Build Coastguard Worker 47*a67afe4dSAndroid Build Coastguard Worker# compress is not required; it is needed to link the zlib 48*a67afe4dSAndroid Build Coastguard Worker# code because deflate defines an unused API function deflateBound 49*a67afe4dSAndroid Build Coastguard Worker# which itself calls compressBound from compress. 50*a67afe4dSAndroid Build Coastguard WorkerZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \ 51*a67afe4dSAndroid Build Coastguard Worker trees$(O) zutil$(O) 52*a67afe4dSAndroid Build Coastguard Worker 53*a67afe4dSAndroid Build Coastguard Worker# libpng 54*a67afe4dSAndroid Build Coastguard WorkerPNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \ 55*a67afe4dSAndroid Build Coastguard Worker pngset$(C) pngtrans$(C) pngwio$(C) pngwrite$(C) \ 56*a67afe4dSAndroid Build Coastguard Worker pngwtran$(C) pngwutil$(C) 57*a67afe4dSAndroid Build Coastguard Worker 58*a67afe4dSAndroid Build Coastguard Worker# Standard headers 59*a67afe4dSAndroid Build Coastguard WorkerPNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h 60*a67afe4dSAndroid Build Coastguard Worker 61*a67afe4dSAndroid Build Coastguard Worker# Machine generated headers 62*a67afe4dSAndroid Build Coastguard WorkerPNGCONF=pnglibconf.h 63*a67afe4dSAndroid Build Coastguard Worker 64*a67afe4dSAndroid Build Coastguard Worker# Headers callers use 65*a67afe4dSAndroid Build Coastguard WorkerPNGINC= png.h pngconf.h pngusr.h $(PNGCONF) 66*a67afe4dSAndroid Build Coastguard Worker 67*a67afe4dSAndroid Build Coastguard Worker# Headers the PNG library uses 68*a67afe4dSAndroid Build Coastguard WorkerPNGHDRS=$(PNGH) $(PNGCONF) pngusr.h 69*a67afe4dSAndroid Build Coastguard Worker 70*a67afe4dSAndroid Build Coastguard WorkerPNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ 71*a67afe4dSAndroid Build Coastguard Worker pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \ 72*a67afe4dSAndroid Build Coastguard Worker pngwtran$(O) pngwutil$(O) 73*a67afe4dSAndroid Build Coastguard Worker 74*a67afe4dSAndroid Build Coastguard WorkerPROGSRCS= pnm2pngm$(C) 75*a67afe4dSAndroid Build Coastguard WorkerPROGHDRS= 76*a67afe4dSAndroid Build Coastguard WorkerPROGDOCS= 77*a67afe4dSAndroid Build Coastguard WorkerPROGOBJS= pnm2pngm$(O) 78*a67afe4dSAndroid Build Coastguard Worker 79*a67afe4dSAndroid Build Coastguard WorkerOBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS) 80*a67afe4dSAndroid Build Coastguard Worker 81*a67afe4dSAndroid Build Coastguard Worker# implicit make rules ------------------------------------------------------- 82*a67afe4dSAndroid Build Coastguard Worker 83*a67afe4dSAndroid Build Coastguard Worker.c$(O): 84*a67afe4dSAndroid Build Coastguard Worker $(CC) -c $(CPPFLAGS) $(CFLAGS) $< 85*a67afe4dSAndroid Build Coastguard Worker 86*a67afe4dSAndroid Build Coastguard Worker# dependencies 87*a67afe4dSAndroid Build Coastguard Worker 88*a67afe4dSAndroid Build Coastguard Workerall: pnm2pngm$(E) 89*a67afe4dSAndroid Build Coastguard Worker 90*a67afe4dSAndroid Build Coastguard Workerpnm2pngm$(E): $(OBJS) 91*a67afe4dSAndroid Build Coastguard Worker $(LD) -o pnm2pngm$(E) $(OBJS) 92*a67afe4dSAndroid Build Coastguard Worker 93*a67afe4dSAndroid Build Coastguard Worker# The DFA_XTRA setting turns all libpng options off then 94*a67afe4dSAndroid Build Coastguard Worker# turns on those required for this minimal build. 95*a67afe4dSAndroid Build Coastguard Worker# The CPP_FLAGS setting causes pngusr.h to be included in 96*a67afe4dSAndroid Build Coastguard Worker# both the build of pnglibconf.h and, subsequently, when 97*a67afe4dSAndroid Build Coastguard Worker# building libpng itself. 98*a67afe4dSAndroid Build Coastguard Worker$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\ 99*a67afe4dSAndroid Build Coastguard Worker $(PNGSRC)/scripts/pnglibconf.dfa \ 100*a67afe4dSAndroid Build Coastguard Worker $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa 101*a67afe4dSAndroid Build Coastguard Worker $(RM) pnglibconf.h pnglibconf.dfn 102*a67afe4dSAndroid Build Coastguard Worker $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\ 103*a67afe4dSAndroid Build Coastguard Worker srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\ 104*a67afe4dSAndroid Build Coastguard Worker DFA_XTRA="pngusr.dfa" $@ 105*a67afe4dSAndroid Build Coastguard Worker 106*a67afe4dSAndroid Build Coastguard Workerclean: 107*a67afe4dSAndroid Build Coastguard Worker $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\ 108*a67afe4dSAndroid Build Coastguard Worker srcdir=$(PNGSRC) clean 109*a67afe4dSAndroid Build Coastguard Worker $(RM) pnm2pngm$(O) 110*a67afe4dSAndroid Build Coastguard Worker $(RM) pnm2pngm$(E) 111*a67afe4dSAndroid Build Coastguard Worker $(RM) $(OBJS) 112*a67afe4dSAndroid Build Coastguard Worker 113*a67afe4dSAndroid Build Coastguard Worker# distclean also removes the copied source and headers 114*a67afe4dSAndroid Build Coastguard Workerdistclean: clean 115*a67afe4dSAndroid Build Coastguard Worker $(RM) -r scripts # historical reasons 116*a67afe4dSAndroid Build Coastguard Worker $(RM) $(PNGSRCS) $(PNGH) 117*a67afe4dSAndroid Build Coastguard Worker $(RM) $(ZSRCS) $(ZH) $(ZCONF) 118*a67afe4dSAndroid Build Coastguard Worker $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS) 119*a67afe4dSAndroid Build Coastguard Worker 120*a67afe4dSAndroid Build Coastguard Worker# Header file dependencies: 121*a67afe4dSAndroid Build Coastguard Worker$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC) 122*a67afe4dSAndroid Build Coastguard Worker$(PNGOBJS): $(PNGHDRS) $(ZINC) 123*a67afe4dSAndroid Build Coastguard Worker$(ZOBJS): $(ZHDRS) 124*a67afe4dSAndroid Build Coastguard Worker 125*a67afe4dSAndroid Build Coastguard Worker# Gather the source code from the respective directories 126*a67afe4dSAndroid Build Coastguard Worker$(PNGSRCS) $(PNGH): $(PNGSRC)/$@ 127*a67afe4dSAndroid Build Coastguard Worker $(RM) $@ 128*a67afe4dSAndroid Build Coastguard Worker $(COPY) $(PNGSRC)/$@ $@ 129*a67afe4dSAndroid Build Coastguard Worker 130*a67afe4dSAndroid Build Coastguard Worker# No dependency on the ZLIBSRC target so that it only needs 131*a67afe4dSAndroid Build Coastguard Worker# to be specified once. 132*a67afe4dSAndroid Build Coastguard Worker$(ZSRCS) $(ZH): 133*a67afe4dSAndroid Build Coastguard Worker $(RM) $@ 134*a67afe4dSAndroid Build Coastguard Worker $(COPY) $(ZLIBSRC)/$@ $@ 135*a67afe4dSAndroid Build Coastguard Worker 136*a67afe4dSAndroid Build Coastguard Worker# The unconfigured zconf.h varies in name according to the 137*a67afe4dSAndroid Build Coastguard Worker# zlib release 138*a67afe4dSAndroid Build Coastguard Worker$(ZCONF): 139*a67afe4dSAndroid Build Coastguard Worker $(RM) $@ 140*a67afe4dSAndroid Build Coastguard Worker @for f in zconf.h.in zconf.in.h zconf.h; do\ 141*a67afe4dSAndroid Build Coastguard Worker test -r $(ZLIBSRC)/$$f &&\ 142*a67afe4dSAndroid Build Coastguard Worker echo $(COPY) $(ZLIBSRC)/$$f $@ &&\ 143*a67afe4dSAndroid Build Coastguard Worker $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\ 144*a67afe4dSAndroid Build Coastguard Worker done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1 145*a67afe4dSAndroid Build Coastguard Worker 146*a67afe4dSAndroid Build Coastguard Workerpnm2pngm.c: $(PROGSRC)/pnm2png.c 147*a67afe4dSAndroid Build Coastguard Worker $(RM) $@ 148*a67afe4dSAndroid Build Coastguard Worker $(COPY) $(PROGSRC)/pnm2png.c $@ 149*a67afe4dSAndroid Build Coastguard Worker 150*a67afe4dSAndroid Build Coastguard Worker# End of makefile for pnm2pngm 151