]>
Commit | Line | Data |
---|---|---|
1 | # makefile for libpng on Solaris 2.x with gcc | |
2 | # Copyright (C) 2002 Glenn Randers-Pehrson | |
3 | # Contributed by William L. Sebok, based on makefile.linux | |
4 | # Copyright (C) 1998 Greg Roelofs | |
5 | # Copyright (C) 1996, 1997 Andreas Dilger | |
6 | # For conditions of distribution and use, see copyright notice in png.h | |
7 | ||
8 | CC=gcc | |
9 | ||
10 | # Where make install puts libpng.a, libpng12.so*, and png.h | |
11 | prefix=/usr/local | |
12 | ||
13 | # Where the zlib library and include files are located | |
14 | # Changing these to ../zlib poses a security risk. If you want | |
15 | # to have zlib in an adjacent directory, specify the full path instead of "..". | |
16 | #ZLIBLIB=../zlib | |
17 | #ZLIBINC=../zlib | |
18 | ||
19 | ZLIBLIB=/usr/local/lib | |
20 | ZLIBINC=/usr/local/include | |
21 | ||
22 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ | |
23 | -Wmissing-declarations -Wtraditional -Wcast-align \ | |
24 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion | |
25 | CFLAGS=-I$(ZLIBINC) -Wall -O3 \ | |
26 | # $(WARNMORE) -g -DPNG_DEBUG=5 | |
27 | LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm | |
28 | ||
29 | #RANLIB=ranlib | |
30 | RANLIB=echo | |
31 | ||
32 | PNGMAJ = 0 | |
33 | PNGMIN = 1.2.4 | |
34 | PNGVER = $(PNGMAJ).$(PNGMIN) | |
35 | LIBNAME = libpng12 | |
36 | ||
37 | INCPATH=$(prefix)/include | |
38 | LIBPATH=$(prefix)/lib | |
39 | MANPATH=$(prefix)/man | |
40 | BINPATH=$(prefix)/bin | |
41 | ||
42 | # override DESTDIR= on the make install command line to easily support | |
43 | # installing into a temporary location. Example: | |
44 | # | |
45 | # make install DESTDIR=/tmp/build/libpng | |
46 | # | |
47 | # If you're going to install into a temporary location | |
48 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
49 | # you execute make install. | |
50 | DESTDIR= | |
51 | ||
52 | DB=$(DESTDIR)$(BINPATH) | |
53 | DI=$(DESTDIR)$(INCPATH) | |
54 | DL=$(DESTDIR)$(LIBPATH) | |
55 | DM=$(DESTDIR)$(MANPATH) | |
56 | ||
57 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ | |
58 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ | |
59 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
60 | ||
61 | OBJSDLL = $(OBJS:.o=.pic.o) | |
62 | ||
63 | .SUFFIXES: .c .o .pic.o | |
64 | ||
65 | .c.pic.o: | |
66 | $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c | |
67 | ||
68 | all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config | |
69 | ||
70 | libpng.a: $(OBJS) | |
71 | ar rc $@ $(OBJS) | |
72 | $(RANLIB) $@ | |
73 | ||
74 | libpng.pc: | |
75 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc | |
76 | ||
77 | libpng-config: | |
78 | ( cat scripts/libpng-config-head.in; \ | |
79 | echo prefix=\"$(prefix)\"; \ | |
80 | echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \ | |
81 | -DPNG_NO_ASSEMBLER_CODE\"; \ | |
82 | echo cflags=\"$(ABI)\"; \ | |
83 | echo ldflags=\"-L$(LIBPATH) -R$(LIBPATH)\"; \ | |
84 | echo libs=\"-lpng12 -lz -lm\"; \ | |
85 | cat scripts/libpng-config-body.in ) > libpng-config | |
86 | chmod +x libpng-config | |
87 | ||
88 | $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) | |
89 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so | |
90 | ||
91 | $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER) | |
92 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) | |
93 | ||
94 | $(LIBNAME).so.$(PNGVER): $(OBJSDLL) | |
95 | @case "`type ld`" in *ucb*) \ | |
96 | echo; \ | |
97 | echo '## WARNING:'; \ | |
98 | echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \ | |
99 | echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \ | |
100 | echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \ | |
101 | echo '## The environment variable LD_LIBRARY_PATH should not be set'; \ | |
102 | echo '## at all. If it is, things are likely to break because of'; \ | |
103 | echo '## the libucb dependency that is created.'; \ | |
104 | echo; \ | |
105 | ;; \ | |
106 | esac | |
107 | $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \ | |
108 | -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz | |
109 | ||
110 | pngtest: pngtest.o $(LIBNAME).so | |
111 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
112 | ||
113 | test: pngtest | |
114 | ./pngtest | |
115 | ||
116 | install-headers: png.h pngconf.h | |
117 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi | |
118 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi | |
119 | cp png.h pngconf.h $(DI)/$(LIBNAME) | |
120 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h | |
121 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h | |
122 | -@/bin/rm -f $(DI)/libpng | |
123 | (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .) | |
124 | ||
125 | install-static: install-headers libpng.a | |
126 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi | |
127 | cp libpng.a $(DL)/$(LIBNAME).a | |
128 | chmod 644 $(DL)/$(LIBNAME).a | |
129 | -@/bin/rm -f $(DL)/libpng.a | |
130 | (cd $(DL); ln -f -s $(LIBNAME).a libpng.a) | |
131 | ||
132 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc | |
133 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi | |
134 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so | |
135 | -@/bin/rm -f $(DL)/libpng.so | |
136 | -@/bin/rm -f $(DL)/libpng.so.3 | |
137 | -@/bin/rm -f $(DL)/libpng.so.3.* | |
138 | cp $(LIBNAME).so.$(PNGVER) $(DL) | |
139 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) | |
140 | (cd $(DL); \ | |
141 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ | |
142 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \ | |
143 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \ | |
144 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \ | |
145 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)) | |
146 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi | |
147 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc | |
148 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc | |
149 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
150 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
151 | (cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc) | |
152 | ||
153 | install-man: libpng.3 libpngpf.3 png.5 | |
154 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi | |
155 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi | |
156 | -@/bin/rm -f $(DM)/man3/libpng.3 | |
157 | -@/bin/rm -f $(DM)/man3/libpngpf.3 | |
158 | cp libpng.3 $(DM)/man3 | |
159 | cp libpngpf.3 $(DM)/man3 | |
160 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi | |
161 | -@/bin/rm -f $(DM)/man5/png.5 | |
162 | cp png.5 $(DM)/man5 | |
163 | ||
164 | install-config: libpng-config | |
165 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi | |
166 | -@/bin/rm -f $(DB)/libpng-config | |
167 | -@/bin/rm -f $(DB)/$(LIBNAME)-config | |
168 | cp libpng-config $(DB)/$(LIBNAME)-config | |
169 | chmod 755 $(DB)/$(LIBNAME)-config | |
170 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) | |
171 | ||
172 | install: install-static install-shared install-man install-config | |
173 | ||
174 | # If you installed in $(DESTDIR), test-installed won't work until you | |
175 | # move the library to its final location. | |
176 | ||
177 | test-installed: | |
178 | echo | |
179 | echo Testing installed dynamic shared library. | |
180 | $(CC) -I$(ZLIBINC) \ | |
181 | `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \ | |
182 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \ | |
183 | -L$(ZLIBLIB) -R$(ZLIBLIB) | |
184 | ./pngtesti pngtest.png | |
185 | ||
186 | clean: | |
187 | /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \ | |
188 | libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* | |
189 | ||
190 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
191 | writelock: | |
192 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
193 | ||
194 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
195 | ||
196 | png.o png.pic.o: png.h pngconf.h | |
197 | pngerror.o pngerror.pic.o: png.h pngconf.h | |
198 | pngrio.o pngrio.pic.o: png.h pngconf.h | |
199 | pngwio.o pngwio.pic.o: png.h pngconf.h | |
200 | pngmem.o pngmem.pic.o: png.h pngconf.h | |
201 | pngset.o pngset.pic.o: png.h pngconf.h | |
202 | pngget.o pngget.pic.o: png.h pngconf.h | |
203 | pngread.o pngread.pic.o: png.h pngconf.h | |
204 | pngrtran.o pngrtran.pic.o: png.h pngconf.h | |
205 | pngrutil.o pngrutil.pic.o: png.h pngconf.h | |
206 | pngtrans.o pngtrans.pic.o: png.h pngconf.h | |
207 | pngwrite.o pngwrite.pic.o: png.h pngconf.h | |
208 | pngwtran.o pngwtran.pic.o: png.h pngconf.h | |
209 | pngwutil.o pngwutil.pic.o: png.h pngconf.h | |
210 | pngpread.o pngpread.pic.o: png.h pngconf.h | |
211 | ||
212 | pngtest.o: png.h pngconf.h |