2 # "$Id: Makefile 13138 2016-03-15 14:59:54Z msweet $"
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
=""
110 # Header files to install...
149 # Targets in this directory...
180 # Make all targets...
187 # Make library targets...
197 unittests
: $(UNITTARGETS
)
201 # Remove object and target files...
205 $(RM
) $(OBJS
) $(TARGETS
) $(UNITTARGETS
)
206 $(RM
) libcups.so libcups.dylib
210 # Update dependencies (without system header dependencies...)
214 $(CC
) -MM
$(ALL_CFLAGS
) $(OBJS
:.o
=.c
) >Dependencies
218 # Run oclint to check code coverage...
222 oclint
-o
=oclint.html
-html
$(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
226 # Install all targets...
229 install: all install-data install-headers install-libs install-exec
233 # Install data files...
240 # Install programs...
251 echo Installing header files into
$(INCLUDEDIR
)/cups...
252 $(INSTALL_DIR
) -m
755 $(INCLUDEDIR
)/cups
253 for file in
$(HEADERS
); do \
254 $(INSTALL_DATA
) $$file $(INCLUDEDIR
)/cups
; \
256 if
test "x$(privateinclude)" != x
; then \
257 echo Installing private header files into
$(PRIVATEINCLUDE
)...
; \
258 $(INSTALL_DIR
) -m
755 $(PRIVATEINCLUDE
); \
259 for file in
$(HEADERSPRIV
); do \
260 $(INSTALL_DATA
) $$file $(PRIVATEINCLUDE
)/$$file; \
266 # Install libraries...
269 install-libs
: $(INSTALLSTATIC
)
270 echo Installing libraries in
$(LIBDIR
)...
271 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
272 $(INSTALL_LIB
) $(LIBCUPS
) $(LIBDIR
)
273 if
test $(LIBCUPS
) = "libcups.so.2"; then \
274 $(RM
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
275 $(LN
) $(LIBCUPS
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
277 if
test $(LIBCUPS
) = "libcups.2.dylib"; then \
278 $(RM
) $(LIBDIR
)/libcups.dylib
; \
279 $(LN
) $(LIBCUPS
) $(LIBDIR
)/libcups.dylib
; \
281 if
test "x$(SYMROOT)" != "x"; then \
282 $(INSTALL_DIR
) $(SYMROOT
); \
283 cp
$(LIBCUPS
) $(SYMROOT
); \
284 dsymutil
$(SYMROOT
)/$(LIBCUPS
); \
288 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
289 $(INSTALL_LIB
) -m
755 $(LIBCUPSSTATIC
) $(LIBDIR
)
290 $(RANLIB
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
291 $(CHMOD
) 555 $(LIBDIR
)/$(LIBCUPSSTATIC
)
295 # Uninstall object and target files...
299 $(RM
) $(LIBDIR
)/libcups
.2.dylib
300 $(RM
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
301 $(RM
) $(LIBDIR
)/libcups.dylib
302 $(RM
) $(LIBDIR
)/libcups.so
303 $(RM
) $(LIBDIR
)/libcups.so
.2
305 for file in
$(HEADERS
); do \
306 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
308 -$(RMDIR
) $(INCLUDEDIR
)/cups
315 libcups.so
.2: $(LIBOBJS
)
317 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
318 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
319 $(RM
) `basename $@ .2`
320 $(LN
) $@
`basename $@ .2`
327 libcups
.2.dylib
: $(LIBOBJS
) $(LIBCUPSORDER
)
328 echo Creating
export list for
$@...
329 nm
-gm
$(LIBOBJS
) 2>/dev
/null | grep
"__text" | grep
-v weak | \
330 awk
'{print $$NF}' | \
331 grep
-v
-E
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault)$$' | \
334 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
335 -install_name
$(libdir)/$@ \
336 -current_version
2.12.0 \
337 -compatibility_version
2.0.0 \
338 -exported_symbols_list t.exp \
339 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
340 $(COMMONLIBS
) $(LIBZ
)
341 $(RM
) libcups.dylib t.exp
342 $(LN
) $@ libcups.dylib
349 libcups.la
: $(LIBOBJS
)
351 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
352 -rpath
$(LIBDIR
) -version-info
2:12 $(LIBGSSAPI
) $(SSLLIBS
) \
353 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
360 libcups.a
: $(LIBOBJS
)
363 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
368 # libcups2.def (Windows DLL exports file...)
371 libcups2.def
: $(LIBOBJS
) Makefile
372 echo Generating
$@...
373 echo
"LIBRARY libcups2" >libcups2.def
374 echo
"VERSION 2.11" >>libcups2.def
375 echo
"EXPORTS" >>libcups2.def
376 (nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}'; \
377 echo __cups_strcpy
; echo __cups_strlcat
; echo __cups_strlcpy
) | \
379 -e
'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel' \
381 sed
-e
'1,$$s/^_//' |
sort >>libcups2.def
385 # testadmin (dependency on static CUPS library is intentional)
388 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
390 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
391 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
395 # testarray (dependency on static CUPS library is intentional)
398 testarray
: testarray.o
$(LIBCUPSSTATIC
)
400 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
401 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
402 echo Running array API tests...
407 # testcache (dependency on static CUPS library is intentional)
410 testcache
: testcache.o
$(LIBCUPSSTATIC
)
412 $(CC
) $(LDFLAGS
) -o
$@ testcache.o
$(LIBCUPSSTATIC
) \
413 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
417 # testconflicts (dependency on static CUPS library is intentional)
420 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
422 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
423 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
427 # testcups (dependency on static CUPS library is intentional)
430 testcups
: testcups.o
$(LIBCUPSSTATIC
)
432 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
433 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
437 # testdest (dependency on static CUPS library is intentional)
440 testdest
: testdest.o
$(LIBCUPSSTATIC
)
442 $(CC
) $(LDFLAGS
) -o
$@ testdest.o
$(LIBCUPSSTATIC
) \
443 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
447 # testfile (dependency on static CUPS library is intentional)
450 testfile
: testfile.o
$(LIBCUPSSTATIC
)
452 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
453 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
454 echo Running file API tests...
459 # testhttp (dependency on static CUPS library is intentional)
462 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
464 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
465 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
466 echo Running HTTP API tests...
471 # testhuffman (dependency on static CUPS library is intentional)
474 testhuffman
: testhuffman.o
$(LIBCUPSSTATIC
)
476 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhuffman.o
$(LIBCUPSSTATIC
) \
477 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
478 echo Running HTTP
/2 Huffman tests...
483 # testipp (dependency on static CUPS library is intentional)
486 testipp
: testipp.o
$(LIBCUPSSTATIC
)
488 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
489 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
490 echo Running IPP API tests...
495 # testi18n (dependency on static CUPS library is intentional)
498 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
500 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
501 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
502 echo Running internationalization API tests...
507 # testlang (dependency on static CUPS library is intentional)
510 testlang
: testlang.o
$(LIBCUPSSTATIC
)
512 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
513 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
514 echo Running language API tests...
519 # testoptions (dependency on static CUPS library is intentional)
522 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
524 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
525 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
526 echo Running option API tests...
531 # testppd (dependency on static CUPS library is intentional)
534 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
536 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
537 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
538 echo Running PPD API tests...
543 # testpwg (dependency on static CUPS library is intentional)
546 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
548 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
549 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
550 echo Running PWG API tests...
555 # testsnmp (dependency on static CUPS library is intentional)
558 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
560 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
561 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
565 # tlscheck (dependency on static CUPS library is intentional)
568 tlscheck
: tlscheck.o
$(LIBCUPSSTATIC
)
570 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ tlscheck.o
$(LIBCUPSSTATIC
) \
571 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
575 # Automatic API help files...
579 echo Generating CUPS API help files...
580 mxmldoc
--section
"Programming" \
581 --title
"Introduction to CUPS Programming" \
582 --css ..
/doc
/cups-printable.css \
583 --header api-overview.header
--intro api-overview.shtml \
584 >..
/doc
/help
/api-overview.html
585 mxmldoc
--section
"Programming" --title
"Array API" \
586 --css ..
/doc
/cups-printable.css \
587 --header api-array.header
--intro api-array.shtml \
589 array.h array.c
>..
/doc
/help
/api-array.html
590 mxmldoc
--tokens help
/api-array.html api-array.xml
>..
/doc
/help
/api-array.tokens
592 mxmldoc
--section
"Programming" --title
"CUPS API" \
593 --css ..
/doc
/cups-printable.css \
594 --header api-cups.header
--intro api-cups.shtml \
596 cups.h pwg.h adminutil.c dest
*.c language.c notify.c \
597 options.c pwg-media.c tempfile.c usersys.c \
598 util.c
>..
/doc
/help
/api-cups.html
599 mxmldoc
--tokens help
/api-cups.html api-cups.xml
>..
/doc
/help
/api-cups.tokens
601 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
602 --css ..
/doc
/cups-printable.css \
603 --header api-filedir.header
--intro api-filedir.shtml \
605 file.h file.c
dir.h
dir.c
>..
/doc
/help
/api-filedir.html
606 mxmldoc
--tokens api-filedir.xml
>..
/doc
/help
/api-filedir.tokens
607 $(RM
) api-filedir.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 mxmldoc
--tokens help
/api-ppd.html api-ppd.xml
>..
/doc
/help
/api-ppd.tokens
614 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
615 --css ..
/doc
/cups-printable.css \
616 --header api-httpipp.header
--intro api-httpipp.shtml \
618 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
619 http.c http-addr.c http-support.c ipp.c ipp-support.c \
620 md5passwd.c request.c
>..
/doc
/help
/api-httpipp.html
621 mxmldoc
--tokens help
/api-httpipp.html api-httpipp.xml
>..
/doc
/help
/api-httpipp.tokens
622 $(RM
) api-httpipp.xml
623 mxmldoc
--section
"Programming" \
624 --title
"Filter and Backend Programming" \
625 --css ..
/doc
/cups-printable.css \
626 --header api-filter.header
--intro api-filter.shtml \
628 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
629 >..
/doc
/help
/api-filter.html
630 mxmldoc
--tokens help
/api-filter.html api-filter.xml
>..
/doc
/help
/api-filter.tokens
634 echo Generating CUPS API help files...
635 mxmldoc
--framed api-overview \
636 --section
"Programming" \
637 --title
"Introduction to CUPS Programming" \
638 --css ..
/doc
/cups-printable.css \
639 --header api-overview.header
--intro api-overview.shtml
640 mxmldoc
--framed api-array \
641 --section
"Programming" --title
"Array API" \
642 --css ..
/doc
/cups-printable.css \
643 --header api-array.header
--intro api-array.shtml \
645 mxmldoc
--framed api-cups \
646 --section
"Programming" --title
"CUPS API" \
647 --css ..
/doc
/cups-printable.css \
648 --header api-cups.header
--intro api-cups.shtml \
649 cups.h adminutil.c dest
*.c language.c notify.c \
650 options.c tempfile.c usersys.c \
652 mxmldoc
--framed api-filedir \
653 --section
"Programming" --title
"File and Directory APIs" \
654 --css ..
/doc
/cups-printable.css \
655 --header api-filedir.header
--intro api-filedir.shtml \
656 file.h file.c
dir.h
dir.c
657 mxmldoc
--framed api-ppd \
658 --section
"Programming" --title
"PPD API (DEPRECATED)" \
659 --css ..
/doc
/cups-printable.css \
660 --header api-ppd.header
--intro api-ppd.shtml \
661 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
663 mxmldoc
--framed api-httpipp \
664 --section
"Programming" --title
"HTTP and IPP APIs" \
665 --css ..
/doc
/cups-printable.css \
666 --header api-httpipp.header
--intro api-httpipp.shtml \
667 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
668 http.c http-addr.c http-support.c ipp.c ipp-support.c \
669 md5passwd.c request.c
670 mxmldoc
--framed api-filter \
671 --section
"Programming" \
672 --title
"Filter and Backend Programming" \
673 --css ..
/doc
/cups-printable.css \
674 --header api-filter.header
--intro api-filter.shtml \
675 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
679 # Lines of code computation...
683 echo
"libcupslite: \c"
684 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
686 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
694 tls.o
: tls-darwin.c tls-gnutls.c tls-sspi.c
698 # End of "$Id: Makefile 13138 2016-03-15 14:59:54Z msweet $".