blob: 2ef794389adf761f035f3c79cfd6de6941ded491 [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-Pehrson42503282014-01-12 10:44:01 -060042CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
43CFLAGS=-O # $(WARNMORE)
Glenn Randers-Pehrson761bf9f2002-10-31 19:53:20 -060044LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
45
Andreas Dilger47a0c421997-05-16 02:46:07 -050046OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
47 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050048 pngwtran.o pngmem.o pngerror.o pngpread.o
Andreas Dilger47a0c421997-05-16 02:46:07 -050049
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060050.c.o:
51 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
52
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050053all: libpng.a pngtest
Andreas Dilger47a0c421997-05-16 02:46:07 -050054
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050055# see scripts/pnglibconf.mak for more options
Glenn Randers-Pehrson8c667862010-08-24 16:16:35 -050056pnglibconf.h: scripts/pnglibconf.h.prebuilt
57 cp scripts/pnglibconf.h.prebuilt $@
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050058
Andreas Dilger47a0c421997-05-16 02:46:07 -050059libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060060 $(AR_RC) $@ $(OBJS)
Andreas Dilger47a0c421997-05-16 02:46:07 -050061 $(RANLIB) $@
62
63pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -060064 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Andreas Dilger47a0c421997-05-16 02:46:07 -050065
66test: pngtest
67 ./pngtest
68
69install: libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060070 -@$(MKDIR_P) $(DESTDIR)$(INCPATH)
71 -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
72 -@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
73 -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
74 -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050075 -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050076 cp png.h $(DESTDIR)$(INCPATH)/libpng
77 cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050078 cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050079 chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
80 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050081 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060082 (cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050083 cp libpng.a $(DESTDIR)$(LIBPATH)
84 chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
Andreas Dilger47a0c421997-05-16 02:46:07 -050085
86clean:
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050087 $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h
Andreas Dilger47a0c421997-05-16 02:46:07 -050088
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -060089DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
90writelock:
91 chmod a-w *.[ch35] $(DOCS) scripts/*
92
Andreas Dilger47a0c421997-05-16 02:46:07 -050093# DO NOT DELETE THIS LINE -- make depend depends on it.
94
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060095png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
96pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
97pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
98pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
99pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
100pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
Andreas Dilger47a0c421997-05-16 02:46:07 -0500110
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600111pngtest.o: png.h pngconf.h pnglibconf.h