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
30
31WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow -Wconversion \
32	-Wmissing-declarations -Wtraditional -Wcast-align \
33	-Wstrict-prototypes -Wmissing-prototypes
34
35CC=gcc
36AR_RC=ar rc
37MKDIR_P=mkdir -p
38LN_SF=ln -f -s
39RANLIB=ranlib
40RM_F=/bin/rm -f
41
42CFLAGS=-I$(ZLIBINC) -O # $(WARNMORE) -DPNG_DEBUG=5
43LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
44
45OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
46	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
47	pngwtran.o pngmem.o pngerror.o pngpread.o
48
49all: libpng.a pngtest
50
51libpng.a: $(OBJS)
52	$(AR_RC) $@  $(OBJS)
53	$(RANLIB) $@
54
55pngtest: pngtest.o libpng.a
56	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
57
58test: pngtest
59	./pngtest
60
61install: libpng.a
62	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)
63	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
64	-@$(MKDIR_P) $(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_SF) libpng/* .)
72	cp libpng.a $(DESTDIR)$(LIBPATH)
73	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
74
75clean:
76	$(RM_F) *.o libpng.a pngtest pngout.png
77
78DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
79writelock:
80	chmod a-w *.[ch35] $(DOCS) scripts/*
81
82# DO NOT DELETE THIS LINE -- make depend depends on it.
83
84png.o: png.h pngconf.h
85pngerror.o: png.h pngconf.h
86pngrio.o: png.h pngconf.h
87pngwio.o: png.h pngconf.h
88pngmem.o: png.h pngconf.h
89pngset.o: png.h pngconf.h
90pngget.o: png.h pngconf.h
91pngread.o: png.h pngconf.h
92pngrtran.o: png.h pngconf.h
93pngrutil.o: png.h pngconf.h
94pngtrans.o: png.h pngconf.h
95pngwrite.o: png.h pngconf.h
96pngwtran.o: png.h pngconf.h
97pngwutil.o: png.h pngconf.h
98pngpread.o: png.h pngconf.h
99
100pngtest.o: png.h pngconf.h
101