]> git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/Makefile
Merge changes from CUPS 1.4svn-r7874.
[thirdparty/cups.git] / cgi-bin / Makefile
1 #
2 # "$Id: Makefile 7558 2008-05-12 23:46:44Z mike $"
3 #
4 # CGI makefile for the Common UNIX Printing System (CUPS).
5 #
6 # Copyright 2007-2008 by Apple Inc.
7 # Copyright 1997-2006 by Easy Software Products.
8 #
9 # These coded instructions, statements, and computer programs are the
10 # property of Apple Inc. and are protected by Federal copyright
11 # law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 # which should have been included with this file. If this file is
13 # file is missing or damaged, see the license at "http://www.cups.org/".
14 #
15
16 include ../Makedefs
17
18 LIBOBJS = \
19 help-index.o \
20 html.o \
21 ipp-var.o \
22 search.o \
23 template.o \
24 var.o
25 LIB32OBJS = $(LIBOBJS:.o=.32.o)
26 LIB64OBJS = $(LIBOBJS:.o=.64.o)
27 OBJS = \
28 $(LIBOBJS) \
29 $(LIB32OBJS) \
30 $(LIB64OBJS) \
31 admin.o \
32 classes.o \
33 help.o \
34 jobs.o \
35 printers.o \
36 testcgi.o \
37 testhi.o \
38 testtemplate.o \
39 websearch.o
40 CGIS = \
41 admin.cgi \
42 classes.cgi \
43 help.cgi \
44 jobs.cgi \
45 printers.cgi
46 LIBTARGETS = \
47 libcupscgi.a \
48 $(LIBCUPSCGI) \
49 $(LIB32CUPSCGI) \
50 $(LIB32CUPSCGI) \
51 websearch
52
53 UNITTARGETS = \
54 testcgi \
55 testhi \
56 testtemplate
57
58 TARGETS = \
59 $(LIBTARGETS) \
60 $(CGIS)
61
62
63 #
64 # Make all targets...
65 #
66
67 all: $(TARGETS)
68
69
70 #
71 # Make library targets...
72 #
73
74 libs: $(LIBTARGETS) $(UNITTESTS)
75
76
77 #
78 # Make unit tests...
79 #
80
81 unittests: $(UNITTARGETS)
82
83
84 #
85 # Clean all object files...
86 #
87
88 clean:
89 $(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
90 $(RM) libcupscgi.so libcupscgi.sl libcupscgi.dylib
91 $(RM) -r 32bit 64bit
92
93
94 #
95 # Update dependencies (without system header dependencies...)
96 #
97
98 depend:
99 touch Dependencies.tmp
100 makedepend -Y -I.. -fDependencies.tmp $(OBJS:.o=.c) >/dev/null 2>&1
101 $(RM) Dependencies
102 cp Dependencies.tmp Dependencies
103 sed -E -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies
104 sed -E -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies
105 $(RM) Dependencies.tmp
106
107
108 #
109 # Install all targets...
110 #
111
112 install: all install-data install-headers install-libs install-exec
113
114
115 #
116 # Install data files...
117 #
118
119 install-data:
120
121
122 #
123 # Install programs...
124 #
125
126 install-exec:
127 $(INSTALL_DIR) -m 755 $(SERVERBIN)/cgi-bin
128 for file in $(CGIS); do \
129 $(INSTALL_BIN) $$file $(SERVERBIN)/cgi-bin; \
130 done
131 if test "x$(SYMROOT)" != "x"; then \
132 $(INSTALL_DIR) $(SYMROOT); \
133 for file in $(TARGETS); do \
134 cp $$file $(SYMROOT); \
135 done \
136 fi
137
138
139 #
140 # Install headers...
141 #
142
143 install-headers:
144 echo Installing header files in $(INCLUDEDIR)/cups...
145 $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
146 $(INSTALL_DATA) cgi.h $(INCLUDEDIR)/cups
147 $(INSTALL_DATA) help-index.h $(INCLUDEDIR)/cups
148
149
150 #
151 # Install libraries...
152 #
153
154 install-libs: $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
155 echo Installing libraries in $(LIBDIR)...
156 $(INSTALL_DIR) -m 755 $(LIBDIR)
157 $(INSTALL_LIB) $(LIBCUPSCGI) $(LIBDIR)
158 if test $(LIBCUPSCGI) = "libcupscgi.so.1" -o $(LIBCUPSCGI) = "libcupscgi.sl.1"; then \
159 $(RM) $(LIBDIR)/`basename $(LIBCUPSCGI) .1`; \
160 $(LN) $(LIBCUPSCGI) $(LIBDIR)/`basename $(LIBCUPSCGI) .1`; \
161 fi
162 if test $(LIBCUPSCGI) = "libcupscgi.1.dylib"; then \
163 $(RM) $(LIBDIR)/libcupscgi.dylib; \
164 $(LN) $(LIBCUPSCGI) $(LIBDIR)/libcupscgi.dylib; \
165 fi
166 if test "x$(SYMROOT)" != "x"; then \
167 $(INSTALL_DIR) $(SYMROOT); \
168 cp $(LIBCUPSCGI) $(SYMROOT); \
169 fi
170
171 installstatic:
172 $(INSTALL_DIR) -m 755 $(LIBDIR)
173 $(INSTALL_LIB) libcupscgi.a $(LIBDIR)
174 $(RANLIB) $(LIBDIR)/libcupscgi.a
175
176 install32bit:
177 echo Installing libraries in $(LIB32DIR)...
178 $(INSTALL_DIR) -m 755 $(LIB32DIR)
179 $(INSTALL_LIB) 32bit/libcupscgi.so.1 $(LIB32DIR)/libcupscgi.so.1
180 $(LN) libcupscgi.so.1 $(LIB32DIR)/libcupscgi.so
181
182 install64bit:
183 echo Installing libraries in $(LIB64DIR)...
184 $(INSTALL_DIR) -m 755 $(LIB64DIR)
185 $(INSTALL_LIB) 64bit/libcupscgi.so.1 $(LIB64DIR)/libcupscgi.so.1
186 $(LN) libcupscgi.so.1 $(LIB64DIR)/libcupscgi.so
187
188
189 #
190 # Uninstall all targets...
191 #
192
193 uninstall: $(UNINSTALL32) $(UNINSTALL64)
194 for file in $(CGIS); do \
195 $(RM) $(SERVERBIN)/cgi-bin/$$file; \
196 done
197 -$(RMDIR) $(SERVERBIN)/cgi-bin
198 $(RM) $(LIBDIR)/libcupscgi.1.dylib
199 $(RM) $(LIBDIR)/libcupscgi.a
200 $(RM) $(LIBDIR)/libcupscgi.dylib
201 $(RM) $(LIBDIR)/libcupscgi_s.a
202 $(RM) $(LIBDIR)/libcupscgi.sl
203 $(RM) $(LIBDIR)/libcupscgi.sl.1
204 $(RM) $(LIBDIR)/libcupscgi.so
205 $(RM) $(LIBDIR)/libcupscgi.so.1
206 -$(RMDIR) $(LIBDIR)
207 $(RM) $(INCLUDEDIR)/cups/cgi.h
208 $(RM) $(INCLUDEDIR)/cups/help-index.h
209 -$(RMDIR) $(INCLUDEDIR)/cups
210
211 uninstall32bit:
212 $(RM) $(LIB32DIR)/libcupscgi.so
213 $(RM) $(LIB32DIR)/libcupscgi.so.1
214 -$(RMDIR) $(LIB32DIR)
215
216 uninstall64bit:
217 $(RM) $(LIB64DIR)/libcupscgi.so
218 $(RM) $(LIB64DIR)/libcupscgi.so.1
219 -$(RMDIR) $(LIB64DIR)
220
221
222 #
223 # Automatic API help files...
224 #
225
226 apihelp:
227 mxmldoc --section "Programming" \
228 --title "CGI API" \
229 --css ../doc/cups-printable.css \
230 --header api-cgi.header --intro api-cgi.shtml \
231 cgi.h help-index.h $(LIBOBJS:.o=.c) >../doc/help/api-cgi.html
232
233 framedhelp:
234 mxmldoc --framed api-cgi \
235 --section "Programming" \
236 --title "CGI API" \
237 --css ../doc/cups-printable.css \
238 --header api-cgi.header --intro api-cgi.shtml \
239 cgi.h help-index.h $(LIBOBJS:.o=.c)
240
241
242 #
243 # libcupscgi.so.1, libcupscgi.sl.1
244 #
245
246 libcupscgi.so.1 libcupscgi.sl.1: $(LIBOBJS)
247 echo Linking $@...
248 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBS)
249 $(RM) `basename $@ .1`
250 $(LN) $@ `basename $@ .1`
251
252
253 #
254 # 32bit/libcupscgi.so.1
255 #
256
257 32bit/libcupscgi.so.1: $(LIB32OBJS)
258 echo Linking 32-bit $@...
259 -mkdir 32bit
260 $(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBS)
261 $(RM) 32bit/libcupscgi.so
262 $(LN) libcupscgi.so.1 32bit/libcupscgi.so
263
264
265 #
266 # 64bit/libcupscgi.so.1
267 #
268
269 64bit/libcupscgi.so.1: $(LIB64OBJS)
270 echo Linking 64-bit $@...
271 -mkdir 64bit
272 $(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBS)
273 $(RM) 64bit/libcupscgi.so
274 $(LN) libcupscgi.so.1 64bit/libcupscgi.so
275
276
277 #
278 # libcupscgi.1.dylib
279 #
280
281 libcupscgi.1.dylib: $(LIBOBJS) libcupscgi.exp
282 echo Linking $@...
283 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
284 -install_name $(libdir)/$@ \
285 -current_version 1.0.0 \
286 -compatibility_version 1.0.0 \
287 -exported_symbols_list libcupscgi.exp \
288 $(LIBOBJS) $(LIBS)
289 $(RM) libcupscgi.dylib
290 $(LN) $@ libcupscgi.dylib
291
292
293 #
294 # libcupscgi_s.a
295 #
296
297 libcupscgi_s.a: $(LIBOBJS)
298 echo Creating $@...
299 $(DSO) $(DSOFLAGS) -o libcupscgi_s.o $(LIBOBJS) $(LIBS)
300 $(RM) $@
301 $(AR) $(ARFLAGS) $@ libcupscgi_s.o
302
303
304 #
305 # libcupscgi.la
306 #
307
308 libcupscgi.la: $(LIBOBJS)
309 echo Linking $@...
310 $(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
311 -version-info 1:0 $(LIBS)
312
313
314 #
315 # libcupscgi.a
316 #
317
318 libcupscgi.a: $(LIBOBJS)
319 echo Archiving $@...
320 $(RM) $@
321 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
322 $(RANLIB) $@
323
324
325 #
326 # admin.cgi
327 #
328
329 admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
330 echo Linking $@...
331 $(CC) $(LDFLAGS) -o $@ admin.o -L. -lcupscgi $(LIBS)
332
333
334 #
335 # classes.cgi
336 #
337
338 classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
339 echo Linking $@...
340 $(CC) $(LDFLAGS) -o $@ classes.o -L. -lcupscgi $(LIBS)
341
342
343 #
344 # help.cgi
345 #
346
347 help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
348 echo Linking $@...
349 $(CC) $(LDFLAGS) -o $@ help.o -L. -lcupscgi $(LIBS)
350
351
352 #
353 # jobs.cgi
354 #
355
356 jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
357 echo Linking $@...
358 $(CC) $(LDFLAGS) -o $@ jobs.o -L. -lcupscgi $(LIBS)
359
360
361 #
362 # printers.cgi
363 #
364
365 printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
366 echo Linking $@...
367 $(CC) $(LDFLAGS) -o $@ printers.o -L. -lcupscgi $(LIBS)
368
369
370 #
371 # testcgi
372 #
373
374 testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
375 echo Linking $@...
376 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
377 ../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
378 echo Testing CGI API...
379 ./testcgi
380
381
382 #
383 # testhi
384 #
385
386 testhi: testhi.o ../Makedefs libcupscgi.a ../cups/libcups.a
387 echo Linking $@...
388 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
389 ../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
390 echo Testing help index API...
391 ./testhi
392
393
394 #
395 # testtemplate
396 #
397
398 testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
399 echo Linking $@...
400 $(CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/libcups.a \
401 $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
402
403
404 #
405 # websearch
406 #
407
408 websearch: websearch.o ../Makedefs libcupscgi.a ../cups/libcups.a
409 echo Linking $@...
410 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ websearch.o libcupscgi.a \
411 ../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
412
413
414 #
415 # Dependencies...
416 #
417
418 include Dependencies
419
420
421 #
422 # End of "$Id: Makefile 7558 2008-05-12 23:46:44Z mike $".
423 #