]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/Makefile
Save work.
[thirdparty/cups.git] / cups / Makefile
1 #
2 # "$Id$"
3 #
4 # API library Makefile for CUPS.
5 #
6 # Copyright 2007-2013 by Apple Inc.
7 # Copyright 1997-2006 by Easy Software Products, all rights reserved.
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 # This file is subject to the Apple OS-Developed Software exception.
16 #
17
18 include ../Makedefs
19
20
21 #
22 # Options to build libcups without the use of deprecated APIs...
23 #
24
25 OPTIONS = -D_CUPS_NO_DEPRECATED=1 -D_PPD_DEPRECATED=""
26
27
28 #
29 # Object files...
30 #
31
32 LIBOBJS = \
33 adminutil.o \
34 array.o \
35 attr.o \
36 auth.o \
37 backchannel.o \
38 backend.o \
39 conflicts.o \
40 custom.o \
41 debug.o \
42 dest.o \
43 dest-job.o \
44 dest-localization.o \
45 dest-options.o \
46 dir.o \
47 emit.o \
48 encode.o \
49 file.o \
50 getdevices.o \
51 getifaddrs.o \
52 getputfile.o \
53 globals.o \
54 http.o \
55 http-addr.o \
56 http-addrlist.o \
57 http-support.o \
58 ipp.o \
59 ipp-support.o \
60 langprintf.o \
61 language.o \
62 localize.o \
63 mark.o \
64 md5.o \
65 md5passwd.o \
66 notify.o \
67 options.o \
68 page.o \
69 ppd.o \
70 ppd-cache.o \
71 pwg-media.o \
72 request.o \
73 sidechannel.o \
74 snmp.o \
75 snprintf.o \
76 string.o \
77 tempfile.o \
78 thread.o \
79 transcode.o \
80 usersys.o \
81 util.o
82 TESTOBJS = \
83 testadmin.o \
84 testarray.o \
85 testconflicts.o \
86 testcups.o \
87 testfile.o \
88 testhttp.o \
89 testi18n.o \
90 testipp.o \
91 testoptions.o \
92 testlang.o \
93 testppd.o \
94 testpwg.o \
95 testsnmp.o
96 OBJS = \
97 $(LIBOBJS) \
98 $(TESTOBJS)
99
100
101 #
102 # Header files to install...
103 #
104
105 HEADERS = \
106 adminutil.h \
107 array.h \
108 backend.h \
109 cups.h \
110 dir.h \
111 file.h \
112 http.h \
113 ipp.h \
114 language.h \
115 ppd.h \
116 pwg.h \
117 raster.h \
118 sidechannel.h \
119 transcode.h \
120 versioning.h
121
122 HEADERSPRIV = \
123 array-private.h \
124 cups-private.h \
125 debug-private.h \
126 file-private.h \
127 http-private.h \
128 ipp-private.h \
129 language-private.h \
130 md5-private.h \
131 ppd-private.h \
132 pwg-private.h \
133 raster-private.h \
134 snmp-private.h \
135 string-private.h \
136 thread-private.h
137
138
139 #
140 # Targets in this directory...
141 #
142
143 LIBTARGETS = \
144 $(LIBCUPSSTATIC) \
145 $(LIBCUPS)
146
147 UNITTARGETS = \
148 testadmin \
149 testarray \
150 testconflicts \
151 testcups \
152 testfile \
153 testhttp \
154 testi18n \
155 testipp \
156 testlang \
157 testoptions \
158 testppd \
159 testpwg \
160 testsnmp
161
162 TARGETS = \
163 $(LIBTARGETS)
164
165
166 #
167 # Make all targets...
168 #
169
170 all: $(TARGETS)
171
172
173 #
174 # Make library targets...
175 #
176
177 libs: $(LIBTARGETS)
178
179
180 #
181 # Make unit tests...
182 #
183
184 unittests: $(UNITTARGETS)
185
186
187 #
188 # Remove object and target files...
189 #
190
191 clean:
192 $(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
193 $(RM) libcups.so libcups.dylib
194
195
196 #
197 # Update dependencies (without system header dependencies...)
198 #
199
200 depend:
201 $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
202
203
204 #
205 # Run oclint to check code coverage...
206 #
207
208 oclint:
209 oclint -o=oclint.html -html $(LIBOBJS:.o=.c) -- $(ALL_CFLAGS)
210
211
212 #
213 # Install all targets...
214 #
215
216 install: all install-data install-headers install-libs install-exec
217
218
219 #
220 # Install data files...
221 #
222
223 install-data:
224
225
226 #
227 # Install programs...
228 #
229
230 install-exec:
231
232
233 #
234 # Install headers...
235 #
236
237 install-headers:
238 echo Installing header files into $(INCLUDEDIR)/cups...
239 $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
240 for file in $(HEADERS); do \
241 $(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \
242 done
243 if test "x$(privateinclude)" != x; then \
244 echo Installing private header files into $(PRIVATEINCLUDE)...; \
245 $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \
246 for file in $(HEADERSPRIV); do \
247 $(INSTALL_DATA) $$file $(PRIVATEINCLUDE)/$$file; \
248 done; \
249 fi
250
251
252 #
253 # Install libraries...
254 #
255
256 install-libs: $(INSTALLSTATIC)
257 echo Installing libraries in $(LIBDIR)...
258 $(INSTALL_DIR) -m 755 $(LIBDIR)
259 $(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
260 if test $(LIBCUPS) = "libcups.so.2"; then \
261 $(RM) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
262 $(LN) $(LIBCUPS) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
263 fi
264 if test $(LIBCUPS) = "libcups.2.dylib"; then \
265 $(RM) $(LIBDIR)/libcups.dylib; \
266 $(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \
267 fi
268 if test "x$(SYMROOT)" != "x"; then \
269 $(INSTALL_DIR) $(SYMROOT); \
270 cp $(LIBCUPS) $(SYMROOT); \
271 dsymutil $(SYMROOT)/$(LIBCUPS); \
272 fi
273
274 installstatic:
275 $(INSTALL_DIR) -m 755 $(LIBDIR)
276 $(INSTALL_LIB) -m 755 $(LIBCUPSSTATIC) $(LIBDIR)
277 $(RANLIB) $(LIBDIR)/$(LIBCUPSSTATIC)
278 $(CHMOD) 555 $(LIBDIR)/$(LIBCUPSSTATIC)
279
280
281 #
282 # Uninstall object and target files...
283 #
284
285 uninstall:
286 $(RM) $(LIBDIR)/libcups.2.dylib
287 $(RM) $(LIBDIR)/$(LIBCUPSSTATIC)
288 $(RM) $(LIBDIR)/libcups.dylib
289 $(RM) $(LIBDIR)/libcups.so
290 $(RM) $(LIBDIR)/libcups.so.2
291 -$(RMDIR) $(LIBDIR)
292 for file in $(HEADERS); do \
293 $(RM) $(INCLUDEDIR)/cups/$$file; \
294 done
295 -$(RMDIR) $(INCLUDEDIR)/cups
296
297
298 #
299 # libcups.so.2
300 #
301
302 libcups.so.2: $(LIBOBJS)
303 echo Linking $@...
304 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
305 $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
306 $(RM) `basename $@ .2`
307 $(LN) $@ `basename $@ .2`
308
309
310 #
311 # libcups.2.dylib
312 #
313
314 libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
315 echo Creating export list for $@...
316 nm $(LIBOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}' | \
317 grep -v -e '^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
318 sort >t.exp
319 echo Linking $@...
320 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
321 -install_name $(libdir)/$@ \
322 -current_version 2.10.0 \
323 -compatibility_version 2.0.0 \
324 -exported_symbols_list t.exp \
325 $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
326 $(COMMONLIBS) $(LIBZ)
327 $(RM) libcups.dylib t.exp
328 $(LN) $@ libcups.dylib
329
330
331 #
332 # libcups.la
333 #
334
335 libcups.la: $(LIBOBJS)
336 echo Linking $@...
337 $(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
338 -rpath $(LIBDIR) -version-info 2:10 $(LIBGSSAPI) $(SSLLIBS) \
339 $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
340
341
342 #
343 # libcups.a
344 #
345
346 libcups.a: $(LIBOBJS)
347 echo Archiving $@...
348 $(RM) $@
349 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
350 $(RANLIB) $@
351
352
353 #
354 # testadmin (dependency on static CUPS library is intentional)
355 #
356
357 testadmin: testadmin.o $(LIBCUPSSTATIC)
358 echo Linking $@...
359 $(CC) $(LDFLAGS) -o $@ testadmin.o $(LIBCUPSSTATIC) \
360 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
361
362
363 #
364 # testarray (dependency on static CUPS library is intentional)
365 #
366
367 testarray: testarray.o $(LIBCUPSSTATIC)
368 echo Linking $@...
369 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o $(LIBCUPSSTATIC) \
370 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
371 echo Running array API tests...
372 ./testarray
373
374
375 #
376 # testconflicts (dependency on static CUPS library is intentional)
377 #
378
379 testconflicts: testconflicts.o $(LIBCUPSSTATIC)
380 echo Linking $@...
381 $(CC) $(LDFLAGS) -o $@ testconflicts.o $(LIBCUPSSTATIC) \
382 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
383
384
385 #
386 # testcups (dependency on static CUPS library is intentional)
387 #
388
389 testcups: testcups.o $(LIBCUPSSTATIC)
390 echo Linking $@...
391 $(CC) $(LDFLAGS) -o $@ testcups.o $(LIBCUPSSTATIC) \
392 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
393
394
395 #
396 # testfile (dependency on static CUPS library is intentional)
397 #
398
399 testfile: testfile.o $(LIBCUPSSTATIC)
400 echo Linking $@...
401 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o $(LIBCUPSSTATIC) \
402 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
403 echo Running file API tests...
404 ./testfile
405
406
407 #
408 # testhttp (dependency on static CUPS library is intentional)
409 #
410
411 testhttp: testhttp.o $(LIBCUPSSTATIC)
412 echo Linking $@...
413 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o $(LIBCUPSSTATIC) \
414 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
415 echo Running HTTP API tests...
416 ./testhttp
417
418
419 #
420 # testipp (dependency on static CUPS library is intentional)
421 #
422
423 testipp: testipp.o $(LIBCUPSSTATIC)
424 echo Linking $@...
425 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o $(LIBCUPSSTATIC) \
426 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
427 echo Running IPP API tests...
428 ./testipp
429
430
431 #
432 # testi18n (dependency on static CUPS library is intentional)
433 #
434
435 testi18n: testi18n.o $(LIBCUPSSTATIC)
436 echo Linking $@...
437 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o $(LIBCUPSSTATIC) \
438 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
439 echo Running internationalization API tests...
440 ./testi18n
441
442
443 #
444 # testlang (dependency on static CUPS library is intentional)
445 #
446
447 testlang: testlang.o $(LIBCUPSSTATIC)
448 echo Linking $@...
449 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o $(LIBCUPSSTATIC) \
450 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
451 echo Running language API tests...
452 ./testlang
453
454
455 #
456 # testoptions (dependency on static CUPS library is intentional)
457 #
458
459 testoptions: testoptions.o $(LIBCUPSSTATIC)
460 echo Linking $@...
461 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o $(LIBCUPSSTATIC) \
462 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
463 echo Running option API tests...
464 ./testoptions
465
466
467 #
468 # testppd (dependency on static CUPS library is intentional)
469 #
470
471 testppd: testppd.o $(LIBCUPSSTATIC) test.ppd test2.ppd
472 echo Linking $@...
473 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o $(LIBCUPSSTATIC) \
474 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
475 echo Running PPD API tests...
476 ./testppd
477
478
479 #
480 # testpwg (dependency on static CUPS library is intentional)
481 #
482
483 testpwg: testpwg.o $(LIBCUPSSTATIC) test.ppd
484 echo Linking $@...
485 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o $(LIBCUPSSTATIC) \
486 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
487 echo Running PWG API tests...
488 ./testpwg test.ppd
489
490
491 #
492 # testsnmp (dependency on static CUPS library is intentional)
493 #
494
495 testsnmp: testsnmp.o $(LIBCUPSSTATIC)
496 echo Linking $@...
497 $(CC) $(LDFLAGS) -o $@ testsnmp.o $(LIBCUPSSTATIC) \
498 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
499
500
501 #
502 # Automatic API help files...
503 #
504
505 apihelp:
506 echo Generating CUPS API help files...
507 mxmldoc --section "Programming" \
508 --title "Introduction to CUPS Programming" \
509 --css ../doc/cups-printable.css \
510 --header api-overview.header --intro api-overview.shtml \
511 >../doc/help/api-overview.html
512 mxmldoc --section "Programming" --title "Array API" \
513 --css ../doc/cups-printable.css \
514 --header api-array.header --intro api-array.shtml \
515 api-array.xml \
516 array.h array.c >../doc/help/api-array.html
517 mxmldoc --tokens help/api-array.html api-array.xml >../doc/help/api-array.tokens
518 $(RM) api-array.xml
519 mxmldoc --section "Programming" --title "CUPS API" \
520 --css ../doc/cups-printable.css \
521 --header api-cups.header --intro api-cups.shtml \
522 api-cups.xml \
523 cups.h pwg.h adminutil.c dest*.c language.c notify.c \
524 options.c pwg-media.c tempfile.c usersys.c \
525 util.c >../doc/help/api-cups.html
526 mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
527 $(RM) api-cups.xml
528 mxmldoc --section "Programming" --title "File and Directory APIs" \
529 --css ../doc/cups-printable.css \
530 --header api-filedir.header --intro api-filedir.shtml \
531 api-filedir.xml \
532 file.h file.c dir.h dir.c >../doc/help/api-filedir.html
533 mxmldoc --tokens api-filedir.xml >../doc/help/api-filedir.tokens
534 $(RM) api-filedir.xml
535 mxmldoc --section "Programming" --title "PPD API (DEPRECATED)" \
536 --css ../doc/cups-printable.css \
537 --header api-ppd.header --intro api-ppd.shtml \
538 api-ppd.xml \
539 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
540 ppd.c >../doc/help/api-ppd.html
541 mxmldoc --tokens help/api-ppd.html api-ppd.xml >../doc/help/api-ppd.tokens
542 $(RM) api-ppd.xml
543 mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
544 --css ../doc/cups-printable.css \
545 --header api-httpipp.header --intro api-httpipp.shtml \
546 api-httpipp.xml \
547 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
548 http.c http-addr.c http-support.c ipp.c ipp-support.c \
549 md5passwd.c request.c >../doc/help/api-httpipp.html
550 mxmldoc --tokens help/api-httpipp.html api-httpipp.xml >../doc/help/api-httpipp.tokens
551 $(RM) api-httpipp.xml
552 mxmldoc --section "Programming" \
553 --title "Filter and Backend Programming" \
554 --css ../doc/cups-printable.css \
555 --header api-filter.header --intro api-filter.shtml \
556 api-filter.xml \
557 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
558 >../doc/help/api-filter.html
559 mxmldoc --tokens help/api-filter.html api-filter.xml >../doc/help/api-filter.tokens
560 $(RM) api-filter.xml
561
562 framedhelp:
563 echo Generating CUPS API help files...
564 mxmldoc --framed api-overview \
565 --section "Programming" \
566 --title "Introduction to CUPS Programming" \
567 --css ../doc/cups-printable.css \
568 --header api-overview.header --intro api-overview.shtml
569 mxmldoc --framed api-array \
570 --section "Programming" --title "Array API" \
571 --css ../doc/cups-printable.css \
572 --header api-array.header --intro api-array.shtml \
573 array.h array.c
574 mxmldoc --framed api-cups \
575 --section "Programming" --title "CUPS API" \
576 --css ../doc/cups-printable.css \
577 --header api-cups.header --intro api-cups.shtml \
578 cups.h adminutil.c dest*.c language.c notify.c \
579 options.c tempfile.c usersys.c \
580 util.c
581 mxmldoc --framed api-filedir \
582 --section "Programming" --title "File and Directory APIs" \
583 --css ../doc/cups-printable.css \
584 --header api-filedir.header --intro api-filedir.shtml \
585 file.h file.c dir.h dir.c
586 mxmldoc --framed api-ppd \
587 --section "Programming" --title "PPD API (DEPRECATED)" \
588 --css ../doc/cups-printable.css \
589 --header api-ppd.header --intro api-ppd.shtml \
590 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
591 page.c ppd.c
592 mxmldoc --framed api-httpipp \
593 --section "Programming" --title "HTTP and IPP APIs" \
594 --css ../doc/cups-printable.css \
595 --header api-httpipp.header --intro api-httpipp.shtml \
596 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
597 http.c http-addr.c http-support.c ipp.c ipp-support.c \
598 md5passwd.c request.c
599 mxmldoc --framed api-filter \
600 --section "Programming" \
601 --title "Filter and Backend Programming" \
602 --css ../doc/cups-printable.css \
603 --header api-filter.header --intro api-filter.shtml \
604 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
605
606
607 #
608 # Lines of code computation...
609 #
610
611 sloc:
612 echo "libcupslite: \c"
613 sloccount $(LITEOBJS:.o=.c) 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
614 echo "libcups: \c"
615 sloccount $(LIBOBJS:.o=.c) 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
616
617
618 #
619 # Dependencies...
620 #
621
622 include Dependencies
623 http.o: tls-darwin.c tls-gnutls.c tls-sspi.c
624
625
626 #
627 # End of "$Id$".
628 #