blob: efe308c4781f315ef315ca154e568be09d7faeeb [file] [log] [blame]
Andreas Dilger47a0c421997-05-16 02:46:07 -05001# makefile for libpng
Glenn Randers-Pehrson5af03072014-01-20 12:36:30 -06002# Copyright (C) 2002, 2006, 2014 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
Cosmin Truta82200da2014-03-22 09:29:59 -050040CP=cp
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060041RM_F=/bin/rm -f
42
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060043CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
44CFLAGS=-O # $(WARNMORE)
Glenn Randers-Pehrson761bf9f2002-10-31 19:53:20 -060045LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
46
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050047# Pre-built configuration
48# See scripts/pnglibconf.mak for more options
49PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
50
Andreas Dilger47a0c421997-05-16 02:46:07 -050051OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
52 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050053 pngwtran.o pngmem.o pngerror.o pngpread.o
Andreas Dilger47a0c421997-05-16 02:46:07 -050054
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060055.c.o:
56 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
57
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050058all: libpng.a pngtest
Andreas Dilger47a0c421997-05-16 02:46:07 -050059
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050060pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
Glenn Randers-Pehrsonff649a02014-08-07 19:51:35 -050061 $(CP) $(PNGLIBCONF_H_PREBUILT) $@
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050062
Andreas Dilger47a0c421997-05-16 02:46:07 -050063libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060064 $(AR_RC) $@ $(OBJS)
Andreas Dilger47a0c421997-05-16 02:46:07 -050065 $(RANLIB) $@
66
67pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -060068 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Andreas Dilger47a0c421997-05-16 02:46:07 -050069
70test: pngtest
71 ./pngtest
72
73install: libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060074 -@$(MKDIR_P) $(DESTDIR)$(INCPATH)
75 -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
76 -@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
77 -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
78 -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050079 -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050080 cp png.h $(DESTDIR)$(INCPATH)/libpng
81 cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050082 cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050083 chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
84 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050085 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060086 (cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050087 cp libpng.a $(DESTDIR)$(LIBPATH)
88 chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
Andreas Dilger47a0c421997-05-16 02:46:07 -050089
90clean:
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050091 $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h
Andreas Dilger47a0c421997-05-16 02:46:07 -050092
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -060093DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
94writelock:
95 chmod a-w *.[ch35] $(DOCS) scripts/*
96
Andreas Dilger47a0c421997-05-16 02:46:07 -050097# DO NOT DELETE THIS LINE -- make depend depends on it.
98
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060099png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
100pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
111pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
112pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
113pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
Andreas Dilger47a0c421997-05-16 02:46:07 -0500114
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600115pngtest.o: png.h pngconf.h pnglibconf.h