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