blob: 5f62d50afb9dfc588a46355e89b27c22dd12fb56 [file] [log] [blame]
The Android Open Source Project893912b2009-03-03 19:30:05 -08001# makefile for libpng using gcc (generic, static library)
Sireesh Tripurarib478e662014-05-09 15:15:10 +05302# Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson
The Android Open Source Project893912b2009-03-03 19:30:05 -08003# 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 Scott5f6bd842010-06-28 16:55:16 -04006#
Patrick Scotta0bb96c2009-07-22 11:50:02 -04007# 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 Project893912b2009-03-03 19:30:05 -080010
11# Location of the zlib library and include files
12ZLIBINC = ../zlib
13ZLIBLIB = ../zlib
14
15# Compiler, linker, lib and other tools
16CC = gcc
17LD = $(CC)
18AR_RC = ar rcs
19MKDIR_P = mkdir -p
20RANLIB = ranlib
21RM_F = rm -f
22LN_SF = ln -f -s
23
Sireesh Tripurarib478e662014-05-09 15:15:10 +053024LIBNAME = libpng16
Chris Craikb50c2172013-07-29 15:28:30 -070025PNGMAJ = 16
The Android Open Source Project893912b2009-03-03 19:30:05 -080026
27prefix=/usr/local
28INCPATH=$(prefix)/include
29LIBPATH=$(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.
39DESTDIR=
40
41DI=$(DESTDIR)$(INCPATH)
42DL=$(DESTDIR)$(LIBPATH)
43
Sireesh Tripurarib478e662014-05-09 15:15:10 +053044WARNMORE =
45CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
46CFLAGS = -W -Wall -O2 # $(WARNMORE) -g
47LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm
The Android Open Source Project893912b2009-03-03 19:30:05 -080048
49# Variables
Sireesh Tripurarib478e662014-05-09 15:15:10 +053050OBJS = 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 Project893912b2009-03-03 19:30:05 -080053
54# Targets
Sireesh Tripurarib478e662014-05-09 15:15:10 +053055.c.o:
56 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
57
58all: $(LIBNAME).a pngtest$(E)
The Android Open Source Project893912b2009-03-03 19:30:05 -080059
Chris Craikb50c2172013-07-29 15:28:30 -070060include scripts/pnglibconf.mak
61REMOVE = $(RM_F)
62DFNFLAGS = $(DEFS) $(CPPFLAGS)
63
Sireesh Tripurarib478e662014-05-09 15:15:10 +053064$(LIBNAME).a: $(OBJS)
The Android Open Source Project893912b2009-03-03 19:30:05 -080065 $(AR_RC) $@ $(OBJS)
66 $(RANLIB) $@
67
68test: pngtest$(E)
69 ./pngtest$(E)
70
Sireesh Tripurarib478e662014-05-09 15:15:10 +053071pngtest$(E): pngtest.o $(LIBNAME).a
72 $(LD) -o $@ pngtest.o $(LDFLAGS)
The Android Open Source Project893912b2009-03-03 19:30:05 -080073
Sireesh Tripurarib478e662014-05-09 15:15:10 +053074install: $(LIBNAME).a
The Android Open Source Project893912b2009-03-03 19:30:05 -080075 -@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 Craikb50c2172013-07-29 15:28:30 -070080 -@$(RM_F) $(DI)/$(LIBNAME)/pnglibconf.h
The Android Open Source Project893912b2009-03-03 19:30:05 -080081 -@$(RM_F) $(DI)/png.h
82 -@$(RM_F) $(DI)/pngconf.h
Chris Craikb50c2172013-07-29 15:28:30 -070083 -@$(RM_F) $(DI)/pnglibconf.h
84 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
The Android Open Source Project893912b2009-03-03 19:30:05 -080085 chmod 644 $(DI)/$(LIBNAME)/png.h \
Chris Craikb50c2172013-07-29 15:28:30 -070086 $(DI)/$(LIBNAME)/pngconf.h \
87 $(DI)/$(LIBNAME)/pnglibconf.h
The Android Open Source Project893912b2009-03-03 19:30:05 -080088 -@$(RM_F) -r $(DI)/libpng
89 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Sireesh Tripurarib478e662014-05-09 15:15:10 +053090 -@$(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 Project893912b2009-03-03 19:30:05 -080095 (cd $(DI); $(LN_SF) libpng/* .;)
96
97clean:
Sireesh Tripurarib478e662014-05-09 15:15:10 +053098 $(RM_F) *.o $(LIBNAME).a pngtest pngout.png pnglibconf.h
The Android Open Source Project893912b2009-03-03 19:30:05 -080099
Sireesh Tripurarib478e662014-05-09 15:15:10 +0530100png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102pngget.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
104pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106pngrio.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
109pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
111pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
112pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
113pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
114pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
The Android Open Source Project893912b2009-03-03 19:30:05 -0800115
Sireesh Tripurarib478e662014-05-09 15:15:10 +0530116pngtest.o: png.h pngconf.h pnglibconf.h