blob: ba92d150931804e3b34ea3cc323844c2adcdaaf3 [file] [log] [blame]
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -06001# makefile for libpng using gcc (generic, static library)
Glenn Randers-Pehrson5af03072014-01-20 12:36:30 -06002# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -06003# Copyright (C) 2000 Cosmin Truta
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05004# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05005#
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -05006# This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -05007# For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -05008# and license in png.h
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -06009
10# Location of the zlib library and include files
11ZLIBINC = ../zlib
12ZLIBLIB = ../zlib
13
14# Compiler, linker, lib and other tools
15CC = gcc
16LD = $(CC)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060017AR_RC = ar rcs
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060018RANLIB = ranlib
Cosmin Truta82200da2014-03-22 09:29:59 -050019CP = cp
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060020RM_F = rm -f
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060021
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060022WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \
23 -Wmissing-declarations -Wtraditional -Wcast-align \
24 -Wstrict-prototypes -Wmissing-prototypes # -Wconversion
25CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
26CFLAGS = -W -Wall -O2 # $(WARNMORE) -g
27LDFLAGS =
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050028LIBS = -lz -lm
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060029
30# File extensions
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060031EXEEXT =
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060032
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050033# Pre-built configuration
34# See scripts/pnglibconf.mak for more options
35PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
36
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060037# Variables
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060038OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
39 pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
40 pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060041
42# Targets
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050043all: static
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050044
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050045pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
Glenn Randers-Pehrsonff649a02014-08-07 19:51:35 -050046 $(CP) $(PNGLIBCONF_H_PREBUILT) $@
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050047
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060048.c.o:
49 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050050
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060051static: libpng.a pngtest$(EXEEXT)
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050052
53shared:
54 @echo This is a generic makefile that cannot create shared libraries.
55 @echo Please use a configuration that is specific to your platform.
56 @false
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060057
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060058libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060059 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060060 $(RANLIB) $@
61
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060062test: pngtest$(EXEEXT)
63 ./pngtest$(EXEEXT)
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060064
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060065pngtest$(EXEEXT): pngtest.o libpng.a
66 $(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest.o libpng.a $(LIBS)
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060067
68clean:
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060069 $(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -060070
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060071png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
72pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
73pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
74pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
75pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
76pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
77pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
78pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
79pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
80pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
81pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
82pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
83pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
84pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
85pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050086
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060087pngtest.o: png.h pngconf.h pnglibconf.h