]>
Commit | Line | Data |
---|---|---|
0272a10d VZ |
1 | # makefile for SCO OSr5 ELF and Unixware 7 with Native cc |
2 | # Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx | |
3 | # force ELF build dynamic linking, SONAME setting in lib and RPATH in app | |
4 | # Copyright (C) 2002, 2006 Glenn Randers-Pehrson | |
5 | # Copyright (C) 1998 Greg Roelofs | |
6 | # Copyright (C) 1996, 1997 Andreas Dilger | |
7 | # For conditions of distribution and use, see copyright notice in png.h | |
8 | ||
9 | # Library name: | |
10 | LIBNAME = libpng12 | |
11 | PNGMAJ = 0 | |
970f6abe | 12 | PNGMIN = 1.2.34 |
0272a10d VZ |
13 | PNGVER = $(PNGMAJ).$(PNGMIN) |
14 | ||
15 | # Shared library names: | |
16 | LIBSO=$(LIBNAME).so | |
17 | LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) | |
18 | LIBSOVER=$(LIBNAME).so.$(PNGVER) | |
19 | OLDSO=libpng.so | |
20 | OLDSOMAJ=libpng.so.3 | |
21 | OLDSOVER=libpng.so.3.$(PNGMIN) | |
22 | ||
23 | # Utilities: | |
24 | CC=cc | |
25 | AR_RC=ar rc | |
26 | MKDIR_P=mkdir | |
27 | LN_SF=ln -f -s | |
28 | RANLIB=echo | |
29 | RM_F=/bin/rm -f | |
30 | ||
31 | # where make install puts libpng.a, $(OLDSO)*, and png.h | |
32 | prefix=/usr/local | |
33 | exec_prefix=$(prefix) | |
34 | ||
35 | # Where the zlib library and include files are located | |
36 | #ZLIBLIB=/usr/local/lib | |
37 | #ZLIBINC=/usr/local/include | |
38 | ZLIBLIB=../zlib | |
39 | ZLIBINC=../zlib | |
40 | ||
41 | CFLAGS= -dy -belf -I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE | |
42 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm | |
43 | ||
44 | INCPATH=$(prefix)/include/libpng | |
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) -KPIC -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: | |
970f6abe VZ |
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!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc | |
0272a10d VZ |
87 | |
88 | libpng-config: | |
89 | ( cat scripts/libpng-config-head.in; \ | |
90 | echo prefix=\"$(prefix)\"; \ | |
91 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
92 | echo ccopts=\"-belf\"; \ | |
93 | echo L_opts=\"-L$(LIBPATH)\"; \ | |
94 | echo libs=\"-lpng12 -lz -lm\"; \ | |
95 | cat scripts/libpng-config-body.in ) > libpng-config | |
96 | chmod +x libpng-config | |
97 | ||
98 | $(LIBSO): $(LIBSOMAJ) | |
99 | $(LN_SF) $(LIBSOMAJ) $(LIBSO) | |
100 | ||
101 | $(LIBSOMAJ): $(LIBSOVER) | |
102 | $(LN_SF) $(LIBSOVER) $(LIBSOMAJ) | |
103 | ||
104 | $(LIBSOVER): $(OBJSDLL) | |
105 | $(CC) -G -Wl,-h,$(LIBSOMAJ) -o $(LIBSOVER) \ | |
106 | $(OBJSDLL) | |
107 | ||
108 | $(OLDSOVER): $(OBJSDLL) | |
109 | $(CC) -G -Wl,-h,$(OLDSOMAJ) -o $(OLDSOVER) \ | |
110 | $(OBJSDLL) | |
111 | ||
112 | pngtest: pngtest.o $(LIBSO) | |
113 | LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
114 | ||
115 | test: pngtest | |
116 | ./pngtest | |
117 | ||
118 | install-headers: png.h pngconf.h | |
119 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi | |
120 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi | |
121 | -@$(RM_F) $(DI)/png.h | |
122 | -@$(RM_F) $(DI)/pngconf.h | |
123 | cp png.h pngconf.h $(DI)/$(LIBNAME) | |
124 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h | |
125 | -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h | |
126 | -@$(RM_F) $(DI)/libpng | |
127 | (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) | |
128 | ||
129 | install-static: install-headers libpng.a | |
130 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
131 | cp libpng.a $(DL)/$(LIBNAME).a | |
132 | chmod 644 $(DL)/$(LIBNAME).a | |
133 | -@$(RM_F) $(DL)/libpng.a | |
134 | (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) | |
135 | ||
136 | install-shared: install-headers $(LIBSOVER) libpng.pc \ | |
137 | $(OLDSOVER) | |
138 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
139 | -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO) | |
140 | -@$(RM_F) $(DL)/$(LIBSOMAJ) | |
141 | -@$(RM_F) $(DL)/$(OLDSO) | |
142 | -@$(RM_F) $(DL)/$(OLDSOMAJ) | |
143 | -@$(RM_F) $(DL)/$(OLDSOVER)* | |
144 | cp $(LIBSOVER) $(DL) | |
145 | cp $(OLDSOVER) $(DL) | |
146 | chmod 755 $(DL)/$(LIBSOVER) | |
147 | chmod 755 $(DL)/$(OLDSOVER) | |
148 | (cd $(DL); \ | |
149 | $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \ | |
150 | $(LN_SF) $(OLDSOMAJ) $(OLDSO); \ | |
151 | $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \ | |
152 | $(LN_SF) $(LIBSOMAJ) $(LIBSO)) | |
153 | -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi | |
154 | -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc | |
155 | -@$(RM_F) $(DL)/pkgconfig/libpng.pc | |
156 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
157 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
158 | (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) | |
159 | ||
160 | install-man: libpng.3 libpngpf.3 png.5 | |
161 | -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi | |
162 | -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi | |
163 | -@$(RM_F) $(DM)/man3/libpng.3 | |
164 | -@$(RM_F) $(DM)/man3/libpngpf.3 | |
165 | cp libpng.3 $(DM)/man3 | |
166 | cp libpngpf.3 $(DM)/man3 | |
167 | -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi | |
168 | -@$(RM_F) $(DM)/man5/png.5 | |
169 | cp png.5 $(DM)/man5 | |
170 | ||
171 | install-config: libpng-config | |
172 | -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi | |
173 | -@$(RM_F) $(DB)/libpng-config | |
174 | -@$(RM_F) $(DB)/$(LIBNAME)-config | |
175 | cp libpng-config $(DB)/$(LIBNAME)-config | |
176 | chmod 755 $(DB)/$(LIBNAME)-config | |
177 | (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config) | |
178 | ||
179 | install: install-static install-shared install-man install-config | |
180 | ||
181 | # If you installed in $(DESTDIR), test-installed won't work until you | |
182 | # move the library to its final location. Use test-dd to test it | |
183 | # before then. | |
184 | ||
185 | test-dd: | |
186 | echo | |
187 | echo Testing installed dynamic shared library in $(DL). | |
188 | $(CC) -I$(DI) $(CFLAGS) \ | |
189 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
190 | -L$(DL) -L$(ZLIBLIB) \ | |
191 | -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
192 | ./pngtestd pngtest.png | |
193 | ||
194 | test-installed: | |
195 | $(CC) $(CFLAGS) \ | |
196 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
197 | -L$(ZLIBLIB) \ | |
198 | -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
199 | ./pngtesti pngtest.png | |
200 | ||
201 | clean: | |
202 | $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \ | |
203 | $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \ | |
204 | $(OLDSOVER) \ | |
205 | libpng.pc | |
206 | ||
207 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
208 | writelock: | |
209 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
210 | ||
211 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
212 | ||
213 | png.o png.pic.o: png.h pngconf.h | |
214 | pngerror.o pngerror.pic.o: png.h pngconf.h | |
215 | pngrio.o pngrio.pic.o: png.h pngconf.h | |
216 | pngwio.o pngwio.pic.o: png.h pngconf.h | |
217 | pngmem.o pngmem.pic.o: png.h pngconf.h | |
218 | pngset.o pngset.pic.o: png.h pngconf.h | |
219 | pngget.o pngget.pic.o: png.h pngconf.h | |
220 | pngread.o pngread.pic.o: png.h pngconf.h | |
221 | pngrtran.o pngrtran.pic.o: png.h pngconf.h | |
222 | pngrutil.o pngrutil.pic.o: png.h pngconf.h | |
223 | pngtrans.o pngtrans.pic.o: png.h pngconf.h | |
224 | pngwrite.o pngwrite.pic.o: png.h pngconf.h | |
225 | pngwtran.o pngwtran.pic.o: png.h pngconf.h | |
226 | pngwutil.o pngwutil.pic.o: png.h pngconf.h | |
227 | pngpread.o pngpread.pic.o: png.h pngconf.h | |
228 | ||
229 | pngtest.o: png.h pngconf.h |