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