]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.darwin
fixes, rewrites, adopting the posix way of resume/suspend (while using MP-API) as...
[wxWidgets.git] / src / png / scripts / makefile.darwin
CommitLineData
c6b71bff
GD
1# makefile for libpng on Darwin / Mac OS X
2# Copyright (C) 2002 Glenn Randers-Pehrson
3# Copyright (C) 2001 Christoph Pfisterer
4# derived from makefile.linux:
5# Copyright (C) 1998, 1999 Greg Roelofs
6# Copyright (C) 1996, 1997 Andreas Dilger
7# For conditions of distribution and use, see copyright notice in png.h
8
9# where "make install" puts libpng.a, libpng12.dylib, png.h and pngconf.h
10prefix=/usr/local
11
12# Where the zlib library and include files are located
13#ZLIBLIB=/usr/local/lib
14#ZLIBINC=/usr/local/include
15ZLIBLIB=../zlib
16ZLIBINC=../zlib
17
18CC=cc
19CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops
20LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz
21
22#RANLIB=echo
23RANLIB=ranlib
24
25PNGMAJ = 0
26PNGMIN = 1.2.4
27PNGVER = $(PNGMAJ).$(PNGMIN)
28LIBNAME = libpng12
29
30INCPATH=$(prefix)/include
31LIBPATH=$(prefix)/lib
32MANPATH=$(prefix)/man
33BINPATH=$(prefix)/bin
34
35# override DESTDIR= on the make install command line to easily support
36# installing into a temporary location. Example:
37#
38# make install DESTDIR=/tmp/build/libpng
39#
40# If you're going to install into a temporary location
41# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
42# you execute make install.
43DESTDIR=
44
45DB=$(DESTDIR)$(BINPATH)
46DI=$(DESTDIR)$(INCPATH)
47DL=$(DESTDIR)$(LIBPATH)
48DM=$(DESTDIR)$(MANPATH)
49
50OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
51 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
52 pngwtran.o pngmem.o pngerror.o pngpread.o
53
54OBJSDLL = $(OBJS:.o=.pic.o)
55
56.SUFFIXES: .c .o .pic.o
57
58.c.pic.o:
59 $(CC) -c $(CFLAGS) -fno-common -o $@ $*.c
60
61all: libpng.a $(LIBNAME).dylib pngtest libpng.pc libpng-config
62
63libpng.a: $(OBJS)
64 ar rc $@ $(OBJS)
65 $(RANLIB) $@
66
67libpng.pc:
68 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \
69 sed -e s/-lm// > libpng.pc
70
71libpng-config:
72 ( cat scripts/libpng-config-head.in; \
73 echo prefix=\"$(prefix)\"; \
74 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
75 echo cflags=\"\"; \
76 echo ldflags=\"-L$(LIBPATH)\"; \
77 echo libs=\"-lpng12 -lz\"; \
78 cat scripts/libpng-config-body.in ) > libpng-config
79 chmod +x libpng-config
80
81$(LIBNAME).dylib: $(LIBNAME).$(PNGMAJ).dylib
82 ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib
83
84$(LIBNAME).$(PNGMAJ).dylib: $(LIBNAME).$(PNGVER).dylib
85 ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib
86
87$(LIBNAME).$(PNGVER).dylib: $(OBJSDLL)
88 $(CC) -dynamiclib \
89 -install_name $(DL)/$(LIBNAME).$(PNGMAJ).dylib \
90 -current_version $(PNGMIN) -compatibility_version $(PNGMIN) \
91 -o $(LIBNAME).$(PNGVER).dylib \
92 $(OBJSDLL) -L$(ZLIBLIB) -lz
93
94pngtest: pngtest.o $(LIBNAME).dylib
95 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
96
97test: pngtest
98 ./pngtest
99
100install-headers: png.h pngconf.h
101 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
102 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
103 cp png.h pngconf.h $(DI)/$(LIBNAME)
104 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
105 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
106 -@/bin/rm -f $(DI)/libpng
107 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
108
109install-static: install-headers libpng.a
110 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
111 cp libpng.a $(DL)/$(LIBNAME).a
112 chmod 644 $(DL)/$(LIBNAME).a
113 -@/bin/rm -f $(DL)/libpng.a
114 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
115
116install-shared: install-headers $(LIBNAME).dylib libpng.pc
117 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
118 -@/bin/rm -f $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib
119 -@/bin/rm -f $(DL)/$(LIBNAME).dylib
120 -@/bin/rm -f $(DL)/libpng.dylib
121 -@/bin/rm -f $(DL)/libpng.3.dylib
122 -@/bin/rm -f $(DL)/libpng.3.*.dylib
123 cp $(LIBNAME).$(PNGVER).dylib $(DL)
124 chmod 755 $(DL)/$(LIBNAME).$(PNGVER).dylib
125 (cd $(DL); \
126 ln -sf $(LIBNAME).$(PNGVER).dylib libpng.dylib; \
127 ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.dylib; \
128 ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.$(PNGMIN).dylib; \
129 ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \
130 ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib)
131 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
132 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
133 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
134 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
135 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
136 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
137
138install-man: libpng.3 libpngpf.3 png.5
139 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
140 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
141 -@/bin/rm -f $(DM)/man3/libpng.3
142 -@/bin/rm -f $(DM)/man3/libpngpf.3
143 cp libpng.3 $(DM)/man3
144 cp libpngpf.3 $(DM)/man3
145 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
146 -@/bin/rm -f $(DM)/man5/png.5
147 cp png.5 $(DM)/man5
148
149install-config: libpng-config
150 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
151 -@/bin/rm -f $(DB)/libpng-config
152 -@/bin/rm -f $(DB)/$(LIBNAME)-config
153 cp libpng-config $(DB)/$(LIBNAME)-config
154 chmod 755 $(DB)/$(LIBNAME)-config
155 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
156
157install: install-static install-shared install-man install-config
158
159# If you installed in $(DESTDIR), test-installed won't work until you
160# move the library to its final location.
161
162test-installed:
163 $(CC) $(CFLAGS) \
164 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
165 -L$(ZLIBLIB) \
166 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
167 ./pngtesti pngtest.png
168
169clean:
170 rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
171 $(LIBNAME).*dylib pngtesti
172
173DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
174writelock:
175 chmod a-w *.[ch35] $(DOCS) scripts/*
176
177# DO NOT DELETE THIS LINE -- make depend depends on it.
178
179png.o png.pic.o: png.h pngconf.h
180pngerror.o pngerror.pic.o: png.h pngconf.h
181pngrio.o pngrio.pic.o: png.h pngconf.h
182pngwio.o pngwio.pic.o: png.h pngconf.h
183pngmem.o pngmem.pic.o: png.h pngconf.h
184pngset.o pngset.pic.o: png.h pngconf.h
185pngget.o pngget.pic.o: png.h pngconf.h
186pngread.o pngread.pic.o: png.h pngconf.h
187pngrtran.o pngrtran.pic.o: png.h pngconf.h
188pngrutil.o pngrutil.pic.o: png.h pngconf.h
189pngtrans.o pngtrans.pic.o: png.h pngconf.h
190pngwrite.o pngwrite.pic.o: png.h pngconf.h
191pngwtran.o pngwtran.pic.o: png.h pngconf.h
192pngwutil.o pngwutil.pic.o: png.h pngconf.h
193pngpread.o pngpread.pic.o: png.h pngconf.h
194
195pngtest.o: png.h pngconf.h