2 # API library Makefile for CUPS.
4 # Copyright 2007-2015 by Apple Inc.
5 # Copyright 1997-2006 by Easy Software Products, all rights reserved.
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 # file is missing or damaged, see the license at "http://www.cups.org/".
13 # This file is subject to the Apple OS-Developed Software exception.
20 # Options to build libcups without the use of deprecated APIs...
23 OPTIONS
= -D_CUPS_NO_DEPRECATED
=1 -D_PPD_DEPRECATED
=""
106 # Header files to install...
144 # Targets in this directory...
174 # Make all targets...
181 # Make library targets...
191 unittests
: $(UNITTARGETS
)
195 # Remove object and target files...
199 $(RM
) $(OBJS
) $(TARGETS
) $(UNITTARGETS
)
200 $(RM
) libcups.so libcups.dylib
204 # Update dependencies (without system header dependencies...)
208 $(CC
) -MM
$(ALL_CFLAGS
) $(OBJS
:.o
=.c
) >Dependencies
212 # Run oclint to check code coverage...
216 oclint
-o
=oclint.html
-html
$(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
220 # Install all targets...
223 install: all install-data install-headers install-libs install-exec
227 # Install data files...
234 # Install programs...
245 echo Installing header files into
$(INCLUDEDIR
)/cups...
246 $(INSTALL_DIR
) -m
755 $(INCLUDEDIR
)/cups
247 for file in
$(HEADERS
); do \
248 $(INSTALL_DATA
) $$file $(INCLUDEDIR
)/cups
; \
250 if
test "x$(privateinclude)" != x
; then \
251 echo Installing private header files into
$(PRIVATEINCLUDE
)...
; \
252 $(INSTALL_DIR
) -m
755 $(PRIVATEINCLUDE
); \
253 for file in
$(HEADERSPRIV
); do \
254 $(INSTALL_DATA
) $$file $(PRIVATEINCLUDE
)/$$file; \
260 # Install libraries...
263 install-libs
: $(INSTALLSTATIC
)
264 echo Installing libraries in
$(LIBDIR
)...
265 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
266 $(INSTALL_LIB
) $(LIBCUPS
) $(LIBDIR
)
267 if
test $(LIBCUPS
) = "libcups.so.2"; then \
268 $(RM
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
269 $(LN
) $(LIBCUPS
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
271 if
test $(LIBCUPS
) = "libcups.2.dylib"; then \
272 $(RM
) $(LIBDIR
)/libcups.dylib
; \
273 $(LN
) $(LIBCUPS
) $(LIBDIR
)/libcups.dylib
; \
275 if
test "x$(SYMROOT)" != "x"; then \
276 $(INSTALL_DIR
) $(SYMROOT
); \
277 cp
$(LIBCUPS
) $(SYMROOT
); \
278 dsymutil
$(SYMROOT
)/$(LIBCUPS
); \
282 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
283 $(INSTALL_LIB
) -m
755 $(LIBCUPSSTATIC
) $(LIBDIR
)
284 $(RANLIB
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
285 $(CHMOD
) 555 $(LIBDIR
)/$(LIBCUPSSTATIC
)
289 # Uninstall object and target files...
293 $(RM
) $(LIBDIR
)/libcups
.2.dylib
294 $(RM
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
295 $(RM
) $(LIBDIR
)/libcups.dylib
296 $(RM
) $(LIBDIR
)/libcups.so
297 $(RM
) $(LIBDIR
)/libcups.so
.2
299 for file in
$(HEADERS
); do \
300 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
302 -$(RMDIR
) $(INCLUDEDIR
)/cups
309 libcups.so
.2: $(LIBOBJS
)
311 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
312 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
313 $(RM
) `basename $@ .2`
314 $(LN
) $@
`basename $@ .2`
321 libcups
.2.dylib
: $(LIBOBJS
) $(LIBCUPSORDER
)
322 echo Creating
export list for
$@...
323 nm
-gm
$(LIBOBJS
) 2>/dev
/null | grep
"__text" | grep
-v weak | \
324 awk
'{print $$NF}' | \
325 grep
-v
-E
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault)$$' | \
328 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
329 -install_name
$(libdir)/$@ \
330 -current_version
2.12.0 \
331 -compatibility_version
2.0.0 \
332 -exported_symbols_list t.exp \
333 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
334 $(COMMONLIBS
) $(LIBZ
)
335 $(RM
) libcups.dylib t.exp
336 $(LN
) $@ libcups.dylib
343 libcups.la
: $(LIBOBJS
)
345 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
346 -rpath
$(LIBDIR
) -version-info
2:12 $(LIBGSSAPI
) $(SSLLIBS
) \
347 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
354 libcups.a
: $(LIBOBJS
)
357 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
362 # libcups2.def (Windows DLL exports file...)
365 libcups2.def
: $(LIBOBJS
) Makefile
366 echo Generating
$@...
367 echo
"LIBRARY libcups2" >libcups2.def
368 echo
"VERSION 2.11" >>libcups2.def
369 echo
"EXPORTS" >>libcups2.def
370 (nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}'; \
371 echo __cups_strcpy
; echo __cups_strlcat
; echo __cups_strlcpy
) | \
373 -e
'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel' \
375 sed
-e
'1,$$s/^_//' |
sort >>libcups2.def
379 # testadmin (dependency on static CUPS library is intentional)
382 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
384 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
385 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
389 # testarray (dependency on static CUPS library is intentional)
392 testarray
: testarray.o
$(LIBCUPSSTATIC
)
394 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
395 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
396 echo Running array API tests...
401 # testcache (dependency on static CUPS library is intentional)
404 testcache
: testcache.o
$(LIBCUPSSTATIC
)
406 $(CC
) $(LDFLAGS
) -o
$@ testcache.o
$(LIBCUPSSTATIC
) \
407 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
411 # testconflicts (dependency on static CUPS library is intentional)
414 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
416 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
417 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
421 # testcups (dependency on static CUPS library is intentional)
424 testcups
: testcups.o
$(LIBCUPSSTATIC
)
426 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
427 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
431 # testdest (dependency on static CUPS library is intentional)
434 testdest
: testdest.o
$(LIBCUPSSTATIC
)
436 $(CC
) $(LDFLAGS
) -o
$@ testdest.o
$(LIBCUPSSTATIC
) \
437 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
441 # testfile (dependency on static CUPS library is intentional)
444 testfile
: testfile.o
$(LIBCUPSSTATIC
)
446 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
447 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
448 echo Running file API tests...
453 # testhttp (dependency on static CUPS library is intentional)
456 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
458 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
459 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
460 echo Running HTTP API tests...
465 # testipp (dependency on static CUPS library is intentional)
468 testipp
: testipp.o
$(LIBCUPSSTATIC
)
470 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
471 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
472 echo Running IPP API tests...
477 # testi18n (dependency on static CUPS library is intentional)
480 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
482 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
483 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
484 echo Running internationalization API tests...
489 # testlang (dependency on static CUPS library is intentional)
492 testlang
: testlang.o
$(LIBCUPSSTATIC
)
494 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
495 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
496 echo Running language API tests...
501 # testoptions (dependency on static CUPS library is intentional)
504 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
506 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
507 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
508 echo Running option API tests...
513 # testppd (dependency on static CUPS library is intentional)
516 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
518 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
519 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
520 echo Running PPD API tests...
525 # testpwg (dependency on static CUPS library is intentional)
528 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
530 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
531 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
532 echo Running PWG API tests...
537 # testsnmp (dependency on static CUPS library is intentional)
540 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
542 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
543 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
547 # tlscheck (dependency on static CUPS library is intentional)
550 tlscheck
: tlscheck.o
$(LIBCUPSSTATIC
)
552 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ tlscheck.o
$(LIBCUPSSTATIC
) \
553 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
557 # Automatic API help files...
561 echo Generating CUPS API help files...
562 mxmldoc
--section
"Programming" \
563 --title
"Introduction to CUPS Programming" \
564 --css ..
/doc
/cups-printable.css \
565 --header api-overview.header
--intro api-overview.shtml \
566 >..
/doc
/help
/api-overview.html
567 mxmldoc
--section
"Programming" --title
"Array API" \
568 --css ..
/doc
/cups-printable.css \
569 --header api-array.header
--intro api-array.shtml \
571 array.h array.c
>..
/doc
/help
/api-array.html
572 mxmldoc
--tokens help
/api-array.html api-array.xml
>..
/doc
/help
/api-array.tokens
574 mxmldoc
--section
"Programming" --title
"CUPS API" \
575 --css ..
/doc
/cups-printable.css \
576 --header api-cups.header
--intro api-cups.shtml \
578 cups.h pwg.h adminutil.c dest
*.c language.c notify.c \
579 options.c pwg-media.c tempfile.c usersys.c \
580 util.c
>..
/doc
/help
/api-cups.html
581 mxmldoc
--tokens help
/api-cups.html api-cups.xml
>..
/doc
/help
/api-cups.tokens
583 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
584 --css ..
/doc
/cups-printable.css \
585 --header api-filedir.header
--intro api-filedir.shtml \
587 file.h file.c
dir.h
dir.c
>..
/doc
/help
/api-filedir.html
588 mxmldoc
--tokens api-filedir.xml
>..
/doc
/help
/api-filedir.tokens
589 $(RM
) api-filedir.xml
590 mxmldoc
--section
"Programming" --title
"PPD API (DEPRECATED)" \
591 --css ..
/doc
/cups-printable.css \
592 --header api-ppd.header
--intro api-ppd.shtml \
593 api-ppd.xml ppd.h ppd-
*.c
>..
/doc
/help
/api-ppd.html
594 mxmldoc
--tokens help
/api-ppd.html api-ppd.xml
>..
/doc
/help
/api-ppd.tokens
596 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
597 --css ..
/doc
/cups-printable.css \
598 --header api-httpipp.header
--intro api-httpipp.shtml \
600 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
601 http.c http-addr.c http-support.c ipp.c ipp-support.c \
602 md5passwd.c request.c
>..
/doc
/help
/api-httpipp.html
603 mxmldoc
--tokens help
/api-httpipp.html api-httpipp.xml
>..
/doc
/help
/api-httpipp.tokens
604 $(RM
) api-httpipp.xml
605 mxmldoc
--section
"Programming" \
606 --title
"Filter and Backend Programming" \
607 --css ..
/doc
/cups-printable.css \
608 --header api-filter.header
--intro api-filter.shtml \
610 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
611 >..
/doc
/help
/api-filter.html
612 mxmldoc
--tokens help
/api-filter.html api-filter.xml
>..
/doc
/help
/api-filter.tokens
616 echo Generating CUPS API help files...
617 mxmldoc
--framed api-overview \
618 --section
"Programming" \
619 --title
"Introduction to CUPS Programming" \
620 --css ..
/doc
/cups-printable.css \
621 --header api-overview.header
--intro api-overview.shtml
622 mxmldoc
--framed api-array \
623 --section
"Programming" --title
"Array API" \
624 --css ..
/doc
/cups-printable.css \
625 --header api-array.header
--intro api-array.shtml \
627 mxmldoc
--framed api-cups \
628 --section
"Programming" --title
"CUPS API" \
629 --css ..
/doc
/cups-printable.css \
630 --header api-cups.header
--intro api-cups.shtml \
631 cups.h adminutil.c dest
*.c language.c notify.c \
632 options.c tempfile.c usersys.c \
634 mxmldoc
--framed api-filedir \
635 --section
"Programming" --title
"File and Directory APIs" \
636 --css ..
/doc
/cups-printable.css \
637 --header api-filedir.header
--intro api-filedir.shtml \
638 file.h file.c
dir.h
dir.c
639 mxmldoc
--framed api-ppd \
640 --section
"Programming" --title
"PPD API (DEPRECATED)" \
641 --css ..
/doc
/cups-printable.css \
642 --header api-ppd.header
--intro api-ppd.shtml \
643 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
645 mxmldoc
--framed api-httpipp \
646 --section
"Programming" --title
"HTTP and IPP APIs" \
647 --css ..
/doc
/cups-printable.css \
648 --header api-httpipp.header
--intro api-httpipp.shtml \
649 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
650 http.c http-addr.c http-support.c ipp.c ipp-support.c \
651 md5passwd.c request.c
652 mxmldoc
--framed api-filter \
653 --section
"Programming" \
654 --title
"Filter and Backend Programming" \
655 --css ..
/doc
/cups-printable.css \
656 --header api-filter.header
--intro api-filter.shtml \
657 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
661 # Lines of code computation...
665 echo
"libcupslite: \c"
666 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
668 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
676 tls.o
: tls-darwin.c tls-gnutls.c tls-sspi.c