]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/Makefile
6a07ba5f78a1f53218e72a1463cc490742cb9844
[thirdparty/cups.git] / cups / Makefile
1 #
2 # Library Makefile for CUPS.
3 #
4 # Copyright 2007-2017 by Apple Inc.
5 # Copyright 1997-2006 by Easy Software Products, all rights reserved.
6 #
7 # These coded instructions, statements, and computer programs are the
8 # property of Apple Inc. and are protected by Federal copyright
9 # law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 # which should have been included with this file. If this file is
11 # missing or damaged, see the license at "http://www.cups.org/".
12 #
13 # This file is subject to the Apple OS-Developed Software exception.
14 #
15
16 include ../Makedefs
17
18
19 #
20 # Options to build libcups without the use of deprecated APIs...
21 #
22
23 OPTIONS = -D_CUPS_NO_DEPRECATED=1 -D_PPD_DEPRECATED=""
24
25
26 #
27 # Object files...
28 #
29
30 LIBOBJS = \
31 adminutil.o \
32 array.o \
33 auth.o \
34 backchannel.o \
35 backend.o \
36 debug.o \
37 dest.o \
38 dest-job.o \
39 dest-localization.o \
40 dest-options.o \
41 dir.o \
42 encode.o \
43 file.o \
44 getdevices.o \
45 getifaddrs.o \
46 getputfile.o \
47 globals.o \
48 hash.o \
49 http.o \
50 http-addr.o \
51 http-addrlist.o \
52 http-support.o \
53 ipp.o \
54 ipp-support.o \
55 langprintf.o \
56 language.o \
57 md5.o \
58 md5passwd.o \
59 notify.o \
60 options.o \
61 ppd.o \
62 ppd-attr.o \
63 ppd-cache.o \
64 ppd-conflicts.o \
65 ppd-custom.o \
66 ppd-emit.o \
67 ppd-localize.o \
68 ppd-mark.o \
69 ppd-page.o \
70 ppd-util.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 tls.o \
80 transcode.o \
81 usersys.o \
82 util.o
83 TESTOBJS = \
84 testadmin.o \
85 testarray.o \
86 testcache.o \
87 testconflicts.o \
88 testcreds.o \
89 testcups.o \
90 testdest.o \
91 testfile.o \
92 testgetdests.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 testcreds \
159 testcups \
160 testdest \
161 testfile \
162 testgetdests \
163 testhttp \
164 testi18n \
165 testipp \
166 testlang \
167 testoptions \
168 testppd \
169 testpwg \
170 testsnmp \
171 tlscheck
172
173 TARGETS = \
174 $(LIBTARGETS)
175
176
177 #
178 # Make all targets...
179 #
180
181 all: $(TARGETS)
182
183
184 #
185 # Make library targets...
186 #
187
188 libs: $(LIBTARGETS)
189
190
191 #
192 # Make unit tests...
193 #
194
195 unittests: $(UNITTARGETS)
196
197
198 #
199 # Remove object and target files...
200 #
201
202 clean:
203 $(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
204 $(RM) libcups.so libcups.dylib
205
206
207 #
208 # Update dependencies (without system header dependencies...)
209 #
210
211 depend:
212 $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
213
214
215 #
216 # Run oclint to check code coverage...
217 #
218
219 oclint:
220 oclint -o=oclint.html -html $(LIBOBJS:.o=.c) -- $(ALL_CFLAGS)
221
222
223 #
224 # Install all targets...
225 #
226
227 install: all install-data install-headers install-libs install-exec
228
229
230 #
231 # Install data files...
232 #
233
234 install-data:
235
236
237 #
238 # Install programs...
239 #
240
241 install-exec:
242
243
244 #
245 # Install headers...
246 #
247
248 install-headers:
249 echo Installing header files into $(INCLUDEDIR)/cups...
250 $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
251 for file in $(HEADERS); do \
252 $(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \
253 done
254 if test "x$(privateinclude)" != x; then \
255 echo Installing private header files into $(PRIVATEINCLUDE)...; \
256 $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \
257 for file in $(HEADERSPRIV); do \
258 $(INSTALL_DATA) $$file $(PRIVATEINCLUDE)/$$file; \
259 done; \
260 fi
261
262
263 #
264 # Install libraries...
265 #
266
267 install-libs: $(INSTALLSTATIC)
268 echo Installing libraries in $(LIBDIR)...
269 $(INSTALL_DIR) -m 755 $(LIBDIR)
270 $(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
271 if test $(LIBCUPS) = "libcups.so.2"; then \
272 $(RM) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
273 $(LN) $(LIBCUPS) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
274 fi
275 if test $(LIBCUPS) = "libcups.2.dylib"; then \
276 $(RM) $(LIBDIR)/libcups.dylib; \
277 $(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \
278 fi
279 if test "x$(SYMROOT)" != "x"; then \
280 $(INSTALL_DIR) $(SYMROOT); \
281 cp $(LIBCUPS) $(SYMROOT); \
282 dsymutil $(SYMROOT)/$(LIBCUPS); \
283 fi
284
285 installstatic:
286 $(INSTALL_DIR) -m 755 $(LIBDIR)
287 $(INSTALL_LIB) -m 755 $(LIBCUPSSTATIC) $(LIBDIR)
288 $(RANLIB) $(LIBDIR)/$(LIBCUPSSTATIC)
289 $(CHMOD) 555 $(LIBDIR)/$(LIBCUPSSTATIC)
290
291
292 #
293 # Uninstall object and target files...
294 #
295
296 uninstall:
297 $(RM) $(LIBDIR)/libcups.2.dylib
298 $(RM) $(LIBDIR)/$(LIBCUPSSTATIC)
299 $(RM) $(LIBDIR)/libcups.dylib
300 $(RM) $(LIBDIR)/libcups.so
301 $(RM) $(LIBDIR)/libcups.so.2
302 -$(RMDIR) $(LIBDIR)
303 for file in $(HEADERS); do \
304 $(RM) $(INCLUDEDIR)/cups/$$file; \
305 done
306 -$(RMDIR) $(INCLUDEDIR)/cups
307
308
309 #
310 # libcups.so.2
311 #
312
313 libcups.so.2: $(LIBOBJS)
314 echo Linking $@...
315 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
316 $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
317 $(RM) `basename $@ .2`
318 $(LN) $@ `basename $@ .2`
319
320
321 #
322 # libcups.2.dylib
323 #
324
325 libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
326 echo Creating export list for $@...
327 nm -gm $(LIBOBJS) 2>/dev/null | grep "__text" | grep -v weak | \
328 awk '{print $$NF}' | \
329 grep -v -E -e '^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault)$$' | \
330 sort >t.exp
331 echo Linking $@...
332 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
333 -install_name $(libdir)/$@ \
334 -current_version 2.12.0 \
335 -compatibility_version 2.0.0 \
336 -exported_symbols_list t.exp \
337 $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
338 $(COMMONLIBS) $(LIBZ)
339 $(RM) libcups.dylib t.exp
340 $(LN) $@ libcups.dylib
341
342
343 #
344 # libcups.la
345 #
346
347 libcups.la: $(LIBOBJS)
348 echo Linking $@...
349 $(LD_CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
350 -rpath $(LIBDIR) -version-info 2:12 $(LIBGSSAPI) $(SSLLIBS) \
351 $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
352
353
354 #
355 # libcups.a
356 #
357
358 libcups.a: $(LIBOBJS)
359 echo Archiving $@...
360 $(RM) $@
361 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
362 $(RANLIB) $@
363
364
365 #
366 # libcups2.def (Windows DLL exports file...)
367 #
368
369 libcups2.def: $(LIBOBJS) Makefile
370 echo Generating $@...
371 echo "LIBRARY libcups2" >libcups2.def
372 echo "VERSION 2.12" >>libcups2.def
373 echo "EXPORTS" >>libcups2.def
374 (nm $(LIBOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}'; \
375 echo __cups_strcpy; echo __cups_strlcat; echo __cups_strlcpy) | \
376 grep -v -E \
377 -e 'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel' \
378 -e 'Block$$' | \
379 sed -e '1,$$s/^_//' | sort >>libcups2.def
380
381
382 #
383 # testadmin (dependency on static CUPS library is intentional)
384 #
385
386 testadmin: testadmin.o $(LIBCUPSSTATIC)
387 echo Linking $@...
388 $(LD_CC) $(LDFLAGS) -o $@ testadmin.o $(LIBCUPSSTATIC) \
389 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
390
391
392 #
393 # testarray (dependency on static CUPS library is intentional)
394 #
395
396 testarray: testarray.o $(LIBCUPSSTATIC)
397 echo Linking $@...
398 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o $(LIBCUPSSTATIC) \
399 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
400 echo Running array API tests...
401 ./testarray
402
403
404 #
405 # testcache (dependency on static CUPS library is intentional)
406 #
407
408 testcache: testcache.o $(LIBCUPSSTATIC)
409 echo Linking $@...
410 $(LD_CC) $(LDFLAGS) -o $@ testcache.o $(LIBCUPSSTATIC) \
411 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
412
413
414 #
415 # testclient (dependency on static CUPS library is intentional)
416 #
417
418 testclient: testclient.o $(LIBCUPSSTATIC)
419 echo Linking $@...
420 $(LD_CC) $(LDFLAGS) -o $@ testclient.o $(LIBCUPSSTATIC) \
421 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
422
423
424 #
425 # testconflicts (dependency on static CUPS library is intentional)
426 #
427
428 testconflicts: testconflicts.o $(LIBCUPSSTATIC)
429 echo Linking $@...
430 $(LD_CC) $(LDFLAGS) -o $@ testconflicts.o $(LIBCUPSSTATIC) \
431 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
432
433
434 #
435 # testcreds (dependency on static CUPS library is intentional)
436 #
437
438 testcreds: testcreds.o $(LIBCUPSSTATIC)
439 echo Linking $@...
440 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcreds.o $(LIBCUPSSTATIC) \
441 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
442
443
444 #
445 # testcups (dependency on static CUPS library is intentional)
446 #
447
448 testcups: testcups.o $(LIBCUPSSTATIC)
449 echo Linking $@...
450 $(LD_CC) $(LDFLAGS) -o $@ testcups.o $(LIBCUPSSTATIC) \
451 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
452
453
454 #
455 # testdest (dependency on static CUPS library is intentional)
456 #
457
458 testdest: testdest.o $(LIBCUPSSTATIC)
459 echo Linking $@...
460 $(LD_CC) $(LDFLAGS) -o $@ testdest.o $(LIBCUPSSTATIC) \
461 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
462
463
464 #
465 # testfile (dependency on static CUPS library is intentional)
466 #
467
468 testfile: testfile.o $(LIBCUPSSTATIC)
469 echo Linking $@...
470 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o $(LIBCUPSSTATIC) \
471 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
472 echo Running file API tests...
473 ./testfile
474
475
476 #
477 # testgetdests (dependency on static CUPS library is intentional)
478 #
479
480 testgetdests: testgetdests.o $(LIBCUPSSTATIC)
481 echo Linking $@...
482 $(LD_CC) $(LDFLAGS) -o $@ testgetdests.o $(LIBCUPSSTATIC) \
483 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
484
485
486 #
487 # testhttp (dependency on static CUPS library is intentional)
488 #
489
490 testhttp: testhttp.o $(LIBCUPSSTATIC)
491 echo Linking $@...
492 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o $(LIBCUPSSTATIC) \
493 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
494 echo Running HTTP API tests...
495 ./testhttp
496
497
498 #
499 # testipp (dependency on static CUPS library is intentional)
500 #
501
502 testipp: testipp.o $(LIBCUPSSTATIC)
503 echo Linking $@...
504 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o $(LIBCUPSSTATIC) \
505 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
506 echo Running IPP API tests...
507 ./testipp
508
509
510 #
511 # testi18n (dependency on static CUPS library is intentional)
512 #
513
514 testi18n: testi18n.o $(LIBCUPSSTATIC)
515 echo Linking $@...
516 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o $(LIBCUPSSTATIC) \
517 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
518 echo Running internationalization API tests...
519 ./testi18n
520
521
522 #
523 # testlang (dependency on static CUPS library is intentional)
524 #
525
526 testlang: testlang.o $(LIBCUPSSTATIC)
527 echo Linking $@...
528 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o $(LIBCUPSSTATIC) \
529 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
530 echo Creating locale directory structure...
531 $(RM) -r locale
532 $(MKDIR) locale/en
533 echo 'msgid "No"' > locale/en/cups_en.po
534 echo 'msgstr "No"' >> locale/en/cups_en.po
535 echo 'msgid "Yes"' >> locale/en/cups_en.po
536 echo 'msgstr "Yes"' >> locale/en/cups_en.po
537 for po in ../locale/cups_*.po; do \
538 lang=`basename $$po .po | sed -e '1,$$s/^cups_//'`; \
539 $(MKDIR) locale/$$lang; \
540 $(LN) ../../$$po locale/$$lang; \
541 done
542 echo Running language API tests...
543 LOCALEDIR=locale ./testlang
544
545
546 #
547 # testoptions (dependency on static CUPS library is intentional)
548 #
549
550 testoptions: testoptions.o $(LIBCUPSSTATIC)
551 echo Linking $@...
552 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o $(LIBCUPSSTATIC) \
553 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
554 echo Running option API tests...
555 ./testoptions
556
557
558 #
559 # testppd (dependency on static CUPS library is intentional)
560 #
561
562 testppd: testppd.o $(LIBCUPSSTATIC) test.ppd test2.ppd
563 echo Linking $@...
564 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o $(LIBCUPSSTATIC) \
565 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
566 echo Running PPD API tests...
567 ./testppd
568
569
570 #
571 # testpwg (dependency on static CUPS library is intentional)
572 #
573
574 testpwg: testpwg.o $(LIBCUPSSTATIC) test.ppd
575 echo Linking $@...
576 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o $(LIBCUPSSTATIC) \
577 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
578 echo Running PWG API tests...
579 ./testpwg test.ppd
580
581
582 #
583 # testsnmp (dependency on static CUPS library is intentional)
584 #
585
586 testsnmp: testsnmp.o $(LIBCUPSSTATIC)
587 echo Linking $@...
588 $(LD_CC) $(LDFLAGS) -o $@ testsnmp.o $(LIBCUPSSTATIC) \
589 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
590
591
592 #
593 # tlscheck (dependency on static CUPS library is intentional)
594 #
595
596 tlscheck: tlscheck.o $(LIBCUPSSTATIC)
597 echo Linking $@...
598 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ tlscheck.o $(LIBCUPSSTATIC) \
599 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
600
601
602 #
603 # Automatic API help files...
604 #
605
606 apihelp:
607 echo Generating CUPS API help files...
608 $(RM) cupspm.xml
609 mxmldoc --section "Programming" --body cupspm.md \
610 cupspm.xml \
611 auth.c cups.h dest*.c encode.c http.h http*.c ipp.h ipp*.c \
612 options.c tls-darwin.c usersys.c util.c \
613 --coverimage cupspm.png \
614 --epub ../doc/help/cupspm.epub
615 mxmldoc --section "Programming" --body cupspm.md \
616 cupspm.xml > ../doc/help/cupspm.html
617 $(RM) cupspm.xml
618 mxmldoc --section "Programming" --title "Administration APIs" \
619 --css ../doc/cups-printable.css \
620 --header api-admin.header --intro api-admin.shtml \
621 api-admin.xml \
622 adminutil.c adminutil.h getdevices.c >../doc/help/api-admin.html
623 $(RM) api-admin.xml
624 mxmldoc --section "Programming" --title "PPD API (DEPRECATED)" \
625 --css ../doc/cups-printable.css \
626 --header api-ppd.header --intro api-ppd.shtml \
627 api-ppd.xml ppd.h ppd-*.c >../doc/help/api-ppd.html
628 $(RM) api-ppd.xml
629 mxmldoc --section "Programming" \
630 --title "Filter and Backend Programming" \
631 --css ../doc/cups-printable.css \
632 --header api-filter.header --intro api-filter.shtml \
633 api-filter.xml \
634 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
635 >../doc/help/api-filter.html
636 $(RM) api-filter.xml
637
638
639 #
640 # Lines of code computation...
641 #
642
643 sloc:
644 echo "libcups: \c"
645 sloccount $(LIBOBJS:.o=.c) 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
646
647
648 #
649 # Dependencies...
650 #
651
652 include Dependencies
653 tls.o: tls-darwin.c tls-gnutls.c tls-sspi.c