2 # Copyright (C) 2002, 2006, 2009, 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 # This makefile requires the file ansi2knr.c, which you can get
10 # from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/
11 # If you have libjpeg, you probably already have ansi2knr.c in the jpeg
12 # source distribution.
14 # where make install puts libpng.a and png.h
16 INCPATH=$(prefix)/include
19 # override DESTDIR= on the make install command line to easily support
20 # installing into a temporary location. Example:
22 # make install DESTDIR=/tmp/build/libpng
24 # If you're going to install into a temporary location
25 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
26 # you execute make install.
32 LDFLAGS = -L. -L../zlib/ -lpng -lz -lm
42 # Pre-built configuration
43 # See scripts/pnglibconf.mak for more options
44 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
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
50 all: ansi2knr libpng.a pngtest
52 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
53 $(CP) $(PNGLIBCONF_H_PREBUILT) $@
55 # general rule to allow ansi2knr to work
58 $(CC) $(CPPFLAGS) $(CFLAGS) -c T$*.c
63 $(CC) $(CPPFLAGS) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
65 libpng.a: ansi2knr $(OBJS)
69 pngtest: pngtest.o libpng.a
70 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
75 install: libpng.a png.h pngconf.h pnglibconf.h
76 -@mkdir $(DESTDIR)$(INCPATH)
77 -@mkdir $(DESTDIR)$(INCPATH)/libpng
78 -@mkdir $(DESTDIR)$(LIBPATH)
79 -@rm -f $(DESTDIR)$(INCPATH)/png.h
80 -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
81 cp png.h $(DESTDIR)$(INCPATH)/libpng
82 cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
83 cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
84 chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
85 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
86 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
87 (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
88 cp libpng.a $(DESTDIR)$(LIBPATH)
89 chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
92 $(RM_F) *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h
94 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
96 chmod a-w *.[ch35] $(DOCS) scripts/*
98 # DO NOT DELETE THIS LINE -- make depend depends on it.
100 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
111 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
112 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
113 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
114 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
116 pngtest.o: png.h pngconf.h pnglibconf.h