src/third-party/libpng/scripts/makefile.knr (view raw)
1# makefile for libpng
2# Copyright (C) 2002, 2006, 2009, 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# 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.
13
14# where make install puts libpng.a and png.h
15prefix=/usr/local
16INCPATH=$(prefix)/include
17LIBPATH=$(prefix)/lib
18
19# override DESTDIR= on the make install command line to easily support
20# installing into a temporary location. Example:
21#
22# make install DESTDIR=/tmp/build/libpng
23#
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.
27DESTDIR=
28
29CC = cc
30CPPFLAGS = -I../zlib
31CFLAGS = -O
32LDFLAGS = -L. -L../zlib/ -lpng -lz -lm
33# flags for ansi2knr
34ANSI2KNRFLAGS=
35
36RANLIB = ranlib
37#RANLIB = echo
38
39CP = cp
40RM_F = rm -f
41
42# Pre-built configuration
43# See scripts/pnglibconf.mak for more options
44PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
45
46OBJS = 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
50all: ansi2knr libpng.a pngtest
51
52pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
53 $(CP) $(PNGLIBCONF_H_PREBUILT) $@
54
55# general rule to allow ansi2knr to work
56.c.o:
57 ./ansi2knr $*.c T$*.c
58 $(CC) $(CPPFLAGS) $(CFLAGS) -c T$*.c
59 rm -f T$*.c $*.o
60 mv T$*.o $*.o
61
62ansi2knr: ansi2knr.c
63 $(CC) $(CPPFLAGS) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
64
65libpng.a: ansi2knr $(OBJS)
66 ar rc $@ $(OBJS)
67 $(RANLIB) $@
68
69pngtest: pngtest.o libpng.a
70 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
71
72test: pngtest
73 ./pngtest
74
75install: 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
90
91clean:
92 $(RM_F) *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h
93
94DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
95writelock:
96 chmod a-w *.[ch35] $(DOCS) scripts/*
97
98# DO NOT DELETE THIS LINE -- make depend depends on it.
99
100png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
111pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
112pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
113pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
114pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
115
116pngtest.o: png.h pngconf.h pnglibconf.h