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