2 # Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson
3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
5 # This code is released under the libpng license.
6 # For conditions of distribution and use, see the disclaimer
9 # where make install puts libpng.a and png.h
11 INCPATH=$(prefix)/include
14 # override DESTDIR= on the make install command line to easily support
15 # installing into a temporary location. Example:
17 # make install DESTDIR=/tmp/build/libpng
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.
24 # Where the zlib library and include files are located
25 #ZLIBLIB=/usr/local/lib
26 #ZLIBINC=/usr/local/include
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
46 LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm
48 # Pre-built configuration
49 # See scripts/pnglibconf.mak for more options
50 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
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
57 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
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
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
85 pngtest: pngtest.o libpng.a
86 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
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
109 $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h pnglibconf.c \
112 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
114 chmod a-w *.[ch35] $(DOCS) scripts/*
116 # DO NOT DELETE THIS LINE -- make depend depends on it.
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 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
126 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
127 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
128 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
129 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
130 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
131 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
132 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
134 pngtest.o: png.h pngconf.h pnglibconf.h