4 # API library Makefile for CUPS.
6 # Copyright 2007-2015 by Apple Inc.
7 # Copyright 1997-2006 by Easy Software Products, all rights reserved.
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/".
15 # This file is subject to the Apple OS-Developed Software exception.
22 # Options to build libcups without the use of deprecated APIs...
25 OPTIONS
= -D_CUPS_NO_DEPRECATED
=1 -D_PPD_DEPRECATED
=""
108 # Header files to install...
146 # Targets in this directory...
176 # Make all targets...
183 # Make library targets...
193 unittests
: $(UNITTARGETS
)
197 # Remove object and target files...
201 $(RM
) $(OBJS
) $(TARGETS
) $(UNITTARGETS
)
202 $(RM
) libcups.so libcups.dylib
206 # Update dependencies (without system header dependencies...)
210 $(CC
) -MM
$(ALL_CFLAGS
) $(OBJS
:.o
=.c
) >Dependencies
214 # Run oclint to check code coverage...
218 oclint
-o
=oclint.html
-html
$(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
222 # Install all targets...
225 install: all install-data install-headers install-libs install-exec
229 # Install data files...
236 # Install programs...
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
; \
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; \
262 # Install libraries...
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`; \
273 if
test $(LIBCUPS
) = "libcups.2.dylib"; then \
274 $(RM
) $(LIBDIR
)/libcups.dylib
; \
275 $(LN
) $(LIBCUPS
) $(LIBDIR
)/libcups.dylib
; \
277 if
test "x$(SYMROOT)" != "x"; then \
278 $(INSTALL_DIR
) $(SYMROOT
); \
279 cp
$(LIBCUPS
) $(SYMROOT
); \
280 dsymutil
$(SYMROOT
)/$(LIBCUPS
); \
284 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
285 $(INSTALL_LIB
) -m
755 $(LIBCUPSSTATIC
) $(LIBDIR
)
286 $(RANLIB
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
287 $(CHMOD
) 555 $(LIBDIR
)/$(LIBCUPSSTATIC
)
291 # Uninstall object and target files...
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
301 for file in
$(HEADERS
); do \
302 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
304 -$(RMDIR
) $(INCLUDEDIR
)/cups
311 libcups.so
.2: $(LIBOBJS
)
313 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
314 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
315 $(RM
) `basename $@ .2`
316 $(LN
) $@
`basename $@ .2`
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)$$' | \
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
344 libcups.la
: $(LIBOBJS
)
346 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
347 -rpath
$(LIBDIR
) -version-info
2:11 $(LIBGSSAPI
) $(SSLLIBS
) \
348 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
355 libcups.a
: $(LIBOBJS
)
358 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
363 # libcups2.def (Windows DLL exports file...)
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
) | \
374 -e
'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel' \
376 sed
-e
'1,$$s/^_//' |
sort >>libcups2.def
380 # testadmin (dependency on static CUPS library is intentional)
383 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
385 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
386 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
390 # testarray (dependency on static CUPS library is intentional)
393 testarray
: testarray.o
$(LIBCUPSSTATIC
)
395 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
396 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
397 echo Running array API tests...
402 # testcache (dependency on static CUPS library is intentional)
405 testcache
: testcache.o
$(LIBCUPSSTATIC
)
407 $(CC
) $(LDFLAGS
) -o
$@ testcache.o
$(LIBCUPSSTATIC
) \
408 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
412 # testconflicts (dependency on static CUPS library is intentional)
415 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
417 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
418 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
422 # testcups (dependency on static CUPS library is intentional)
425 testcups
: testcups.o
$(LIBCUPSSTATIC
)
427 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
428 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
432 # testdest (dependency on static CUPS library is intentional)
435 testdest
: testdest.o
$(LIBCUPSSTATIC
)
437 $(CC
) $(LDFLAGS
) -o
$@ testdest.o
$(LIBCUPSSTATIC
) \
438 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
442 # testfile (dependency on static CUPS library is intentional)
445 testfile
: testfile.o
$(LIBCUPSSTATIC
)
447 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
448 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
449 echo Running file API tests...
454 # testhttp (dependency on static CUPS library is intentional)
457 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
459 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
460 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
461 echo Running HTTP API tests...
466 # testipp (dependency on static CUPS library is intentional)
469 testipp
: testipp.o
$(LIBCUPSSTATIC
)
471 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
472 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
473 echo Running IPP API tests...
478 # testi18n (dependency on static CUPS library is intentional)
481 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
483 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
484 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
485 echo Running internationalization API tests...
490 # testlang (dependency on static CUPS library is intentional)
493 testlang
: testlang.o
$(LIBCUPSSTATIC
)
495 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
496 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
497 echo Running language API tests...
502 # testoptions (dependency on static CUPS library is intentional)
505 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
507 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
508 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
509 echo Running option API tests...
514 # testppd (dependency on static CUPS library is intentional)
517 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
519 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
520 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
521 echo Running PPD API tests...
526 # testpwg (dependency on static CUPS library is intentional)
529 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
531 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
532 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
533 echo Running PWG API tests...
538 # testsnmp (dependency on static CUPS library is intentional)
541 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
543 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
544 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
548 # tlscheck (dependency on static CUPS library is intentional)
551 tlscheck
: tlscheck.o
$(LIBCUPSSTATIC
)
553 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ tlscheck.o
$(LIBCUPSSTATIC
) \
554 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
558 # Automatic API help files...
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 \
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
575 mxmldoc
--section
"Programming" --title
"CUPS API" \
576 --css ..
/doc
/cups-printable.css \
577 --header api-cups.header
--intro api-cups.shtml \
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
584 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
585 --css ..
/doc
/cups-printable.css \
586 --header api-filedir.header
--intro api-filedir.shtml \
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 \
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
599 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
600 --css ..
/doc
/cups-printable.css \
601 --header api-httpipp.header
--intro api-httpipp.shtml \
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 \
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
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 \
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 \
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 \
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
664 # Lines of code computation...
668 echo
"libcupslite: \c"
669 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
671 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
679 tls.o
: tls-darwin.c tls-gnutls.c tls-sspi.c