The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1 | # makefile for libpng using gcc (generic, static library) |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 2 | # Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 3 | # Copyright (C) 2000 Cosmin Truta |
| 4 | # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc) |
| 5 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. |
Patrick Scott | 5f6bd84 | 2010-06-28 16:55:16 -0400 | [diff] [blame] | 6 | # |
Patrick Scott | a0bb96c | 2009-07-22 11:50:02 -0400 | [diff] [blame] | 7 | # This code is released under the libpng license. |
| 8 | # For conditions of distribution and use, see the disclaimer |
| 9 | # and license in png.h |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 10 | |
| 11 | # Location of the zlib library and include files |
| 12 | ZLIBINC = ../zlib |
| 13 | ZLIBLIB = ../zlib |
| 14 | |
| 15 | # Compiler, linker, lib and other tools |
| 16 | CC = gcc |
| 17 | LD = $(CC) |
| 18 | AR_RC = ar rcs |
| 19 | MKDIR_P = mkdir -p |
| 20 | RANLIB = ranlib |
| 21 | RM_F = rm -f |
| 22 | LN_SF = ln -f -s |
| 23 | |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 24 | LIBNAME = libpng16 |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 25 | PNGMAJ = 16 |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 26 | |
| 27 | prefix=/usr/local |
| 28 | INCPATH=$(prefix)/include |
| 29 | LIBPATH=$(prefix)/lib |
| 30 | |
| 31 | # override DESTDIR= on the make install command line to easily support |
| 32 | # installing into a temporary location. Example: |
| 33 | # |
| 34 | # make install DESTDIR=/tmp/build/libpng |
| 35 | # |
| 36 | # If you're going to install into a temporary location |
| 37 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before |
| 38 | # you execute make install. |
| 39 | DESTDIR= |
| 40 | |
| 41 | DI=$(DESTDIR)$(INCPATH) |
| 42 | DL=$(DESTDIR)$(LIBPATH) |
| 43 | |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 44 | WARNMORE = |
| 45 | CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5 |
| 46 | CFLAGS = -W -Wall -O2 # $(WARNMORE) -g |
| 47 | LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 48 | |
| 49 | # Variables |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 50 | OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ |
| 51 | pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ |
| 52 | pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 53 | |
| 54 | # Targets |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 55 | .c.o: |
| 56 | $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< |
| 57 | |
| 58 | all: $(LIBNAME).a pngtest$(E) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 59 | |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 60 | include scripts/pnglibconf.mak |
| 61 | REMOVE = $(RM_F) |
| 62 | DFNFLAGS = $(DEFS) $(CPPFLAGS) |
| 63 | |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 64 | $(LIBNAME).a: $(OBJS) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 65 | $(AR_RC) $@ $(OBJS) |
| 66 | $(RANLIB) $@ |
| 67 | |
| 68 | test: pngtest$(E) |
| 69 | ./pngtest$(E) |
| 70 | |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 71 | pngtest$(E): pngtest.o $(LIBNAME).a |
| 72 | $(LD) -o $@ pngtest.o $(LDFLAGS) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 73 | |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 74 | install: $(LIBNAME).a |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 75 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi |
| 76 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi |
| 77 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi |
| 78 | -@$(RM_F) $(DI)/$(LIBNAME)/png.h |
| 79 | -@$(RM_F) $(DI)/$(LIBNAME)/pngconf.h |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 80 | -@$(RM_F) $(DI)/$(LIBNAME)/pnglibconf.h |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 81 | -@$(RM_F) $(DI)/png.h |
| 82 | -@$(RM_F) $(DI)/pngconf.h |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 83 | -@$(RM_F) $(DI)/pnglibconf.h |
| 84 | cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 85 | chmod 644 $(DI)/$(LIBNAME)/png.h \ |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 86 | $(DI)/$(LIBNAME)/pngconf.h \ |
| 87 | $(DI)/$(LIBNAME)/pnglibconf.h |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 88 | -@$(RM_F) -r $(DI)/libpng |
| 89 | (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 90 | -@$(RM_F) $(DL)/$(LIBNAME).a |
| 91 | -@$(RM_F) $(DL)/libpng.a |
| 92 | cp $(LIBNAME).a $(DL)/$(LIBNAME).a |
| 93 | chmod 644 $(DL)/$(LIBNAME).a |
| 94 | (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 95 | (cd $(DI); $(LN_SF) libpng/* .;) |
| 96 | |
| 97 | clean: |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 98 | $(RM_F) *.o $(LIBNAME).a pngtest pngout.png pnglibconf.h |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 99 | |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 100 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 101 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 102 | pngget.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 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 105 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 106 | pngrio.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 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 110 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 111 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 112 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 113 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
| 114 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 115 | |
Sireesh Tripurari | b478e66 | 2014-05-09 15:15:10 +0530 | [diff] [blame] | 116 | pngtest.o: png.h pngconf.h pnglibconf.h |