]>
Commit | Line | Data |
---|---|---|
0272a10d VZ |
1 | # makefile for libpng |
2 | # Copyright (C) 2002 Glenn Randers-Pehrson | |
3 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. | |
4 | # For conditions of distribution and use, see copyright notice in png.h | |
5 | ||
6 | # This makefile requires the file ansi2knr.c, which you can get | |
7 | # from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/ | |
8 | # If you have libjpeg, you probably already have ansi2knr.c in the jpeg | |
9 | # source distribution. | |
10 | ||
11 | # where make install puts libpng.a and png.h | |
12 | prefix=/usr/local | |
13 | INCPATH=$(prefix)/include | |
14 | LIBPATH=$(prefix)/lib | |
15 | ||
16 | # override DESTDIR= on the make install command line to easily support | |
17 | # installing into a temporary location. Example: | |
18 | # | |
19 | # make install DESTDIR=/tmp/build/libpng | |
20 | # | |
21 | # If you're going to install into a temporary location | |
22 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
23 | # you execute make install. | |
24 | DESTDIR= | |
25 | ||
26 | CC=cc | |
27 | CFLAGS=-I../zlib -O | |
28 | LDFLAGS=-L. -L../zlib/ -lpng -lz -lm | |
29 | # flags for ansi2knr | |
30 | ANSI2KNRFLAGS= | |
31 | ||
32 | RANLIB=ranlib | |
33 | #RANLIB=echo | |
34 | ||
35 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ | |
36 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ | |
37 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
38 | ||
39 | all: ansi2knr libpng.a pngtest | |
40 | ||
41 | # general rule to allow ansi2knr to work | |
42 | .c.o: | |
43 | ./ansi2knr $*.c T$*.c | |
44 | $(CC) $(CFLAGS) -c T$*.c | |
45 | rm -f T$*.c $*.o | |
46 | mv T$*.o $*.o | |
47 | ||
48 | ansi2knr: ansi2knr.c | |
49 | $(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c | |
50 | ||
51 | libpng.a: ansi2knr $(OBJS) | |
52 | ar rc $@ $(OBJS) | |
53 | $(RANLIB) $@ | |
54 | ||
55 | pngtest: pngtest.o libpng.a | |
56 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
57 | ||
58 | test: pngtest | |
59 | ./pngtest | |
60 | ||
61 | install: libpng.a | |
62 | -@mkdir $(DESTDIR)$(INCPATH) | |
63 | -@mkdir $(DESTDIR)$(INCPATH)/libpng | |
64 | -@mkdir $(DESTDIR)$(LIBPATH) | |
65 | -@rm -f $(DESTDIR)$(INCPATH)/png.h | |
66 | -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h | |
67 | cp png.h $(DESTDIR)$(INCPATH)/libpng | |
68 | cp pngconf.h $(DESTDIR)$(INCPATH)/libpng | |
69 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h | |
70 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h | |
71 | (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .) | |
72 | cp libpng.a $(DESTDIR)$(LIBPATH) | |
73 | chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a | |
74 | ||
75 | clean: | |
76 | rm -f *.o libpng.a pngtest pngout.png ansi2knr | |
77 | ||
78 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
79 | writelock: | |
80 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
81 | ||
82 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
83 | ||
84 | png.o: png.h pngconf.h | |
85 | pngerror.o: png.h pngconf.h | |
86 | pngrio.o: png.h pngconf.h | |
87 | pngwio.o: png.h pngconf.h | |
88 | pngmem.o: png.h pngconf.h | |
89 | pngset.o: png.h pngconf.h | |
90 | pngget.o: png.h pngconf.h | |
91 | pngread.o: png.h pngconf.h | |
92 | pngpread.o: png.h pngconf.h | |
93 | pngrtran.o: png.h pngconf.h | |
94 | pngrutil.o: png.h pngconf.h | |
95 | pngtest.o: png.h pngconf.h | |
96 | pngtrans.o: png.h pngconf.h | |
97 | pngwrite.o: png.h pngconf.h | |
98 | pngwtran.o: png.h pngconf.h | |
99 | pngwutil.o: png.h pngconf.h |