blob: f893c2f49e50048bb4acc9066b2b6538d1e69a7a [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
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050051# see scripts/pnglibconf.mak for more options
52pnglibconf.h: scripts/pnglibconf.h
53 cp scripts/pnglibconf.h $@
54
Andreas Dilger47a0c421997-05-16 02:46:07 -050055libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060056 $(AR_RC) $@ $(OBJS)
Andreas Dilger47a0c421997-05-16 02:46:07 -050057 $(RANLIB) $@
58
59pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -060060 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Andreas Dilger47a0c421997-05-16 02:46:07 -050061
62test: pngtest
63 ./pngtest
64
65install: libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060066 -@$(MKDIR_P) $(DESTDIR)$(INCPATH)
67 -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
68 -@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
69 -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
70 -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050071 -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050072 cp png.h $(DESTDIR)$(INCPATH)/libpng
73 cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050074 cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050075 chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
76 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050077 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060078 (cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050079 cp libpng.a $(DESTDIR)$(LIBPATH)
80 chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
Andreas Dilger47a0c421997-05-16 02:46:07 -050081
82clean:
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050083 $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h
Andreas Dilger47a0c421997-05-16 02:46:07 -050084
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -060085DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
86writelock:
87 chmod a-w *.[ch35] $(DOCS) scripts/*
88
Andreas Dilger47a0c421997-05-16 02:46:07 -050089# DO NOT DELETE THIS LINE -- make depend depends on it.
90
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050091png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
92pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
93pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
94pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
95pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
96pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
97pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
98pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
99pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
100pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
Andreas Dilger47a0c421997-05-16 02:46:07 -0500106
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -0500107pngtest.o: png.h pngconf.h pnglibconf.h