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