blob: 167fedb611d68b28be2aed61e52b5a039136deb4 [file] [log] [blame]
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001# makefile for libpng using gcc (generic, static library)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -05002# Copyright (C) 2002 Glenn Randers-Pehrson
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06003# Copyright (C) 2000 Cosmin Truta
4# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -05005# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06006# For conditions of distribution and use, see copyright notice in png.h
7
8# Location of the zlib library and include files
9ZLIBINC = ../zlib
10ZLIBLIB = ../zlib
11
12# Compiler, linker, lib and other tools
13CC = gcc
14LD = $(CC)
15AR = ar rcs
16RANLIB = ranlib
17RM = rm -f
18
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060019PNGMAJ = 0
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -050020PNGMIN = 1.2.5rc1
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060021PNGVER = $(PNGMAJ).$(PNGMIN)
22
23prefix=/usr/local
24INCPATH=$(prefix)/include
25LIBPATH=$(prefix)/lib
26
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050027# override DESTDIR= on the make install command line to easily support
28# installing into a temporary location. Example:
29#
30# make install DESTDIR=/tmp/build/libpng
31#
32# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050033# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050034# you execute make install.
35DESTDIR=
36
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050037DI=$(DESTDIR)/$(INCPATH)
38DL=$(DESTDIR)/$(LIBPATH)
39
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060040CDEBUG = -g -DPNG_DEBUG=5
41LDDEBUG =
42CRELEASE = -O2
43LDRELEASE = -s
44CFLAGS = -I$(ZLIBINC) -Wall $(CRELEASE)
45LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm $(LDRELEASE)
46
47# File extensions
48O=.o
49A=.a
50E=
51
52# Variables
53OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
54 pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
55 pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
56
57# Targets
58all: libpng$(A) pngtest$(E)
59
60libpng$(A): $(OBJS)
61 $(AR) $@ $(OBJS)
62 $(RANLIB) $@
63
64test: pngtest$(E)
65 ./pngtest$(E)
66
67pngtest$(E): pngtest$(O) libpng$(A)
68 $(LD) -o $@ pngtest$(O) $(LDFLAGS)
69
70install: libpng.a
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050071 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
72 -@if [ ! -d $(DI)/libpng ]; then mkdir $(DI)/libpng; fi
73 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
74 -@rm $(DI)/png.h
75 -@rm $(DI)/pngconf.h
76 cp png.h pngconf.h $(DI)/libpng
77 chmod 644 $(DI)/libpng/png.h \
78 $(DI)/libpng/pngconf.h
79 (cd $(DI); ln -f -s libpng/* .)
80 cp libpng.a $(DL)
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060081
82clean:
Glenn Randers-Pehrsonae498dc2001-11-24 14:53:31 -060083 /bin/rm -f *.o libpng.a pngtest pngout.png
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060084
85png$(O): png.h pngconf.h
86pngerror$(O): png.h pngconf.h
87pngget$(O): png.h pngconf.h
88pngmem$(O): png.h pngconf.h
89pngpread$(O): png.h pngconf.h
90pngread$(O): png.h pngconf.h
91pngrio$(O): png.h pngconf.h
92pngrtran$(O): png.h pngconf.h
93pngrutil$(O): png.h pngconf.h
94pngset$(O): png.h pngconf.h
95pngtest$(O): png.h pngconf.h
96pngtrans$(O): png.h pngconf.h
97pngwio$(O): png.h pngconf.h
98pngwrite$(O): png.h pngconf.h
99pngwtran$(O): png.h pngconf.h
100pngwutil$(O): png.h pngconf.h
101