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 | # general rule to allow ansi2knr to work
|
---|
45 | .c.o:
|
---|
46 | ./ansi2knr $*.c T$*.c
|
---|
47 | $(CC) $(CFLAGS) -c T$*.c
|
---|
48 | rm -f T$*.c $*.o
|
---|
49 | mv T$*.o $*.o
|
---|
50 |
|
---|
51 | ansi2knr: ansi2knr.c
|
---|
52 | $(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
|
---|
53 |
|
---|
54 | libpng.a: ansi2knr $(OBJS)
|
---|
55 | ar rc $@ $(OBJS)
|
---|
56 | $(RANLIB) $@
|
---|
57 |
|
---|
58 | pngtest: pngtest.o libpng.a
|
---|
59 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
---|
60 |
|
---|
61 | test: pngtest
|
---|
62 | ./pngtest
|
---|
63 |
|
---|
64 | install: libpng.a png.h pngconf.h
|
---|
65 | -@mkdir $(DESTDIR)$(INCPATH)
|
---|
66 | -@mkdir $(DESTDIR)$(INCPATH)/libpng
|
---|
67 | -@mkdir $(DESTDIR)$(LIBPATH)
|
---|
68 | -@rm -f $(DESTDIR)$(INCPATH)/png.h
|
---|
69 | -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
|
---|
70 | cp png.h $(DESTDIR)$(INCPATH)/libpng
|
---|
71 | cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
|
---|
72 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
|
---|
73 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
|
---|
74 | (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
|
---|
75 | cp libpng.a $(DESTDIR)$(LIBPATH)
|
---|
76 | chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
|
---|
77 |
|
---|
78 | clean:
|
---|
79 | rm -f *.o libpng.a pngtest pngout.png ansi2knr
|
---|
80 |
|
---|
81 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
---|
82 | writelock:
|
---|
83 | chmod a-w *.[ch35] $(DOCS) scripts/*
|
---|
84 |
|
---|
85 | # DO NOT DELETE THIS LINE -- make depend depends on it.
|
---|
86 |
|
---|
87 | png.o: png.h pngconf.h
|
---|
88 | pngerror.o: png.h pngconf.h
|
---|
89 | pngrio.o: png.h pngconf.h
|
---|
90 | pngwio.o: png.h pngconf.h
|
---|
91 | pngmem.o: png.h pngconf.h
|
---|
92 | pngset.o: png.h pngconf.h
|
---|
93 | pngget.o: png.h pngconf.h
|
---|
94 | pngread.o: png.h pngconf.h
|
---|
95 | pngpread.o: png.h pngconf.h
|
---|
96 | pngrtran.o: png.h pngconf.h
|
---|
97 | pngrutil.o: png.h pngconf.h
|
---|
98 | pngtrans.o: png.h pngconf.h
|
---|
99 | pngwrite.o: png.h pngconf.h
|
---|
100 | pngwtran.o: png.h pngconf.h
|
---|
101 | pngwutil.o: png.h pngconf.h
|
---|
102 |
|
---|
103 | pngtest.o: png.h pngconf.h
|
---|