]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.darwin
Fix MSVC warnings about signed to unsigned conversion in the tests.
[wxWidgets.git] / src / png / scripts / makefile.darwin
1 # makefile for libpng on Darwin / Mac OS X
2 # Copyright (C) 2002, 2004, 2006, 2008, 2010 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 #
8 # This code is released under the libpng license.
9 # For conditions of distribution and use, see the disclaimer
10 # and license in png.h
11
12 # where "make install" puts libpng.a, libpng14.dylib, png.h and pngconf.h
13 prefix=/usr/local
14 exec_prefix=$(prefix)
15
16 # Where the zlib library and include files are located
17 #ZLIBLIB=/usr/local/lib
18 #ZLIBINC=/usr/local/include
19 ZLIBLIB=../zlib
20 ZLIBINC=../zlib
21
22 # Library name:
23 LIBNAME = libpng14
24 PNGMAJ = 14
25
26 # Shared library names:
27 LIBSO=$(LIBNAME).dylib
28 LIBSOMAJ=$(LIBNAME).$(PNGMAJ).dylib
29 LIBSOREL=$(LIBNAME).$(PNGMAJ).$(RELEASE).dylib
30 OLDSO=libpng.dylib
31
32 # Utilities:
33 CC=cc
34 AR_RC=ar rc
35 MKDIR_P=mkdir -p
36 LN_SF=ln -sf
37 RANLIB=ranlib
38 RM_F=/bin/rm -f
39
40 # CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops
41 CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops
42 LDFLAGS=-L. -L$(ZLIBLIB) -lpng14 -lz
43
44 INCPATH=$(prefix)/include
45 LIBPATH=$(exec_prefix)/lib
46 MANPATH=$(prefix)/man
47 BINPATH=$(exec_prefix)/bin
48
49 # override DESTDIR= on the make install command line to easily support
50 # installing into a temporary location. Example:
51 #
52 # make install DESTDIR=/tmp/build/libpng
53 #
54 # If you're going to install into a temporary location
55 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
56 # you execute make install.
57 DESTDIR=
58
59 DB=$(DESTDIR)$(BINPATH)
60 DI=$(DESTDIR)$(INCPATH)
61 DL=$(DESTDIR)$(LIBPATH)
62 DM=$(DESTDIR)$(MANPATH)
63
64 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
65 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
66 pngwtran.o pngmem.o pngerror.o pngpread.o
67
68 OBJSDLL = $(OBJS:.o=.pic.o)
69
70 .SUFFIXES: .c .o .pic.o
71
72 .c.pic.o:
73 $(CC) -c $(CFLAGS) -fno-common -o $@ $*.c
74
75 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
76
77 libpng.a: $(OBJS)
78 $(AR_RC) $@ $(OBJS)
79 $(RANLIB) $@
80
81 libpng.pc:
82 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
83 -e s!@exec_prefix@!$(exec_prefix)! \
84 -e s!@libdir@!$(LIBPATH)! \
85 -e s!@includedir@!$(INCPATH)! \
86 -e s!-lpng14!-lpng14\ -lz! > libpng.pc
87
88 libpng-config:
89 ( cat scripts/libpng-config-head.in; \
90 echo prefix=\"$(prefix)\"; \
91 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
92 echo L_opts=\"-L$(LIBPATH)\"; \
93 echo libs=\"-lpng14 -lz\"; \
94 cat scripts/libpng-config-body.in ) > libpng-config
95 chmod +x libpng-config
96
97 $(LIBSO): $(LIBSOMAJ)
98 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
99
100 $(LIBSOMAJ): $(OBJSDLL)
101 $(CC) -dynamiclib \
102 -install_name $(LIBPATH)/$(LIBSOMAJ) \
103 -current_version 14 -compatibility_version 14 \
104 -o $(LIBSOMAJ) \
105 $(OBJSDLL) -L$(ZLIBLIB) -lz
106
107 pngtest: pngtest.o $(LIBSO)
108 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
109
110 test: pngtest
111 ./pngtest
112
113 install-headers: png.h pngconf.h
114 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
115 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
116 cp png.h pngconf.h $(DI)/$(LIBNAME)
117 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
118 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
119 -@$(RM_F) $(DI)/libpng
120 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
121
122 install-static: install-headers libpng.a
123 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
124 cp libpng.a $(DL)/$(LIBNAME).a
125 chmod 644 $(DL)/$(LIBNAME).a
126 $(RANLIB) $(DL)/$(LIBNAME).a
127 -@$(RM_F) $(DL)/libpng.a
128 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
129
130 install-shared: install-headers $(LIBSOMAJ) libpng.pc
131 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
132 -@$(RM_F) $(DL)/$(LIBSO)
133 -@$(RM_F) $(DL)/$(LIBSOREL)
134 -@$(RM_F) $(DL)/$(OLDSO)
135 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
136 chmod 755 $(DL)/$(LIBSOREL)
137 (cd $(DL); \
138 $(LN_SF) $(LIBSOREL) $(LIBSO); \
139 $(LN_SF) $(LIBSO) $(OLDSO))
140 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
141 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
142 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
143 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
144 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
145 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
146
147 install-man: libpng.3 libpngpf.3 png.5
148 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
149 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
150 -@$(RM_F) $(DM)/man3/libpng.3
151 -@$(RM_F) $(DM)/man3/libpngpf.3
152 cp libpng.3 $(DM)/man3
153 cp libpngpf.3 $(DM)/man3
154 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
155 -@$(RM_F) $(DM)/man5/png.5
156 cp png.5 $(DM)/man5
157
158 install-config: libpng-config
159 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
160 -@$(RM_F) $(DB)/libpng-config
161 -@$(RM_F) $(DB)/$(LIBNAME)-config
162 cp libpng-config $(DB)/$(LIBNAME)-config
163 chmod 755 $(DB)/$(LIBNAME)-config
164 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
165
166 install: install-static install-shared install-man install-config
167
168 # If you installed in $(DESTDIR), test-installed won't work until you
169 # move the library to its final location. Use test-dd to test it
170 # before then.
171
172 test-dd:
173 echo
174 echo Testing installed dynamic shared library in $(DL).
175 $(CC) -I$(DI) -I$(ZLIBINC) \
176 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
177 -L$(DL) -L$(ZLIBLIB) \
178 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
179 ./pngtestd pngtest.png
180
181 test-installed:
182 $(CC) $(CFLAGS) \
183 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
184 -L$(ZLIBLIB) \
185 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
186 ./pngtesti pngtest.png
187
188 clean:
189 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
190 libpng.pc $(LIBNAME).*dylib pngtesti
191
192 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
193 writelock:
194 chmod a-w *.[ch35] $(DOCS) scripts/*
195
196 # DO NOT DELETE THIS LINE -- make depend depends on it.
197
198 png.o png.pic.o: png.h pngconf.h pngpriv.h
199 pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h
200 pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h
201 pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h
202 pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h
203 pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h
204 pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h
205 pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h
206 pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h
207 pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h
208 pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h
209 pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h
210 pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h
211 pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h
212 pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h
213
214 pngtest.o: png.h pngconf.h