2 # API library Makefile for CUPS.
4 # Copyright 2007-2016 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
=""
107 # Header files to install...
145 # 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
-gm
$(LIBOBJS
) 2>/dev
/null | grep
"__text" | grep
-v weak | \
326 awk
'{print $$NF}' | \
327 grep
-v
-E
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault)$$' | \
330 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
331 -install_name
$(libdir)/$@ \
332 -current_version
2.12.0 \
333 -compatibility_version
2.0.0 \
334 -exported_symbols_list t.exp \
335 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
336 $(COMMONLIBS
) $(LIBZ
)
337 $(RM
) libcups.dylib t.exp
338 $(LN
) $@ libcups.dylib
345 libcups.la
: $(LIBOBJS
)
347 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
348 -rpath
$(LIBDIR
) -version-info
2:12 $(LIBGSSAPI
) $(SSLLIBS
) \
349 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
356 libcups.a
: $(LIBOBJS
)
359 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
364 # libcups2.def (Windows DLL exports file...)
367 libcups2.def
: $(LIBOBJS
) Makefile
368 echo Generating
$@...
369 echo
"LIBRARY libcups2" >libcups2.def
370 echo
"VERSION 2.12" >>libcups2.def
371 echo
"EXPORTS" >>libcups2.def
372 (nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}'; \
373 echo __cups_strcpy
; echo __cups_strlcat
; echo __cups_strlcpy
) | \
375 -e
'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel' \
377 sed
-e
'1,$$s/^_//' |
sort >>libcups2.def
381 # testadmin (dependency on static CUPS library is intentional)
384 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
386 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
387 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
391 # testarray (dependency on static CUPS library is intentional)
394 testarray
: testarray.o
$(LIBCUPSSTATIC
)
396 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
397 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
398 echo Running array API tests...
403 # testcache (dependency on static CUPS library is intentional)
406 testcache
: testcache.o
$(LIBCUPSSTATIC
)
408 $(CC
) $(LDFLAGS
) -o
$@ testcache.o
$(LIBCUPSSTATIC
) \
409 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
413 # testconflicts (dependency on static CUPS library is intentional)
416 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
418 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
419 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
423 # testcreds (dependency on static CUPS library is intentional)
426 testcreds
: testcreds.o
$(LIBCUPSSTATIC
)
428 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testcreds.o
$(LIBCUPSSTATIC
) \
429 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
433 # testcups (dependency on static CUPS library is intentional)
436 testcups
: testcups.o
$(LIBCUPSSTATIC
)
438 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
439 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
443 # testdest (dependency on static CUPS library is intentional)
446 testdest
: testdest.o
$(LIBCUPSSTATIC
)
448 $(CC
) $(LDFLAGS
) -o
$@ testdest.o
$(LIBCUPSSTATIC
) \
449 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
453 # testfile (dependency on static CUPS library is intentional)
456 testfile
: testfile.o
$(LIBCUPSSTATIC
)
458 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
459 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
460 echo Running file API tests...
465 # testhttp (dependency on static CUPS library is intentional)
468 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
470 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
471 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
472 echo Running HTTP API tests...
477 # testipp (dependency on static CUPS library is intentional)
480 testipp
: testipp.o
$(LIBCUPSSTATIC
)
482 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
483 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
484 echo Running IPP API tests...
489 # testi18n (dependency on static CUPS library is intentional)
492 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
494 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
495 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
496 echo Running internationalization API tests...
501 # testlang (dependency on static CUPS library is intentional)
504 testlang
: testlang.o
$(LIBCUPSSTATIC
)
506 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
507 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
508 echo Running language API tests...
513 # testoptions (dependency on static CUPS library is intentional)
516 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
518 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
519 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
520 echo Running option API tests...
525 # testppd (dependency on static CUPS library is intentional)
528 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
530 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
531 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
532 echo Running PPD API tests...
537 # testpwg (dependency on static CUPS library is intentional)
540 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
542 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
543 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
544 echo Running PWG API tests...
549 # testsnmp (dependency on static CUPS library is intentional)
552 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
554 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
555 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
559 # tlscheck (dependency on static CUPS library is intentional)
562 tlscheck
: tlscheck.o
$(LIBCUPSSTATIC
)
564 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ tlscheck.o
$(LIBCUPSSTATIC
) \
565 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
569 # Automatic API help files...
573 echo Generating CUPS API help files...
574 mxmldoc
--section
"Programming" \
575 --title
"Introduction to CUPS Programming" \
576 --css ..
/doc
/cups-printable.css \
577 --header api-overview.header
--intro api-overview.shtml \
578 >..
/doc
/help
/api-overview.html
579 mxmldoc
--section
"Programming" --title
"Administration APIs" \
580 --css ..
/doc
/cups-printable.css \
581 --header api-admin.header
--intro api-admin.shtml \
583 adminutil.c adminutil.h getdevices.c
>..
/doc
/help
/api-admin.html
584 mxmldoc
--tokens help
/api-admin.html api-admin.xml
>..
/doc
/help
/api-admin.tokens
586 mxmldoc
--section
"Programming" --title
"Array API" \
587 --css ..
/doc
/cups-printable.css \
588 --header api-array.header
--intro api-array.shtml \
590 array.h array.c
>..
/doc
/help
/api-array.html
591 mxmldoc
--tokens help
/api-array.html api-array.xml
>..
/doc
/help
/api-array.tokens
593 mxmldoc
--section
"Programming" --title
"CUPS API" \
594 --css ..
/doc
/cups-printable.css \
595 --header api-cups.header
--intro api-cups.shtml \
597 cups.h pwg.h adminutil.c dest
*.c language.c notify.c \
598 options.c pwg-media.c tempfile.c usersys.c \
599 util.c
>..
/doc
/help
/api-cups.html
600 mxmldoc
--tokens help
/api-cups.html api-cups.xml
>..
/doc
/help
/api-cups.tokens
602 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
603 --css ..
/doc
/cups-printable.css \
604 --header api-filedir.header
--intro api-filedir.shtml \
606 file.h file.c
dir.h
dir.c
>..
/doc
/help
/api-filedir.html
607 mxmldoc
--tokens api-filedir.xml
>..
/doc
/help
/api-filedir.tokens
608 $(RM
) api-filedir.xml
609 mxmldoc
--section
"Programming" --title
"PPD API (DEPRECATED)" \
610 --css ..
/doc
/cups-printable.css \
611 --header api-ppd.header
--intro api-ppd.shtml \
612 api-ppd.xml ppd.h ppd-
*.c
>..
/doc
/help
/api-ppd.html
613 mxmldoc
--tokens help
/api-ppd.html api-ppd.xml
>..
/doc
/help
/api-ppd.tokens
615 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
616 --css ..
/doc
/cups-printable.css \
617 --header api-httpipp.header
--intro api-httpipp.shtml \
619 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
620 http.c http-addr.c http-support.c ipp.c ipp-support.c \
621 md5passwd.c request.c
>..
/doc
/help
/api-httpipp.html
622 mxmldoc
--tokens help
/api-httpipp.html api-httpipp.xml
>..
/doc
/help
/api-httpipp.tokens
623 $(RM
) api-httpipp.xml
624 mxmldoc
--section
"Programming" \
625 --title
"Filter and Backend Programming" \
626 --css ..
/doc
/cups-printable.css \
627 --header api-filter.header
--intro api-filter.shtml \
629 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
630 >..
/doc
/help
/api-filter.html
631 mxmldoc
--tokens help
/api-filter.html api-filter.xml
>..
/doc
/help
/api-filter.tokens
636 # Lines of code computation...
640 echo
"libcupslite: \c"
641 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
643 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
651 tls.o
: tls-darwin.c tls-gnutls.c tls-sspi.c