| 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
 | 
|---|
| 9 | ZLIBINC = ../zlib
 | 
|---|
| 10 | ZLIBLIB = ../zlib
 | 
|---|
| 11 | 
 | 
|---|
| 12 | # Compiler, linker, lib and other tools
 | 
|---|
| 13 | CC = gcc
 | 
|---|
| 14 | LD = $(CC)
 | 
|---|
| 15 | AR = ar rcs
 | 
|---|
| 16 | RANLIB = ranlib
 | 
|---|
| 17 | RM = rm -f
 | 
|---|
| 18 | 
 | 
|---|
| 19 | LIBNAME=libpng12
 | 
|---|
| 20 | PNGMAJ = 0
 | 
|---|
| 21 | PNGMIN = 1.2.5
 | 
|---|
| 22 | PNGVER = $(PNGMAJ).$(PNGMIN)
 | 
|---|
| 23 | 
 | 
|---|
| 24 | prefix=/usr/local
 | 
|---|
| 25 | INCPATH=$(prefix)/include
 | 
|---|
| 26 | LIBPATH=$(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.
 | 
|---|
| 36 | DESTDIR=
 | 
|---|
| 37 | 
 | 
|---|
| 38 | DI=$(DESTDIR)/$(INCPATH)
 | 
|---|
| 39 | DL=$(DESTDIR)/$(LIBPATH)
 | 
|---|
| 40 | 
 | 
|---|
| 41 | CDEBUG = -g -DPNG_DEBUG=5
 | 
|---|
| 42 | LDDEBUG =
 | 
|---|
| 43 | CRELEASE = -O2
 | 
|---|
| 44 | LDRELEASE = -s
 | 
|---|
| 45 | WARNMORE=-Wall
 | 
|---|
| 46 | CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
 | 
|---|
| 47 | LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm $(LDRELEASE)
 | 
|---|
| 48 | 
 | 
|---|
| 49 | # File extensions
 | 
|---|
| 50 | O=.o
 | 
|---|
| 51 | A=.a
 | 
|---|
| 52 | E=
 | 
|---|
| 53 | 
 | 
|---|
| 54 | # Variables
 | 
|---|
| 55 | OBJS = 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
 | 
|---|
| 60 | all: libpng$(A) pngtest$(E)
 | 
|---|
| 61 | 
 | 
|---|
| 62 | $(LIBNAME)$(A): $(OBJS)
 | 
|---|
| 63 |         $(AR) $@ $(OBJS)
 | 
|---|
| 64 |         $(RANLIB) $@
 | 
|---|
| 65 | 
 | 
|---|
| 66 | test: pngtest$(E)
 | 
|---|
| 67 |         ./pngtest$(E)
 | 
|---|
| 68 | 
 | 
|---|
| 69 | pngtest$(E): pngtest$(O) $(LIBNAME)$(A)
 | 
|---|
| 70 |         $(LD) -o $@ pngtest$(O) $(LDFLAGS)
 | 
|---|
| 71 | 
 | 
|---|
| 72 | install: $(LIBNAME)$(A)
 | 
|---|
| 73 |         -@if [ ! -d $(DI)  ]; then mkdir $(DI); fi
 | 
|---|
| 74 |         -@if [ ! -d $(DI)/libpng  ]; then mkdir $(DI)/libpng; fi
 | 
|---|
| 75 |         -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 | 
|---|
| 76 |         -@rm $(DI)/png.h
 | 
|---|
| 77 |         -@rm $(DI)/pngconf.h
 | 
|---|
| 78 |         cp png.h pngconf.h $(DI)/libpng
 | 
|---|
| 79 |         chmod 644 $(DI)/libpng/png.h \
 | 
|---|
| 80 |         cp $(LIBNAME)$(A) $(DL)
 | 
|---|
| 81 |         (cd $(DL); ln -f -s $(LIBNAME)$(A) libpng$(A))
 | 
|---|
| 82 |         $(DI)/libpng/pngconf.h
 | 
|---|
| 83 |         (cd $(DI); ln -f -s libpng/* .;)
 | 
|---|
| 84 | 
 | 
|---|
| 85 | clean:
 | 
|---|
| 86 |         /bin/rm -f *.o $(LIBNAME)$(A) pngtest pngout.png
 | 
|---|
| 87 | 
 | 
|---|
| 88 | png$(O): png.h pngconf.h
 | 
|---|
| 89 | pngerror$(O): png.h pngconf.h
 | 
|---|
| 90 | pngget$(O): png.h pngconf.h
 | 
|---|
| 91 | pngmem$(O): png.h pngconf.h
 | 
|---|
| 92 | pngpread$(O): png.h pngconf.h
 | 
|---|
| 93 | pngread$(O): png.h pngconf.h
 | 
|---|
| 94 | pngrio$(O): png.h pngconf.h
 | 
|---|
| 95 | pngrtran$(O): png.h pngconf.h
 | 
|---|
| 96 | pngrutil$(O): png.h pngconf.h
 | 
|---|
| 97 | pngset$(O): png.h pngconf.h
 | 
|---|
| 98 | pngtest$(O): png.h pngconf.h
 | 
|---|
| 99 | pngtrans$(O): png.h pngconf.h
 | 
|---|
| 100 | pngwio$(O): png.h pngconf.h
 | 
|---|
| 101 | pngwrite$(O): png.h pngconf.h
 | 
|---|
| 102 | pngwtran$(O): png.h pngconf.h
 | 
|---|
| 103 | pngwutil$(O): png.h pngconf.h
 | 
|---|
| 104 | 
 | 
|---|