1 | # makefile for libpng
|
---|
2 | # Copyright (C) 2002, 2006, 2014 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 | CP = cp
|
---|
36 | RM_F = rm -f
|
---|
37 | AWK = awk
|
---|
38 | SED = sed
|
---|
39 | CPP = $(CC) -E
|
---|
40 | ECHO = echo
|
---|
41 |
|
---|
42 | DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build
|
---|
43 | DFA_EXTRA = # extra files that can be used to control configuration
|
---|
44 | CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
|
---|
45 | CFLAGS = -O # -g
|
---|
46 | LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm
|
---|
47 |
|
---|
48 | # Pre-built configuration
|
---|
49 | # See scripts/pnglibconf.mak for more options
|
---|
50 | PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
---|
51 |
|
---|
52 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
---|
53 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
---|
54 | pngwtran.o pngmem.o pngerror.o pngpread.o
|
---|
55 |
|
---|
56 | .c.o:
|
---|
57 | $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
---|
58 |
|
---|
59 | all: libpng.a pngtest
|
---|
60 |
|
---|
61 | # The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
|
---|
62 | # copy this if the following doesn't work.
|
---|
63 | pnglibconf.h: pnglibconf.dfn
|
---|
64 | $(RM_F) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
|
---|
65 | $(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c
|
---|
66 | $(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
|
---|
67 | $(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
|
---|
68 | $(AWK) -f "scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2
|
---|
69 | mv pnglibconf.tmp $@
|
---|
70 |
|
---|
71 | pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
|
---|
72 | $(RM_F) $@ pnglibconf.pre pnglibconf.tmp
|
---|
73 | $(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
|
---|
74 | $(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
|
---|
75 | $(AWK) -f scripts/options.awk out="pnglibconf.pre"\
|
---|
76 | version=search pngconf.h scripts/pnglibconf.dfa\
|
---|
77 | pngusr.dfa $(DFA_XTRA) 1>&2
|
---|
78 | $(AWK) -f scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2
|
---|
79 | mv pnglibconf.tmp $@
|
---|
80 |
|
---|
81 | libpng.a: $(OBJS)
|
---|
82 | $(AR_RC) $@ $(OBJS)
|
---|
83 | $(RANLIB) $@
|
---|
84 |
|
---|
85 | pngtest: pngtest.o libpng.a
|
---|
86 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
---|
87 |
|
---|
88 | test: pngtest
|
---|
89 | ./pngtest
|
---|
90 |
|
---|
91 | install: libpng.a pnglibconf.h
|
---|
92 | -@$(MKDIR_P) $(DESTDIR)$(INCPATH)
|
---|
93 | -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
|
---|
94 | -@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
|
---|
95 | -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
|
---|
96 | -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
|
---|
97 | -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h
|
---|
98 | cp png.h $(DESTDIR)$(INCPATH)/libpng
|
---|
99 | cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
|
---|
100 | cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
|
---|
101 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
|
---|
102 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
|
---|
103 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
|
---|
104 | (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
|
---|
105 | cp libpng.a $(DESTDIR)$(LIBPATH)
|
---|
106 | chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
|
---|
107 |
|
---|
108 | clean:
|
---|
109 | $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h pnglibconf.c \
|
---|
110 | pnglibconf.out
|
---|
111 |
|
---|
112 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO
|
---|
113 | writelock:
|
---|
114 | chmod a-w *.[ch35] $(DOCS) scripts/*
|
---|
115 |
|
---|
116 | # DO NOT DELETE THIS LINE -- make depend depends on it.
|
---|
117 |
|
---|
118 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
119 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
120 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
121 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
122 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
123 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
124 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
125 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
126 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
127 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
128 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
129 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
130 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
131 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
132 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
133 |
|
---|
134 | pngtest.o: png.h pngconf.h pnglibconf.h
|
---|