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