xref: /aosp_15_r20/external/libpng/contrib/pngminim/decoder/makefile (revision a67afe4df73cf47866eedc69947994b8ff839aba)
1*a67afe4dSAndroid Build Coastguard Worker# Makefile for PngMinus (pngm2pnm)
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 (minimal inflate requirements - crc32 is used by libpng)
31*a67afe4dSAndroid Build Coastguard Worker# zutil can be eliminated if you provide your own zcalloc and zcfree
32*a67afe4dSAndroid Build Coastguard WorkerZSRCS  = adler32$(C) crc32$(C) \
33*a67afe4dSAndroid Build Coastguard Worker	 inffast$(C) inflate$(C) inftrees$(C) \
34*a67afe4dSAndroid Build Coastguard Worker	 zutil$(C)
35*a67afe4dSAndroid Build Coastguard Worker
36*a67afe4dSAndroid Build Coastguard Worker# Standard headers
37*a67afe4dSAndroid Build Coastguard WorkerZH     = zlib.h crc32.h inffast.h inffixed.h \
38*a67afe4dSAndroid Build Coastguard Worker	 inflate.h inftrees.h zutil.h
39*a67afe4dSAndroid Build Coastguard Worker
40*a67afe4dSAndroid Build Coastguard Worker# Machine generated headers
41*a67afe4dSAndroid Build Coastguard WorkerZCONF  = zconf.h
42*a67afe4dSAndroid Build Coastguard Worker
43*a67afe4dSAndroid Build Coastguard Worker# Headers callers use
44*a67afe4dSAndroid Build Coastguard WorkerZINC   = zlib.h $(ZCONF)
45*a67afe4dSAndroid Build Coastguard Worker
46*a67afe4dSAndroid Build Coastguard Worker# Headers the Zlib source uses
47*a67afe4dSAndroid Build Coastguard WorkerZHDRS  = $(ZH) $(ZCONF)
48*a67afe4dSAndroid Build Coastguard Worker
49*a67afe4dSAndroid Build Coastguard WorkerZOBJS  = adler32$(O) crc32$(O) \
50*a67afe4dSAndroid Build Coastguard Worker	 inffast$(O) inflate$(O) inftrees$(O) \
51*a67afe4dSAndroid Build Coastguard Worker	 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	pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
56*a67afe4dSAndroid Build Coastguard Worker	pngset$(C) pngtrans$(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	pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
72*a67afe4dSAndroid Build Coastguard Worker	pngset$(O) pngtrans$(O)
73*a67afe4dSAndroid Build Coastguard Worker
74*a67afe4dSAndroid Build Coastguard WorkerPROGSRCS= pngm2pnm$(C)
75*a67afe4dSAndroid Build Coastguard WorkerPROGHDRS=
76*a67afe4dSAndroid Build Coastguard WorkerPROGDOCS=
77*a67afe4dSAndroid Build Coastguard WorkerPROGOBJS= pngm2pnm$(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# note: dependencies do not work on implicit rule lines
84*a67afe4dSAndroid Build Coastguard Worker.c$(O):
85*a67afe4dSAndroid Build Coastguard Worker	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
86*a67afe4dSAndroid Build Coastguard Worker
87*a67afe4dSAndroid Build Coastguard Worker# dependencies
88*a67afe4dSAndroid Build Coastguard Worker
89*a67afe4dSAndroid Build Coastguard Workerall: pngm2pnm$(E)
90*a67afe4dSAndroid Build Coastguard Worker
91*a67afe4dSAndroid Build Coastguard Workerpngm2pnm$(E): $(OBJS)
92*a67afe4dSAndroid Build Coastguard Worker	$(LD) -o pngm2pnm$(E) $(OBJS)
93*a67afe4dSAndroid Build Coastguard Worker
94*a67afe4dSAndroid Build Coastguard Worker# The DFA_XTRA setting turns all libpng options off then
95*a67afe4dSAndroid Build Coastguard Worker# turns on those required for this minimal build.
96*a67afe4dSAndroid Build Coastguard Worker# The CPP_FLAGS setting causes pngusr.h to be included in
97*a67afe4dSAndroid Build Coastguard Worker# both the build of pnglibconf.h and, subsequently, when
98*a67afe4dSAndroid Build Coastguard Worker# building libpng itself.
99*a67afe4dSAndroid Build Coastguard Worker$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
100*a67afe4dSAndroid Build Coastguard Worker	$(PNGSRC)/scripts/pnglibconf.dfa \
101*a67afe4dSAndroid Build Coastguard Worker	$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
102*a67afe4dSAndroid Build Coastguard Worker	$(RM) pnglibconf.h pnglibconf.dfn
103*a67afe4dSAndroid Build Coastguard Worker	$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
104*a67afe4dSAndroid Build Coastguard Worker	    srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
105*a67afe4dSAndroid Build Coastguard Worker	    DFA_XTRA="pngusr.dfa" $@
106*a67afe4dSAndroid Build Coastguard Worker
107*a67afe4dSAndroid Build Coastguard Workerclean:
108*a67afe4dSAndroid Build Coastguard Worker	$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
109*a67afe4dSAndroid Build Coastguard Worker	    srcdir=$(PNGSRC) clean
110*a67afe4dSAndroid Build Coastguard Worker	$(RM) pngm2pnm$(O)
111*a67afe4dSAndroid Build Coastguard Worker	$(RM) pngm2pnm$(E)
112*a67afe4dSAndroid Build Coastguard Worker	$(RM) $(OBJS)
113*a67afe4dSAndroid Build Coastguard Worker
114*a67afe4dSAndroid Build Coastguard Worker# distclean also removes the copied source and headers
115*a67afe4dSAndroid Build Coastguard Workerdistclean: clean
116*a67afe4dSAndroid Build Coastguard Worker	$(RM) -r scripts # historical reasons
117*a67afe4dSAndroid Build Coastguard Worker	$(RM) $(PNGSRCS) $(PNGH)
118*a67afe4dSAndroid Build Coastguard Worker	$(RM) $(ZSRCS) $(ZH) $(ZCONF)
119*a67afe4dSAndroid Build Coastguard Worker	$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
120*a67afe4dSAndroid Build Coastguard Worker
121*a67afe4dSAndroid Build Coastguard Worker# Header file dependencies:
122*a67afe4dSAndroid Build Coastguard Worker$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
123*a67afe4dSAndroid Build Coastguard Worker$(PNGOBJS): $(PNGHDRS) $(ZINC)
124*a67afe4dSAndroid Build Coastguard Worker$(ZOBJS): $(ZHDRS)
125*a67afe4dSAndroid Build Coastguard Worker
126*a67afe4dSAndroid Build Coastguard Worker# Gather the source code from the respective directories
127*a67afe4dSAndroid Build Coastguard Worker$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
128*a67afe4dSAndroid Build Coastguard Worker	$(RM) $@
129*a67afe4dSAndroid Build Coastguard Worker	$(COPY) $(PNGSRC)/$@ $@
130*a67afe4dSAndroid Build Coastguard Worker
131*a67afe4dSAndroid Build Coastguard Worker# No dependency on the ZLIBSRC target so that it only needs
132*a67afe4dSAndroid Build Coastguard Worker# to be specified once.
133*a67afe4dSAndroid Build Coastguard Worker$(ZSRCS) $(ZH):
134*a67afe4dSAndroid Build Coastguard Worker	$(RM) $@
135*a67afe4dSAndroid Build Coastguard Worker	$(COPY) $(ZLIBSRC)/$@ $@
136*a67afe4dSAndroid Build Coastguard Worker
137*a67afe4dSAndroid Build Coastguard Worker# The unconfigured zconf.h varies in name according to the
138*a67afe4dSAndroid Build Coastguard Worker# zlib release
139*a67afe4dSAndroid Build Coastguard Worker$(ZCONF):
140*a67afe4dSAndroid Build Coastguard Worker	$(RM) $@
141*a67afe4dSAndroid Build Coastguard Worker	@for f in zconf.h.in zconf.in.h zconf.h; do\
142*a67afe4dSAndroid Build Coastguard Worker	    test -r $(ZLIBSRC)/$$f &&\
143*a67afe4dSAndroid Build Coastguard Worker	    echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
144*a67afe4dSAndroid Build Coastguard Worker	    $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
145*a67afe4dSAndroid Build Coastguard Worker	done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
146*a67afe4dSAndroid Build Coastguard Worker
147*a67afe4dSAndroid Build Coastguard Workerpngm2pnm.c: $(PROGSRC)/png2pnm.c
148*a67afe4dSAndroid Build Coastguard Worker	$(RM) $@
149*a67afe4dSAndroid Build Coastguard Worker	$(COPY) $(PROGSRC)/png2pnm.c $@
150*a67afe4dSAndroid Build Coastguard Worker
151*a67afe4dSAndroid Build Coastguard Worker# End of makefile for pngm2pnm
152