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.8
|
---|
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) -lpng12 -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: $(LIBNAME)$(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)/$(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 |
|
---|
92 | clean:
|
---|
93 | /bin/rm -f *.o $(LIBNAME)$(A) pngtest pngout.png
|
---|
94 |
|
---|
95 | png$(O): png.h pngconf.h
|
---|
96 | pngerror$(O): png.h pngconf.h
|
---|
97 | pngget$(O): png.h pngconf.h
|
---|
98 | pngmem$(O): png.h pngconf.h
|
---|
99 | pngpread$(O): png.h pngconf.h
|
---|
100 | pngread$(O): png.h pngconf.h
|
---|
101 | pngrio$(O): png.h pngconf.h
|
---|
102 | pngrtran$(O): png.h pngconf.h
|
---|
103 | pngrutil$(O): png.h pngconf.h
|
---|
104 | pngset$(O): png.h pngconf.h
|
---|
105 | pngtest$(O): png.h pngconf.h
|
---|
106 | pngtrans$(O): png.h pngconf.h
|
---|
107 | pngwio$(O): png.h pngconf.h
|
---|
108 | pngwrite$(O): png.h pngconf.h
|
---|
109 | pngwtran$(O): png.h pngconf.h
|
---|
110 | pngwutil$(O): png.h pngconf.h
|
---|
111 |
|
---|