]>
Commit | Line | Data |
---|---|---|
c6b71bff GD |
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 | PNGMAJ = 0 | |
20 | PNGMIN = 1.2.4 | |
21 | PNGVER = $(PNGMAJ).$(PNGMIN) | |
22 | ||
23 | prefix=/usr/local | |
24 | INCPATH=$(prefix)/include | |
25 | LIBPATH=$(prefix)/lib | |
26 | ||
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 | |
33 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
34 | # you execute make install. | |
35 | DESTDIR= | |
36 | ||
37 | DI=$(DESTDIR)/$(INCPATH) | |
38 | DL=$(DESTDIR)/$(LIBPATH) | |
39 | ||
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 | |
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) | |
81 | ||
82 | clean: | |
83 | /bin/rm -f *.o libpng.a pngtest pngout.png | |
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 |