]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/Makefile
Add unit test that loops calling cupsGetDests.
[thirdparty/cups.git] / cups / Makefile
1 #
2 # API library Makefile for CUPS.
3 #
4 # Copyright 2007-2016 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 # testconflicts (dependency on static CUPS library is intentional)
416 #
417
418 testconflicts: testconflicts.o $(LIBCUPSSTATIC)
419 echo Linking $@...
420 $(LD_CC) $(LDFLAGS) -o $@ testconflicts.o $(LIBCUPSSTATIC) \
421 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
422
423
424 #
425 # testcreds (dependency on static CUPS library is intentional)
426 #
427
428 testcreds: testcreds.o $(LIBCUPSSTATIC)
429 echo Linking $@...
430 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcreds.o $(LIBCUPSSTATIC) \
431 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
432
433
434 #
435 # testcups (dependency on static CUPS library is intentional)
436 #
437
438 testcups: testcups.o $(LIBCUPSSTATIC)
439 echo Linking $@...
440 $(LD_CC) $(LDFLAGS) -o $@ testcups.o $(LIBCUPSSTATIC) \
441 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
442
443
444 #
445 # testdest (dependency on static CUPS library is intentional)
446 #
447
448 testdest: testdest.o $(LIBCUPSSTATIC)
449 echo Linking $@...
450 $(LD_CC) $(LDFLAGS) -o $@ testdest.o $(LIBCUPSSTATIC) \
451 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
452
453
454 #
455 # testfile (dependency on static CUPS library is intentional)
456 #
457
458 testfile: testfile.o $(LIBCUPSSTATIC)
459 echo Linking $@...
460 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o $(LIBCUPSSTATIC) \
461 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
462 echo Running file API tests...
463 ./testfile
464
465
466 #
467 # testgetdests (dependency on static CUPS library is intentional)
468 #
469
470 testgetdests: testgetdests.o $(LIBCUPSSTATIC)
471 echo Linking $@...
472 $(LD_CC) $(LDFLAGS) -o $@ testgetdests.o $(LIBCUPSSTATIC) \
473 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
474
475
476 #
477 # testhttp (dependency on static CUPS library is intentional)
478 #
479
480 testhttp: testhttp.o $(LIBCUPSSTATIC)
481 echo Linking $@...
482 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o $(LIBCUPSSTATIC) \
483 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
484 echo Running HTTP API tests...
485 ./testhttp
486
487
488 #
489 # testipp (dependency on static CUPS library is intentional)
490 #
491
492 testipp: testipp.o $(LIBCUPSSTATIC)
493 echo Linking $@...
494 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o $(LIBCUPSSTATIC) \
495 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
496 echo Running IPP API tests...
497 ./testipp
498
499
500 #
501 # testi18n (dependency on static CUPS library is intentional)
502 #
503
504 testi18n: testi18n.o $(LIBCUPSSTATIC)
505 echo Linking $@...
506 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o $(LIBCUPSSTATIC) \
507 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
508 echo Running internationalization API tests...
509 ./testi18n
510
511
512 #
513 # testlang (dependency on static CUPS library is intentional)
514 #
515
516 testlang: testlang.o $(LIBCUPSSTATIC)
517 echo Linking $@...
518 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o $(LIBCUPSSTATIC) \
519 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
520 echo Running language API tests...
521 ./testlang
522
523
524 #
525 # testoptions (dependency on static CUPS library is intentional)
526 #
527
528 testoptions: testoptions.o $(LIBCUPSSTATIC)
529 echo Linking $@...
530 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o $(LIBCUPSSTATIC) \
531 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
532 echo Running option API tests...
533 ./testoptions
534
535
536 #
537 # testppd (dependency on static CUPS library is intentional)
538 #
539
540 testppd: testppd.o $(LIBCUPSSTATIC) test.ppd test2.ppd
541 echo Linking $@...
542 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o $(LIBCUPSSTATIC) \
543 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
544 echo Running PPD API tests...
545 ./testppd
546
547
548 #
549 # testpwg (dependency on static CUPS library is intentional)
550 #
551
552 testpwg: testpwg.o $(LIBCUPSSTATIC) test.ppd
553 echo Linking $@...
554 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o $(LIBCUPSSTATIC) \
555 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
556 echo Running PWG API tests...
557 ./testpwg test.ppd
558
559
560 #
561 # testsnmp (dependency on static CUPS library is intentional)
562 #
563
564 testsnmp: testsnmp.o $(LIBCUPSSTATIC)
565 echo Linking $@...
566 $(LD_CC) $(LDFLAGS) -o $@ testsnmp.o $(LIBCUPSSTATIC) \
567 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
568
569
570 #
571 # tlscheck (dependency on static CUPS library is intentional)
572 #
573
574 tlscheck: tlscheck.o $(LIBCUPSSTATIC)
575 echo Linking $@...
576 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ tlscheck.o $(LIBCUPSSTATIC) \
577 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
578
579
580 #
581 # Automatic API help files...
582 #
583
584 apihelp:
585 echo Generating CUPS API help files...
586 $(RM) cupspm.xml
587 mxmldoc --section "Programming" --body cupspm.md \
588 cupspm.xml \
589 auth.c cups.h dest*.c encode.c http.h http*.c ipp.h ipp*.c \
590 options.c tls-darwin.c usersys.c util.c \
591 --coverimage cupspm.png \
592 --epub ../doc/help/cupspm.epub
593 mxmldoc --section "Programming" --body cupspm.md \
594 cupspm.xml > ../doc/help/cupspm.html
595 $(RM) cupspm.xml
596 mxmldoc --section "Programming" --title "Administration APIs" \
597 --css ../doc/cups-printable.css \
598 --header api-admin.header --intro api-admin.shtml \
599 api-admin.xml \
600 adminutil.c adminutil.h getdevices.c >../doc/help/api-admin.html
601 $(RM) api-admin.xml
602 mxmldoc --section "Programming" --title "PPD API (DEPRECATED)" \
603 --css ../doc/cups-printable.css \
604 --header api-ppd.header --intro api-ppd.shtml \
605 api-ppd.xml ppd.h ppd-*.c >../doc/help/api-ppd.html
606 $(RM) api-ppd.xml
607 mxmldoc --section "Programming" \
608 --title "Filter and Backend Programming" \
609 --css ../doc/cups-printable.css \
610 --header api-filter.header --intro api-filter.shtml \
611 api-filter.xml \
612 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
613 >../doc/help/api-filter.html
614 $(RM) api-filter.xml
615
616
617 #
618 # Lines of code computation...
619 #
620
621 sloc:
622 echo "libcups: \c"
623 sloccount $(LIBOBJS:.o=.c) 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
624
625
626 #
627 # Dependencies...
628 #
629
630 include Dependencies
631 tls.o: tls-darwin.c tls-gnutls.c tls-sspi.c