Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1 | # makefile for libpng |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 2 | # Copyright (C) 2002, 2006 Glenn Randers-Pehrson |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 3 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. |
Glenn Randers-Pehrson | 3e61d79 | 2009-06-24 09:31:28 -0500 | [diff] [blame] | 4 | # |
Glenn Randers-Pehrson | bfbf865 | 2009-06-26 21:46:52 -0500 | [diff] [blame] | 5 | # This code is released under the libpng license. |
Glenn Randers-Pehrson | c332bbc | 2009-06-25 13:43:50 -0500 | [diff] [blame] | 6 | # For conditions of distribution and use, see the disclaimer |
Glenn Randers-Pehrson | 037023b | 2009-06-24 10:27:36 -0500 | [diff] [blame] | 7 | # and license in png.h |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 8 | |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 9 | # where make install puts libpng.a and png.h |
| 10 | prefix=/usr/local |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 11 | INCPATH=$(prefix)/include |
| 12 | LIBPATH=$(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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 20 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 21 | # you execute make install. |
| 22 | DESTDIR= |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 23 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 24 | # Where the zlib library and include files are located |
| 25 | #ZLIBLIB=/usr/local/lib |
| 26 | #ZLIBINC=/usr/local/include |
| 27 | ZLIBLIB=../zlib |
| 28 | ZLIBINC=../zlib |
| 29 | |
| 30 | |
| 31 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow -Wconversion \ |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 32 | -Wmissing-declarations -Wtraditional -Wcast-align \ |
| 33 | -Wstrict-prototypes -Wmissing-prototypes |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 34 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 35 | CC=gcc |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 36 | AR_RC=ar rc |
Glenn Randers-Pehrson | 1ce0836 | 2006-03-08 23:35:59 -0600 | [diff] [blame] | 37 | MKDIR_P=mkdir -p |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 38 | LN_SF=ln -f -s |
| 39 | RANLIB=ranlib |
| 40 | RM_F=/bin/rm -f |
| 41 | |
Glenn Randers-Pehrson | 03f9b02 | 2009-12-04 08:40:41 -0600 | [diff] [blame^] | 42 | CFLAGS=-I$(ZLIBINC) -O # $(WARNMORE) -DPNG_DEBUG=5 |
Glenn Randers-Pehrson | 761bf9f | 2002-10-31 19:53:20 -0600 | [diff] [blame] | 43 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm |
| 44 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 45 | OBJS = 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.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 47 | pngwtran.o pngmem.o pngerror.o pngpread.o |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 48 | |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 49 | all: libpng.a pngtest |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 50 | |
| 51 | libpng.a: $(OBJS) |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 52 | $(AR_RC) $@ $(OBJS) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 53 | $(RANLIB) $@ |
| 54 | |
| 55 | pngtest: pngtest.o libpng.a |
Glenn Randers-Pehrson | ea3bcd7 | 1998-03-07 14:33:00 -0600 | [diff] [blame] | 56 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 57 | |
| 58 | test: pngtest |
| 59 | ./pngtest |
| 60 | |
| 61 | install: libpng.a |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 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 |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 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 |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 71 | (cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .) |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 72 | cp libpng.a $(DESTDIR)$(LIBPATH) |
| 73 | chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 74 | |
| 75 | clean: |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 76 | $(RM_F) *.o libpng.a pngtest pngout.png |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 77 | |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 78 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 79 | writelock: |
| 80 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 81 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 82 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 83 | |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 84 | png.o: png.h pngconf.h pngpriv.h |
| 85 | pngerror.o: png.h pngconf.h pngpriv.h |
| 86 | pngrio.o: png.h pngconf.h pngpriv.h |
| 87 | pngwio.o: png.h pngconf.h pngpriv.h |
| 88 | pngmem.o: png.h pngconf.h pngpriv.h |
| 89 | pngset.o: png.h pngconf.h pngpriv.h |
| 90 | pngget.o: png.h pngconf.h pngpriv.h |
| 91 | pngread.o: png.h pngconf.h pngpriv.h |
| 92 | pngrtran.o: png.h pngconf.h pngpriv.h |
| 93 | pngrutil.o: png.h pngconf.h pngpriv.h |
| 94 | pngtrans.o: png.h pngconf.h pngpriv.h |
| 95 | pngwrite.o: png.h pngconf.h pngpriv.h |
| 96 | pngwtran.o: png.h pngconf.h pngpriv.h |
| 97 | pngwutil.o: png.h pngconf.h pngpriv.h |
| 98 | pngpread.o: png.h pngconf.h pngpriv.h |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 99 | |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 100 | pngtest.o: png.h pngconf.h |