Glenn Randers-Pehrson | d56aca7 | 2000-11-23 11:51:42 -0600 | [diff] [blame] | 1 | # makefile for libpng using gcc (generic, static library) |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 2 | # Copyright (C) 2002 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | d56aca7 | 2000-11-23 11:51:42 -0600 | [diff] [blame] | 3 | # Copyright (C) 2000 Cosmin Truta |
| 4 | # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc) |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 5 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. |
Glenn Randers-Pehrson | d56aca7 | 2000-11-23 11:51:42 -0600 | [diff] [blame] | 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 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 19 | PNGMAJ = 0 |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame^] | 20 | PNGMIN = 1.2.5rc1 |
Glenn Randers-Pehrson | d56aca7 | 2000-11-23 11:51:42 -0600 | [diff] [blame] | 21 | PNGVER = $(PNGMAJ).$(PNGMIN) |
| 22 | |
| 23 | prefix=/usr/local |
| 24 | INCPATH=$(prefix)/include |
| 25 | LIBPATH=$(prefix)/lib |
| 26 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 27 | # 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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 33 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 34 | # you execute make install. |
| 35 | DESTDIR= |
| 36 | |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 37 | DI=$(DESTDIR)/$(INCPATH) |
| 38 | DL=$(DESTDIR)/$(LIBPATH) |
| 39 | |
Glenn Randers-Pehrson | d56aca7 | 2000-11-23 11:51:42 -0600 | [diff] [blame] | 40 | CDEBUG = -g -DPNG_DEBUG=5 |
| 41 | LDDEBUG = |
| 42 | CRELEASE = -O2 |
| 43 | LDRELEASE = -s |
| 44 | CFLAGS = -I$(ZLIBINC) -Wall $(CRELEASE) |
| 45 | LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm $(LDRELEASE) |
| 46 | |
| 47 | # File extensions |
| 48 | O=.o |
| 49 | A=.a |
| 50 | E= |
| 51 | |
| 52 | # Variables |
| 53 | OBJS = 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 |
| 58 | all: libpng$(A) pngtest$(E) |
| 59 | |
| 60 | libpng$(A): $(OBJS) |
| 61 | $(AR) $@ $(OBJS) |
| 62 | $(RANLIB) $@ |
| 63 | |
| 64 | test: pngtest$(E) |
| 65 | ./pngtest$(E) |
| 66 | |
| 67 | pngtest$(E): pngtest$(O) libpng$(A) |
| 68 | $(LD) -o $@ pngtest$(O) $(LDFLAGS) |
| 69 | |
| 70 | install: libpng.a |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 71 | -@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-Pehrson | d56aca7 | 2000-11-23 11:51:42 -0600 | [diff] [blame] | 81 | |
| 82 | clean: |
Glenn Randers-Pehrson | ae498dc | 2001-11-24 14:53:31 -0600 | [diff] [blame] | 83 | /bin/rm -f *.o libpng.a pngtest pngout.png |
Glenn Randers-Pehrson | d56aca7 | 2000-11-23 11:51:42 -0600 | [diff] [blame] | 84 | |
| 85 | png$(O): png.h pngconf.h |
| 86 | pngerror$(O): png.h pngconf.h |
| 87 | pngget$(O): png.h pngconf.h |
| 88 | pngmem$(O): png.h pngconf.h |
| 89 | pngpread$(O): png.h pngconf.h |
| 90 | pngread$(O): png.h pngconf.h |
| 91 | pngrio$(O): png.h pngconf.h |
| 92 | pngrtran$(O): png.h pngconf.h |
| 93 | pngrutil$(O): png.h pngconf.h |
| 94 | pngset$(O): png.h pngconf.h |
| 95 | pngtest$(O): png.h pngconf.h |
| 96 | pngtrans$(O): png.h pngconf.h |
| 97 | pngwio$(O): png.h pngconf.h |
| 98 | pngwrite$(O): png.h pngconf.h |
| 99 | pngwtran$(O): png.h pngconf.h |
| 100 | pngwutil$(O): png.h pngconf.h |
| 101 | |