]>
Commit | Line | Data |
---|---|---|
1 | # makefile for libpng | |
2 | # Copyright (C) 2002, 2006 Glenn Randers-Pehrson | |
3 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. | |
4 | # | |
5 | # This code is released under the libpng license. | |
6 | # For conditions of distribution and use, see the disclaimer | |
7 | # and license in png.h | |
8 | ||
9 | # where make install puts libpng.a and png.h | |
10 | prefix=/usr/local | |
11 | INCPATH=$(prefix)/include | |
12 | LIBPATH=$(prefix)/lib | |
13 | ||
14 | # override DESTDIR= on the make install command line to easily support | |
15 | # installing into a temporary location. Example: | |
16 | # | |
17 | # make install DESTDIR=/tmp/build/libpng | |
18 | # | |
19 | # If you're going to install into a temporary location | |
20 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
21 | # you execute make install. | |
22 | DESTDIR= | |
23 | ||
24 | # Where the zlib library and include files are located | |
25 | #ZLIBLIB=/usr/local/lib | |
26 | #ZLIBINC=/usr/local/include | |
27 | ZLIBLIB=../zlib | |
28 | ZLIBINC=../zlib | |
29 | ||
30 | CC=cc | |
31 | AR_RC=ar rc | |
32 | MKDIR_P=mkdir | |
33 | LN_SF=ln -sf | |
34 | RANLIB=ranlib | |
35 | RM_F=rm -f | |
36 | AWK = awk | |
37 | SED = sed | |
38 | CPP = $(CC) -E | |
39 | ECHO = echo | |
40 | ||
41 | DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build | |
42 | DFA_EXTRA = # extra files that can be used to control configuration | |
43 | CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5 | |
44 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm | |
45 | ||
46 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ | |
47 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ | |
48 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
49 | ||
50 | all: libpng.a pngtest | |
51 | ||
52 | # The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt, | |
53 | # copy this if the following doesn't work. | |
54 | pnglibconf.h: pnglibconf.dfn | |
55 | $(RM_F) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp | |
56 | $(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c | |
57 | $(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2 | |
58 | $(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out | |
59 | $(AWK) -f "scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2 | |
60 | mv pnglibconf.tmp $@ | |
61 | ||
62 | pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA) | |
63 | $(RM_F) $@ pnglibconf.pre pnglibconf.tmp | |
64 | $(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2 | |
65 | $(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2 | |
66 | $(AWK) -f scripts/options.awk out="pnglibconf.pre"\ | |
67 | version=search pngconf.h scripts/pnglibconf.dfa\ | |
68 | pngusr.dfa $(DFA_XTRA) 1>&2 | |
69 | $(AWK) -f scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2 | |
70 | mv pnglibconf.tmp $@ | |
71 | ||
72 | libpng.a: $(OBJS) | |
73 | $(AR_RC) $@ $(OBJS) | |
74 | $(RANLIB) $@ | |
75 | ||
76 | pngtest: pngtest.o libpng.a | |
77 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
78 | ||
79 | test: pngtest | |
80 | ./pngtest | |
81 | ||
82 | install: libpng.a pnglibconf.h | |
83 | -@$(MKDIR_P) $(DESTDIR)$(INCPATH) | |
84 | -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng | |
85 | -@$(MKDIR_P) $(DESTDIR)$(LIBPATH) | |
86 | -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h | |
87 | -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h | |
88 | -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h | |
89 | cp png.h $(DESTDIR)$(INCPATH)/libpng | |
90 | cp pngconf.h $(DESTDIR)$(INCPATH)/libpng | |
91 | cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng | |
92 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h | |
93 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h | |
94 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h | |
95 | (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .) | |
96 | cp libpng.a $(DESTDIR)$(LIBPATH) | |
97 | chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a | |
98 | ||
99 | clean: | |
100 | $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.* | |
101 | ||
102 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
103 | writelock: | |
104 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
105 | ||
106 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
107 | ||
108 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
109 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
110 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
111 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
112 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
113 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
114 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
115 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
116 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
117 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
118 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
119 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
120 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
121 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
122 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
123 | ||
124 | pngtest.o: png.h pngconf.h pnglibconf.h |