2 # Library Makefile for CUPS.
4 # Copyright 2007-2017 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 # 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
=""
108 # Header files to install...
146 # Targets in this directory...
178 # Make all targets...
185 # Make library targets...
195 unittests
: $(UNITTARGETS
)
199 # Remove object and target files...
203 $(RM
) $(OBJS
) $(TARGETS
) $(UNITTARGETS
)
204 $(RM
) libcups.so libcups.dylib
208 # Update dependencies (without system header dependencies...)
212 $(CC
) -MM
$(ALL_CFLAGS
) $(OBJS
:.o
=.c
) >Dependencies
216 # Run oclint to check code coverage...
220 oclint
-o
=oclint.html
-html
$(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
224 # Install all targets...
227 install: all install-data install-headers install-libs install-exec
231 # Install data files...
238 # Install programs...
249 echo Installing header files into
$(INCLUDEDIR
)/cups...
250 $(INSTALL_DIR
) -m
755 $(INCLUDEDIR
)/cups
251 for file in
$(HEADERS
); do \
252 $(INSTALL_DATA
) $$file $(INCLUDEDIR
)/cups
; \
254 if
test "x$(privateinclude)" != x
; then \
255 echo Installing private header files into
$(PRIVATEINCLUDE
)...
; \
256 $(INSTALL_DIR
) -m
755 $(PRIVATEINCLUDE
); \
257 for file in
$(HEADERSPRIV
); do \
258 $(INSTALL_DATA
) $$file $(PRIVATEINCLUDE
)/$$file; \
264 # Install libraries...
267 install-libs
: $(INSTALLSTATIC
)
268 echo Installing libraries in
$(LIBDIR
)...
269 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
270 $(INSTALL_LIB
) $(LIBCUPS
) $(LIBDIR
)
271 if
test $(LIBCUPS
) = "libcups.so.2"; then \
272 $(RM
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
273 $(LN
) $(LIBCUPS
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
275 if
test $(LIBCUPS
) = "libcups.2.dylib"; then \
276 $(RM
) $(LIBDIR
)/libcups.dylib
; \
277 $(LN
) $(LIBCUPS
) $(LIBDIR
)/libcups.dylib
; \
279 if
test "x$(SYMROOT)" != "x"; then \
280 $(INSTALL_DIR
) $(SYMROOT
); \
281 cp
$(LIBCUPS
) $(SYMROOT
); \
282 dsymutil
$(SYMROOT
)/$(LIBCUPS
); \
286 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
287 $(INSTALL_LIB
) -m
755 $(LIBCUPSSTATIC
) $(LIBDIR
)
288 $(RANLIB
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
289 $(CHMOD
) 555 $(LIBDIR
)/$(LIBCUPSSTATIC
)
293 # Uninstall object and target files...
297 $(RM
) $(LIBDIR
)/libcups
.2.dylib
298 $(RM
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
299 $(RM
) $(LIBDIR
)/libcups.dylib
300 $(RM
) $(LIBDIR
)/libcups.so
301 $(RM
) $(LIBDIR
)/libcups.so
.2
303 for file in
$(HEADERS
); do \
304 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
306 -$(RMDIR
) $(INCLUDEDIR
)/cups
313 libcups.so
.2: $(LIBOBJS
)
315 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
316 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
317 $(RM
) `basename $@ .2`
318 $(LN
) $@
`basename $@ .2`
325 libcups
.2.dylib
: $(LIBOBJS
) $(LIBCUPSORDER
)
326 echo Creating
export list for
$@...
327 nm
-gm
$(LIBOBJS
) 2>/dev
/null | grep
"__text" | grep
-v weak | \
328 awk
'{print $$NF}' | \
329 grep
-v
-E
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault)$$' | \
332 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
333 -install_name
$(libdir)/$@ \
334 -current_version
2.12.0 \
335 -compatibility_version
2.0.0 \
336 -exported_symbols_list t.exp \
337 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
338 $(COMMONLIBS
) $(LIBZ
)
339 $(RM
) libcups.dylib t.exp
340 $(LN
) $@ libcups.dylib
347 libcups.la
: $(LIBOBJS
)
349 $(LD_CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
350 -rpath
$(LIBDIR
) -version-info
2:12 $(LIBGSSAPI
) $(SSLLIBS
) \
351 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
358 libcups.a
: $(LIBOBJS
)
361 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
366 # libcups2.def (Windows DLL exports file...)
369 libcups2.def
: $(LIBOBJS
) Makefile
370 echo Generating
$@...
371 echo
"LIBRARY libcups2" >libcups2.def
372 echo
"VERSION 2.12" >>libcups2.def
373 echo
"EXPORTS" >>libcups2.def
374 (nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}'; \
375 echo __cups_strcpy
; echo __cups_strlcat
; echo __cups_strlcpy
) | \
377 -e
'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel' \
379 sed
-e
'1,$$s/^_//' |
sort >>libcups2.def
383 # testadmin (dependency on static CUPS library is intentional)
386 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
388 $(LD_CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
389 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
393 # testarray (dependency on static CUPS library is intentional)
396 testarray
: testarray.o
$(LIBCUPSSTATIC
)
398 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
399 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
400 echo Running array API tests...
405 # testcache (dependency on static CUPS library is intentional)
408 testcache
: testcache.o
$(LIBCUPSSTATIC
)
410 $(LD_CC
) $(LDFLAGS
) -o
$@ testcache.o
$(LIBCUPSSTATIC
) \
411 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
415 # testconflicts (dependency on static CUPS library is intentional)
418 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
420 $(LD_CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
421 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
425 # testcreds (dependency on static CUPS library is intentional)
428 testcreds
: testcreds.o
$(LIBCUPSSTATIC
)
430 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testcreds.o
$(LIBCUPSSTATIC
) \
431 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
435 # testcups (dependency on static CUPS library is intentional)
438 testcups
: testcups.o
$(LIBCUPSSTATIC
)
440 $(LD_CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
441 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
445 # testdest (dependency on static CUPS library is intentional)
448 testdest
: testdest.o
$(LIBCUPSSTATIC
)
450 $(LD_CC
) $(LDFLAGS
) -o
$@ testdest.o
$(LIBCUPSSTATIC
) \
451 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
455 # testfile (dependency on static CUPS library is intentional)
458 testfile
: testfile.o
$(LIBCUPSSTATIC
)
460 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
461 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
462 echo Running file API tests...
467 # testgetdests (dependency on static CUPS library is intentional)
470 testgetdests
: testgetdests.o
$(LIBCUPSSTATIC
)
472 $(LD_CC
) $(LDFLAGS
) -o
$@ testgetdests.o
$(LIBCUPSSTATIC
) \
473 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
477 # testhttp (dependency on static CUPS library is intentional)
480 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
482 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
483 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
484 echo Running HTTP API tests...
489 # testipp (dependency on static CUPS library is intentional)
492 testipp
: testipp.o
$(LIBCUPSSTATIC
)
494 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
495 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
496 echo Running IPP API tests...
501 # testi18n (dependency on static CUPS library is intentional)
504 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
506 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
507 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
508 echo Running internationalization API tests...
513 # testlang (dependency on static CUPS library is intentional)
516 testlang
: testlang.o
$(LIBCUPSSTATIC
)
518 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
519 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
520 echo Creating locale directory structure...
523 for po in ..
/locale
/cups_
*.po
; do \
524 lang
=`basename $$po .po | sed -e '1,$$s/^cups_//'`; \
525 $(MKDIR
) locale
/$$lang; \
526 $(LN
) $$po locale
/$$lang; \
528 echo Running language API tests...
529 LOCALEDIR
=locale .
/testlang
533 # testoptions (dependency on static CUPS library is intentional)
536 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
538 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
539 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
540 echo Running option API tests...
545 # testppd (dependency on static CUPS library is intentional)
548 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
550 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
551 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
552 echo Running PPD API tests...
557 # testpwg (dependency on static CUPS library is intentional)
560 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
562 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
563 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
564 echo Running PWG API tests...
569 # testsnmp (dependency on static CUPS library is intentional)
572 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
574 $(LD_CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
575 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
579 # tlscheck (dependency on static CUPS library is intentional)
582 tlscheck
: tlscheck.o
$(LIBCUPSSTATIC
)
584 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ tlscheck.o
$(LIBCUPSSTATIC
) \
585 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
589 # Automatic API help files...
593 echo Generating CUPS API help files...
595 mxmldoc
--section
"Programming" --body cupspm.md \
597 auth.c cups.h dest
*.c encode.c http.h http
*.c ipp.h ipp
*.c \
598 options.c tls-darwin.c usersys.c util.c \
599 --coverimage cupspm.png \
600 --epub ..
/doc
/help
/cupspm.epub
601 mxmldoc
--section
"Programming" --body cupspm.md \
602 cupspm.xml
> ..
/doc
/help
/cupspm.html
604 mxmldoc
--section
"Programming" --title
"Administration APIs" \
605 --css ..
/doc
/cups-printable.css \
606 --header api-admin.header
--intro api-admin.shtml \
608 adminutil.c adminutil.h getdevices.c
>..
/doc
/help
/api-admin.html
610 mxmldoc
--section
"Programming" --title
"PPD API (DEPRECATED)" \
611 --css ..
/doc
/cups-printable.css \
612 --header api-ppd.header
--intro api-ppd.shtml \
613 api-ppd.xml ppd.h ppd-
*.c
>..
/doc
/help
/api-ppd.html
615 mxmldoc
--section
"Programming" \
616 --title
"Filter and Backend Programming" \
617 --css ..
/doc
/cups-printable.css \
618 --header api-filter.header
--intro api-filter.shtml \
620 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
621 >..
/doc
/help
/api-filter.html
626 # Lines of code computation...
631 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
639 tls.o
: tls-darwin.c tls-gnutls.c tls-sspi.c