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