blob: 984379c0c5243012a2383e050a5115235575a8cb [file] [log] [blame]
Andreas Dilger47a0c421997-05-16 02:46:07 -05001# makefile for libpng
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06002# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
Andreas Dilger47a0c421997-05-16 02:46:07 -05003# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05004#
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -05005# This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -05006# For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -05007# and license in png.h
Andreas Dilger47a0c421997-05-16 02:46:07 -05008
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -06009# where make install puts libpng.a and png.h
10prefix=/usr/local
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050011INCPATH=$(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
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050020# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050021# you execute make install.
22DESTDIR=
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060023
Andreas Dilger47a0c421997-05-16 02:46:07 -050024# 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 \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050032 -Wmissing-declarations -Wtraditional -Wcast-align \
33 -Wstrict-prototypes -Wmissing-prototypes
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060034
Andreas Dilger47a0c421997-05-16 02:46:07 -050035CC=gcc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060036AR_RC=ar rc
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -060037MKDIR_P=mkdir -p
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060038LN_SF=ln -f -s
39RANLIB=ranlib
40RM_F=/bin/rm -f
41
Glenn Randers-Pehrson03f9b022009-12-04 08:40:41 -060042CFLAGS=-I$(ZLIBINC) -O # $(WARNMORE) -DPNG_DEBUG=5
Glenn Randers-Pehrson761bf9f2002-10-31 19:53:20 -060043LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
44
Andreas Dilger47a0c421997-05-16 02:46:07 -050045OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
46 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050047 pngwtran.o pngmem.o pngerror.o pngpread.o
Andreas Dilger47a0c421997-05-16 02:46:07 -050048
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050049all: libpng.a pngtest
Andreas Dilger47a0c421997-05-16 02:46:07 -050050
51libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060052 $(AR_RC) $@ $(OBJS)
Andreas Dilger47a0c421997-05-16 02:46:07 -050053 $(RANLIB) $@
54
55pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -060056 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Andreas Dilger47a0c421997-05-16 02:46:07 -050057
58test: pngtest
59 ./pngtest
60
61install: libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060062 -@$(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
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050067 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
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060071 (cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050072 cp libpng.a $(DESTDIR)$(LIBPATH)
73 chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
Andreas Dilger47a0c421997-05-16 02:46:07 -050074
75clean:
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050076 $(RM_F) *.o libpng.a pngtest pngout.png
Andreas Dilger47a0c421997-05-16 02:46:07 -050077
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -060078DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
79writelock:
80 chmod a-w *.[ch35] $(DOCS) scripts/*
81
Andreas Dilger47a0c421997-05-16 02:46:07 -050082# DO NOT DELETE THIS LINE -- make depend depends on it.
83
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050084png.o: png.h pngconf.h pngpriv.h
85pngerror.o: png.h pngconf.h pngpriv.h
86pngrio.o: png.h pngconf.h pngpriv.h
87pngwio.o: png.h pngconf.h pngpriv.h
88pngmem.o: png.h pngconf.h pngpriv.h
89pngset.o: png.h pngconf.h pngpriv.h
90pngget.o: png.h pngconf.h pngpriv.h
91pngread.o: png.h pngconf.h pngpriv.h
92pngrtran.o: png.h pngconf.h pngpriv.h
93pngrutil.o: png.h pngconf.h pngpriv.h
94pngtrans.o: png.h pngconf.h pngpriv.h
95pngwrite.o: png.h pngconf.h pngpriv.h
96pngwtran.o: png.h pngconf.h pngpriv.h
97pngwutil.o: png.h pngconf.h pngpriv.h
98pngpread.o: png.h pngconf.h pngpriv.h
Andreas Dilger47a0c421997-05-16 02:46:07 -050099
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500100pngtest.o: png.h pngconf.h