1# makefile for libpng using gcc (generic, static library) 2# Copyright (C) 2002 Glenn Randers-Pehrson 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. 6# 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 19LIBNAME=libpng12 20PNGMAJ = 0 21PNGMIN = 1.2.7 22PNGVER = $(PNGMAJ).$(PNGMIN) 23 24prefix=/usr/local 25INCPATH=$(prefix)/include 26LIBPATH=$(prefix)/lib 27 28# override DESTDIR= on the make install command line to easily support 29# installing into a temporary location. Example: 30# 31# make install DESTDIR=/tmp/build/libpng 32# 33# If you're going to install into a temporary location 34# via DESTDIR, $(DESTDIR)$(prefix) must already exist before 35# you execute make install. 36DESTDIR= 37 38DI=$(DESTDIR)$(INCPATH) 39DL=$(DESTDIR)$(LIBPATH) 40 41CDEBUG = -g -DPNG_DEBUG=5 42LDDEBUG = 43CRELEASE = -O2 44LDRELEASE = -s 45WARNMORE=-Wall 46CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE) 47LDFLAGS = -L. -L$(ZLIBLIB) -lpng12 -lz -lm $(LDRELEASE) 48 49# File extensions 50O=.o 51A=.a 52E= 53 54# Variables 55OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \ 56 pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \ 57 pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O) 58 59# Targets 60all: $(LIBNAME)$(A) pngtest$(E) 61 62$(LIBNAME)$(A): $(OBJS) 63 $(AR) $@ $(OBJS) 64 $(RANLIB) $@ 65 66test: pngtest$(E) 67 ./pngtest$(E) 68 69pngtest$(E): pngtest$(O) $(LIBNAME)$(A) 70 $(LD) -o $@ pngtest$(O) $(LDFLAGS) 71 72install: $(LIBNAME)$(A) 73 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi 74 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi 75 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi 76 -@rm -f $(DI)/$(LIBNAME)/png.h 77 -@rm -f $(DI)/$(LIBNAME)/pngconf.h 78 -@rm -f $(DI)/png.h 79 -@rm -f $(DI)/pngconf.h 80 cp png.h pngconf.h $(DI)/$(LIBNAME) 81 chmod 644 $(DI)/$(LIBNAME)/png.h \ 82 $(DI)/$(LIBNAME)/pngconf.h 83 -@rm -rf $(DI)/libpng 84 (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .) 85 -@rm -f $(DL)/$(LIBNAME)$(A) 86 -@rm -f $(DL)/libpng$(A) 87 cp $(LIBNAME)$(A) $(DL)/$(LIBNAME)$(A) 88 chmod 644 $(DL)/$(LIBNAME)$(A) 89 (cd $(DL); ln -f -s $(LIBNAME)$(A) libpng$(A)) 90 (cd $(DI); ln -f -s libpng/* .;) 91 92clean: 93 /bin/rm -f *.o $(LIBNAME)$(A) pngtest pngout.png 94 95png$(O): png.h pngconf.h 96pngerror$(O): png.h pngconf.h 97pngget$(O): png.h pngconf.h 98pngmem$(O): png.h pngconf.h 99pngpread$(O): png.h pngconf.h 100pngread$(O): png.h pngconf.h 101pngrio$(O): png.h pngconf.h 102pngrtran$(O): png.h pngconf.h 103pngrutil$(O): png.h pngconf.h 104pngset$(O): png.h pngconf.h 105pngtest$(O): png.h pngconf.h 106pngtrans$(O): png.h pngconf.h 107pngwio$(O): png.h pngconf.h 108pngwrite$(O): png.h pngconf.h 109pngwtran$(O): png.h pngconf.h 110pngwutil$(O): png.h pngconf.h 111 112