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# where make install puts libpng.a and png.h
7prefix=/usr/local
8INCPATH=$(prefix)/include
9LIBPATH=$(prefix)/lib
10
11# override DESTDIR= on the make install command line to easily support
12# installing into a temporary location.  Example:
13#
14#    make install DESTDIR=/tmp/build/libpng
15#
16# If you're going to install into a temporary location
17# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
18# you execute make install.
19DESTDIR=
20
21# Where the zlib library and include files are located
22#ZLIBLIB=/usr/local/lib
23#ZLIBINC=/usr/local/include
24ZLIBLIB=../zlib
25ZLIBINC=../zlib
26
27CC=cc
28CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
29LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
30
31#RANLIB=echo
32RANLIB=ranlib
33
34OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
35	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
36	pngwtran.o pngmem.o pngerror.o pngpread.o
37
38all: libpng.a pngtest
39
40libpng.a: $(OBJS)
41	ar rc $@  $(OBJS)
42	$(RANLIB) $@
43
44pngtest: pngtest.o libpng.a
45	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
46
47test: pngtest
48	./pngtest
49
50install: libpng.a
51	-@mkdir $(DESTDIR)$(INCPATH)
52	-@mkdir $(DESTDIR)$(INCPATH)/libpng
53	-@mkdir $(DESTDIR)$(LIBPATH)
54	-@rm -f $(DESTDIR)$(INCPATH)/png.h
55	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
56	cp png.h $(DESTDIR)$(INCPATH)/libpng
57	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
58	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
59	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
60	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
61	cp libpng.a $(DESTDIR)$(LIBPATH)
62	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
63
64clean:
65	rm -f *.o libpng.a pngtest pngout.png
66
67DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
68writelock:
69	chmod a-w *.[ch35] $(DOCS) scripts/*
70
71# DO NOT DELETE THIS LINE -- make depend depends on it.
72
73png.o: png.h pngconf.h
74pngerror.o: png.h pngconf.h
75pngrio.o: png.h pngconf.h
76pngwio.o: png.h pngconf.h
77pngmem.o: png.h pngconf.h
78pngset.o: png.h pngconf.h
79pngget.o: png.h pngconf.h
80pngread.o: png.h pngconf.h
81pngrtran.o: png.h pngconf.h
82pngrutil.o: png.h pngconf.h
83pngtest.o: png.h pngconf.h
84pngtrans.o: png.h pngconf.h
85pngwrite.o: png.h pngconf.h
86pngwtran.o: png.h pngconf.h
87pngwutil.o: png.h pngconf.h
88pngpread.o: png.h pngconf.h
89
90