1 | # makefile for libpng |
---|
2 | # Copyright (C) 2002, 2006, 2009 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 |
---|
15 | prefix=/usr/local |
---|
16 | INCPATH=$(prefix)/include |
---|
17 | LIBPATH=$(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. |
---|
27 | DESTDIR= |
---|
28 | |
---|
29 | CC=cc |
---|
30 | CFLAGS=-I../zlib -O |
---|
31 | LDFLAGS=-L. -L../zlib/ -lpng -lz -lm |
---|
32 | # flags for ansi2knr |
---|
33 | ANSI2KNRFLAGS= |
---|
34 | |
---|
35 | RANLIB=ranlib |
---|
36 | #RANLIB=echo |
---|
37 | |
---|
38 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
---|
39 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
---|
40 | pngwtran.o pngmem.o pngerror.o pngpread.o |
---|
41 | |
---|
42 | all: ansi2knr libpng.a pngtest |
---|
43 | |
---|
44 | # see scripts/pnglibconf.mak for more options |
---|
45 | pnglibconf.h: scripts/pnglibconf.h.prebuilt |
---|
46 | cp scripts/pnglibconf.h.prebuilt $@ |
---|
47 | |
---|
48 | # general rule to allow ansi2knr to work |
---|
49 | .c.o: |
---|
50 | ./ansi2knr $*.c T$*.c |
---|
51 | $(CC) $(CFLAGS) -c T$*.c |
---|
52 | rm -f T$*.c $*.o |
---|
53 | mv T$*.o $*.o |
---|
54 | |
---|
55 | ansi2knr: ansi2knr.c |
---|
56 | $(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c |
---|
57 | |
---|
58 | libpng.a: ansi2knr $(OBJS) |
---|
59 | ar rc $@ $(OBJS) |
---|
60 | $(RANLIB) $@ |
---|
61 | |
---|
62 | pngtest: pngtest.o libpng.a |
---|
63 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
---|
64 | |
---|
65 | test: pngtest |
---|
66 | ./pngtest |
---|
67 | |
---|
68 | install: libpng.a png.h pngconf.h pnglibconf.h |
---|
69 | -@mkdir $(DESTDIR)$(INCPATH) |
---|
70 | -@mkdir $(DESTDIR)$(INCPATH)/libpng |
---|
71 | -@mkdir $(DESTDIR)$(LIBPATH) |
---|
72 | -@rm -f $(DESTDIR)$(INCPATH)/png.h |
---|
73 | -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h |
---|
74 | cp png.h $(DESTDIR)$(INCPATH)/libpng |
---|
75 | cp pngconf.h $(DESTDIR)$(INCPATH)/libpng |
---|
76 | cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng |
---|
77 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h |
---|
78 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h |
---|
79 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h |
---|
80 | (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .) |
---|
81 | cp libpng.a $(DESTDIR)$(LIBPATH) |
---|
82 | chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a |
---|
83 | |
---|
84 | clean: |
---|
85 | rm -f *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h |
---|
86 | |
---|
87 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
---|
88 | writelock: |
---|
89 | chmod a-w *.[ch35] $(DOCS) scripts/* |
---|
90 | |
---|
91 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
---|
92 | |
---|
93 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
94 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
95 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
96 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
97 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
98 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
99 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
100 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
101 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
102 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
103 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
104 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
105 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
106 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
107 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
---|
108 | |
---|
109 | pngtest.o: png.h pngconf.h pnglibconf.h |
---|