4 # API library Makefile for CUPS.
6 # Copyright 2007-2014 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
=""
102 # Header files to install...
140 # Targets in this directory...
168 # Make all targets...
175 # Make library targets...
185 unittests
: $(UNITTARGETS
)
189 # Remove object and target files...
193 $(RM
) $(OBJS
) $(TARGETS
) $(UNITTARGETS
)
194 $(RM
) libcups.so libcups.dylib
198 # Update dependencies (without system header dependencies...)
202 $(CC
) -MM
$(ALL_CFLAGS
) $(OBJS
:.o
=.c
) >Dependencies
206 # Run oclint to check code coverage...
210 oclint
-o
=oclint.html
-html
$(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
214 # Install all targets...
217 install: all install-data install-headers install-libs install-exec
221 # Install data files...
228 # Install programs...
239 echo Installing header files into
$(INCLUDEDIR
)/cups...
240 $(INSTALL_DIR
) -m
755 $(INCLUDEDIR
)/cups
241 for file in
$(HEADERS
); do \
242 $(INSTALL_DATA
) $$file $(INCLUDEDIR
)/cups
; \
244 if
test "x$(privateinclude)" != x
; then \
245 echo Installing private header files into
$(PRIVATEINCLUDE
)...
; \
246 $(INSTALL_DIR
) -m
755 $(PRIVATEINCLUDE
); \
247 for file in
$(HEADERSPRIV
); do \
248 $(INSTALL_DATA
) $$file $(PRIVATEINCLUDE
)/$$file; \
254 # Install libraries...
257 install-libs
: $(INSTALLSTATIC
)
258 echo Installing libraries in
$(LIBDIR
)...
259 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
260 $(INSTALL_LIB
) $(LIBCUPS
) $(LIBDIR
)
261 if
test $(LIBCUPS
) = "libcups.so.2"; then \
262 $(RM
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
263 $(LN
) $(LIBCUPS
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
265 if
test $(LIBCUPS
) = "libcups.2.dylib"; then \
266 $(RM
) $(LIBDIR
)/libcups.dylib
; \
267 $(LN
) $(LIBCUPS
) $(LIBDIR
)/libcups.dylib
; \
269 if
test "x$(SYMROOT)" != "x"; then \
270 $(INSTALL_DIR
) $(SYMROOT
); \
271 cp
$(LIBCUPS
) $(SYMROOT
); \
272 dsymutil
$(SYMROOT
)/$(LIBCUPS
); \
276 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
277 $(INSTALL_LIB
) -m
755 $(LIBCUPSSTATIC
) $(LIBDIR
)
278 $(RANLIB
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
279 $(CHMOD
) 555 $(LIBDIR
)/$(LIBCUPSSTATIC
)
283 # Uninstall object and target files...
287 $(RM
) $(LIBDIR
)/libcups
.2.dylib
288 $(RM
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
289 $(RM
) $(LIBDIR
)/libcups.dylib
290 $(RM
) $(LIBDIR
)/libcups.so
291 $(RM
) $(LIBDIR
)/libcups.so
.2
293 for file in
$(HEADERS
); do \
294 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
296 -$(RMDIR
) $(INCLUDEDIR
)/cups
303 libcups.so
.2: $(LIBOBJS
)
305 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
306 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
307 $(RM
) `basename $@ .2`
308 $(LN
) $@
`basename $@ .2`
315 libcups
.2.dylib
: $(LIBOBJS
) $(LIBCUPSORDER
)
316 echo Creating
export list for
$@...
317 nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}' | \
318 grep
-v
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
321 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
322 -install_name
$(libdir)/$@ \
323 -current_version
2.10.0 \
324 -compatibility_version
2.0.0 \
325 -exported_symbols_list t.exp \
326 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
327 $(COMMONLIBS
) $(LIBZ
)
328 $(RM
) libcups.dylib t.exp
329 $(LN
) $@ libcups.dylib
336 libcups.la
: $(LIBOBJS
)
338 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
339 -rpath
$(LIBDIR
) -version-info
2:10 $(LIBGSSAPI
) $(SSLLIBS
) \
340 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
347 libcups.a
: $(LIBOBJS
)
350 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
355 # testadmin (dependency on static CUPS library is intentional)
358 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
360 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
361 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
365 # testarray (dependency on static CUPS library is intentional)
368 testarray
: testarray.o
$(LIBCUPSSTATIC
)
370 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
371 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
372 echo Running array API tests...
377 # testcache (dependency on static CUPS library is intentional)
380 testcache
: testcache.o
$(LIBCUPSSTATIC
)
382 $(CC
) $(LDFLAGS
) -o
$@ testcache.o
$(LIBCUPSSTATIC
) \
383 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
387 # testconflicts (dependency on static CUPS library is intentional)
390 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
392 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
393 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
397 # testcups (dependency on static CUPS library is intentional)
400 testcups
: testcups.o
$(LIBCUPSSTATIC
)
402 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
403 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
407 # testfile (dependency on static CUPS library is intentional)
410 testfile
: testfile.o
$(LIBCUPSSTATIC
)
412 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
413 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
414 echo Running file API tests...
419 # testhttp (dependency on static CUPS library is intentional)
422 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
424 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
425 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
426 echo Running HTTP API tests...
431 # testipp (dependency on static CUPS library is intentional)
434 testipp
: testipp.o
$(LIBCUPSSTATIC
)
436 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
437 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
438 echo Running IPP API tests...
443 # testi18n (dependency on static CUPS library is intentional)
446 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
448 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
449 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
450 echo Running internationalization API tests...
455 # testlang (dependency on static CUPS library is intentional)
458 testlang
: testlang.o
$(LIBCUPSSTATIC
)
460 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
461 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
462 echo Running language API tests...
467 # testoptions (dependency on static CUPS library is intentional)
470 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
472 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
473 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
474 echo Running option API tests...
479 # testppd (dependency on static CUPS library is intentional)
482 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
484 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
485 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
486 echo Running PPD API tests...
491 # testpwg (dependency on static CUPS library is intentional)
494 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
496 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
497 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
498 echo Running PWG API tests...
503 # testsnmp (dependency on static CUPS library is intentional)
506 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
508 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
509 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
513 # Automatic API help files...
517 echo Generating CUPS API help files...
518 mxmldoc
--section
"Programming" \
519 --title
"Introduction to CUPS Programming" \
520 --css ..
/doc
/cups-printable.css \
521 --header api-overview.header
--intro api-overview.shtml \
522 >..
/doc
/help
/api-overview.html
523 mxmldoc
--section
"Programming" --title
"Array API" \
524 --css ..
/doc
/cups-printable.css \
525 --header api-array.header
--intro api-array.shtml \
527 array.h array.c
>..
/doc
/help
/api-array.html
528 mxmldoc
--tokens help
/api-array.html api-array.xml
>..
/doc
/help
/api-array.tokens
530 mxmldoc
--section
"Programming" --title
"CUPS API" \
531 --css ..
/doc
/cups-printable.css \
532 --header api-cups.header
--intro api-cups.shtml \
534 cups.h pwg.h adminutil.c dest
*.c language.c notify.c \
535 options.c pwg-media.c tempfile.c usersys.c \
536 util.c
>..
/doc
/help
/api-cups.html
537 mxmldoc
--tokens help
/api-cups.html api-cups.xml
>..
/doc
/help
/api-cups.tokens
539 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
540 --css ..
/doc
/cups-printable.css \
541 --header api-filedir.header
--intro api-filedir.shtml \
543 file.h file.c
dir.h
dir.c
>..
/doc
/help
/api-filedir.html
544 mxmldoc
--tokens api-filedir.xml
>..
/doc
/help
/api-filedir.tokens
545 $(RM
) api-filedir.xml
546 mxmldoc
--section
"Programming" --title
"PPD API (DEPRECATED)" \
547 --css ..
/doc
/cups-printable.css \
548 --header api-ppd.header
--intro api-ppd.shtml \
550 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
551 ppd.c
>..
/doc
/help
/api-ppd.html
552 mxmldoc
--tokens help
/api-ppd.html api-ppd.xml
>..
/doc
/help
/api-ppd.tokens
554 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
555 --css ..
/doc
/cups-printable.css \
556 --header api-httpipp.header
--intro api-httpipp.shtml \
558 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
559 http.c http-addr.c http-support.c ipp.c ipp-support.c \
560 md5passwd.c request.c
>..
/doc
/help
/api-httpipp.html
561 mxmldoc
--tokens help
/api-httpipp.html api-httpipp.xml
>..
/doc
/help
/api-httpipp.tokens
562 $(RM
) api-httpipp.xml
563 mxmldoc
--section
"Programming" \
564 --title
"Filter and Backend Programming" \
565 --css ..
/doc
/cups-printable.css \
566 --header api-filter.header
--intro api-filter.shtml \
568 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
569 >..
/doc
/help
/api-filter.html
570 mxmldoc
--tokens help
/api-filter.html api-filter.xml
>..
/doc
/help
/api-filter.tokens
574 echo Generating CUPS API help files...
575 mxmldoc
--framed api-overview \
576 --section
"Programming" \
577 --title
"Introduction to CUPS Programming" \
578 --css ..
/doc
/cups-printable.css \
579 --header api-overview.header
--intro api-overview.shtml
580 mxmldoc
--framed api-array \
581 --section
"Programming" --title
"Array API" \
582 --css ..
/doc
/cups-printable.css \
583 --header api-array.header
--intro api-array.shtml \
585 mxmldoc
--framed api-cups \
586 --section
"Programming" --title
"CUPS API" \
587 --css ..
/doc
/cups-printable.css \
588 --header api-cups.header
--intro api-cups.shtml \
589 cups.h adminutil.c dest
*.c language.c notify.c \
590 options.c tempfile.c usersys.c \
592 mxmldoc
--framed api-filedir \
593 --section
"Programming" --title
"File and Directory APIs" \
594 --css ..
/doc
/cups-printable.css \
595 --header api-filedir.header
--intro api-filedir.shtml \
596 file.h file.c
dir.h
dir.c
597 mxmldoc
--framed api-ppd \
598 --section
"Programming" --title
"PPD API (DEPRECATED)" \
599 --css ..
/doc
/cups-printable.css \
600 --header api-ppd.header
--intro api-ppd.shtml \
601 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
603 mxmldoc
--framed api-httpipp \
604 --section
"Programming" --title
"HTTP and IPP APIs" \
605 --css ..
/doc
/cups-printable.css \
606 --header api-httpipp.header
--intro api-httpipp.shtml \
607 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
608 http.c http-addr.c http-support.c ipp.c ipp-support.c \
609 md5passwd.c request.c
610 mxmldoc
--framed api-filter \
611 --section
"Programming" \
612 --title
"Filter and Backend Programming" \
613 --css ..
/doc
/cups-printable.css \
614 --header api-filter.header
--intro api-filter.shtml \
615 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
619 # Lines of code computation...
623 echo
"libcupslite: \c"
624 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
626 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
634 http.o
: tls-darwin.c tls-gnutls.c tls-sspi.c