Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1 | # makefile for libpng |
Glenn Randers-Pehrson | 5af0307 | 2014-01-20 12:36:30 -0600 | [diff] [blame] | 2 | # Copyright (C) 2002, 2006, 2014 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 |
Cosmin Truta | 82200da | 2014-03-22 09:29:59 -0500 | [diff] [blame] | 40 | CP=cp |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 41 | RM_F=/bin/rm -f |
| 42 | |
Glenn Randers-Pehrson | 4250328 | 2014-01-12 10:44:01 -0600 | [diff] [blame] | 43 | CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 |
| 44 | CFLAGS=-O # $(WARNMORE) |
Glenn Randers-Pehrson | 761bf9f | 2002-10-31 19:53:20 -0600 | [diff] [blame] | 45 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm |
| 46 | |
Cosmin Truta | 9ab7b4c | 2014-03-22 13:13:11 -0500 | [diff] [blame] | 47 | # Pre-built configuration |
| 48 | # See scripts/pnglibconf.mak for more options |
| 49 | PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt |
| 50 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 51 | OBJS = 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.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 53 | pngwtran.o pngmem.o pngerror.o pngpread.o |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 54 | |
Glenn Randers-Pehrson | 4250328 | 2014-01-12 10:44:01 -0600 | [diff] [blame] | 55 | .c.o: |
| 56 | $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< |
| 57 | |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 58 | all: libpng.a pngtest |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 59 | |
Cosmin Truta | 9ab7b4c | 2014-03-22 13:13:11 -0500 | [diff] [blame] | 60 | pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) |
Glenn Randers-Pehrson | ff649a0 | 2014-08-07 19:51:35 -0500 | [diff] [blame] | 61 | $(CP) $(PNGLIBCONF_H_PREBUILT) $@ |
Glenn Randers-Pehrson | 7253144 | 2010-04-17 08:17:51 -0500 | [diff] [blame] | 62 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 63 | libpng.a: $(OBJS) |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 64 | $(AR_RC) $@ $(OBJS) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 65 | $(RANLIB) $@ |
| 66 | |
| 67 | pngtest: pngtest.o libpng.a |
Glenn Randers-Pehrson | ea3bcd7 | 1998-03-07 14:33:00 -0600 | [diff] [blame] | 68 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 69 | |
| 70 | test: pngtest |
| 71 | ./pngtest |
| 72 | |
| 73 | install: libpng.a |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 74 | -@$(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-Pehrson | 7253144 | 2010-04-17 08:17:51 -0500 | [diff] [blame] | 79 | -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 80 | cp png.h $(DESTDIR)$(INCPATH)/libpng |
| 81 | cp pngconf.h $(DESTDIR)$(INCPATH)/libpng |
Glenn Randers-Pehrson | 7253144 | 2010-04-17 08:17:51 -0500 | [diff] [blame] | 82 | cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 83 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h |
| 84 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h |
Glenn Randers-Pehrson | 7253144 | 2010-04-17 08:17:51 -0500 | [diff] [blame] | 85 | chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 86 | (cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .) |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 87 | cp libpng.a $(DESTDIR)$(LIBPATH) |
| 88 | chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 89 | |
| 90 | clean: |
Glenn Randers-Pehrson | 7253144 | 2010-04-17 08:17:51 -0500 | [diff] [blame] | 91 | $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 92 | |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 93 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 94 | writelock: |
| 95 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 96 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 97 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 98 | |
Glenn Randers-Pehrson | 4250328 | 2014-01-12 10:44:01 -0600 | [diff] [blame] | 99 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 100 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 101 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 102 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 103 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 104 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 105 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 106 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 107 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 108 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 109 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 110 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 111 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 112 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 113 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 114 | |
Glenn Randers-Pehrson | 0b3634b | 2011-12-17 09:57:00 -0600 | [diff] [blame] | 115 | pngtest.o: png.h pngconf.h pnglibconf.h |