4 # API library Makefile for CUPS.
6 # Copyright 2007-2013 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...
167 # Make all targets...
174 # Make library targets...
184 unittests
: $(UNITTARGETS
)
188 # Remove object and target files...
192 $(RM
) $(OBJS
) $(TARGETS
) $(UNITTARGETS
)
193 $(RM
) libcups.so libcups.dylib
197 # Update dependencies (without system header dependencies...)
201 $(CC
) -MM
$(ALL_CFLAGS
) $(OBJS
:.o
=.c
) >Dependencies
205 # Run oclint to check code coverage...
209 oclint
-o
=oclint.html
-html
$(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
213 # Install all targets...
216 install: all install-data install-headers install-libs install-exec
220 # Install data files...
227 # Install programs...
238 echo Installing header files into
$(INCLUDEDIR
)/cups...
239 $(INSTALL_DIR
) -m
755 $(INCLUDEDIR
)/cups
240 for file in
$(HEADERS
); do \
241 $(INSTALL_DATA
) $$file $(INCLUDEDIR
)/cups
; \
243 if
test "x$(privateinclude)" != x
; then \
244 echo Installing private header files into
$(PRIVATEINCLUDE
)...
; \
245 $(INSTALL_DIR
) -m
755 $(PRIVATEINCLUDE
); \
246 for file in
$(HEADERSPRIV
); do \
247 $(INSTALL_DATA
) $$file $(PRIVATEINCLUDE
)/$$file; \
253 # Install libraries...
256 install-libs
: $(INSTALLSTATIC
)
257 echo Installing libraries in
$(LIBDIR
)...
258 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
259 $(INSTALL_LIB
) $(LIBCUPS
) $(LIBDIR
)
260 if
test $(LIBCUPS
) = "libcups.so.2"; then \
261 $(RM
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
262 $(LN
) $(LIBCUPS
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
264 if
test $(LIBCUPS
) = "libcups.2.dylib"; then \
265 $(RM
) $(LIBDIR
)/libcups.dylib
; \
266 $(LN
) $(LIBCUPS
) $(LIBDIR
)/libcups.dylib
; \
268 if
test "x$(SYMROOT)" != "x"; then \
269 $(INSTALL_DIR
) $(SYMROOT
); \
270 cp
$(LIBCUPS
) $(SYMROOT
); \
271 dsymutil
$(SYMROOT
)/$(LIBCUPS
); \
275 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
276 $(INSTALL_LIB
) -m
755 $(LIBCUPSSTATIC
) $(LIBDIR
)
277 $(RANLIB
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
278 $(CHMOD
) 555 $(LIBDIR
)/$(LIBCUPSSTATIC
)
282 # Uninstall object and target files...
286 $(RM
) $(LIBDIR
)/libcups
.2.dylib
287 $(RM
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
288 $(RM
) $(LIBDIR
)/libcups.dylib
289 $(RM
) $(LIBDIR
)/libcups.so
290 $(RM
) $(LIBDIR
)/libcups.so
.2
292 for file in
$(HEADERS
); do \
293 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
295 -$(RMDIR
) $(INCLUDEDIR
)/cups
302 libcups.so
.2: $(LIBOBJS
)
304 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
305 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
306 $(RM
) `basename $@ .2`
307 $(LN
) $@
`basename $@ .2`
314 libcups
.2.dylib
: $(LIBOBJS
) $(LIBCUPSORDER
)
315 echo Creating
export list for
$@...
316 nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}' | \
317 grep
-v
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
320 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
321 -install_name
$(libdir)/$@ \
322 -current_version
2.10.0 \
323 -compatibility_version
2.0.0 \
324 -exported_symbols_list t.exp \
325 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
326 $(COMMONLIBS
) $(LIBZ
)
327 $(RM
) libcups.dylib t.exp
328 $(LN
) $@ libcups.dylib
335 libcups.la
: $(LIBOBJS
)
337 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
338 -rpath
$(LIBDIR
) -version-info
2:10 $(LIBGSSAPI
) $(SSLLIBS
) \
339 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
346 libcups.a
: $(LIBOBJS
)
349 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
354 # testadmin (dependency on static CUPS library is intentional)
357 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
359 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
360 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
364 # testarray (dependency on static CUPS library is intentional)
367 testarray
: testarray.o
$(LIBCUPSSTATIC
)
369 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
370 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
371 echo Running array API tests...
376 # testconflicts (dependency on static CUPS library is intentional)
379 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
381 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
382 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
386 # testcups (dependency on static CUPS library is intentional)
389 testcups
: testcups.o
$(LIBCUPSSTATIC
)
391 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
392 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
396 # testfile (dependency on static CUPS library is intentional)
399 testfile
: testfile.o
$(LIBCUPSSTATIC
)
401 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
402 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
403 echo Running file API tests...
408 # testhttp (dependency on static CUPS library is intentional)
411 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
413 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
414 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
415 echo Running HTTP API tests...
420 # testipp (dependency on static CUPS library is intentional)
423 testipp
: testipp.o
$(LIBCUPSSTATIC
)
425 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
426 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
427 echo Running IPP API tests...
432 # testi18n (dependency on static CUPS library is intentional)
435 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
437 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
438 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
439 echo Running internationalization API tests...
444 # testlang (dependency on static CUPS library is intentional)
447 testlang
: testlang.o
$(LIBCUPSSTATIC
)
449 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
450 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
451 echo Running language API tests...
456 # testoptions (dependency on static CUPS library is intentional)
459 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
461 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
462 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
463 echo Running option API tests...
468 # testppd (dependency on static CUPS library is intentional)
471 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
473 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
474 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
475 echo Running PPD API tests...
480 # testpwg (dependency on static CUPS library is intentional)
483 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
485 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
486 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
487 echo Running PWG API tests...
492 # testsnmp (dependency on static CUPS library is intentional)
495 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
497 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
498 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
502 # Automatic API help files...
506 echo Generating CUPS API help files...
507 mxmldoc
--section
"Programming" \
508 --title
"Introduction to CUPS Programming" \
509 --css ..
/doc
/cups-printable.css \
510 --header api-overview.header
--intro api-overview.shtml \
511 >..
/doc
/help
/api-overview.html
512 mxmldoc
--section
"Programming" --title
"Array API" \
513 --css ..
/doc
/cups-printable.css \
514 --header api-array.header
--intro api-array.shtml \
516 array.h array.c
>..
/doc
/help
/api-array.html
517 mxmldoc
--tokens help
/api-array.html api-array.xml
>..
/doc
/help
/api-array.tokens
519 mxmldoc
--section
"Programming" --title
"CUPS API" \
520 --css ..
/doc
/cups-printable.css \
521 --header api-cups.header
--intro api-cups.shtml \
523 cups.h pwg.h adminutil.c dest
*.c language.c notify.c \
524 options.c pwg-media.c tempfile.c usersys.c \
525 util.c
>..
/doc
/help
/api-cups.html
526 mxmldoc
--tokens help
/api-cups.html api-cups.xml
>..
/doc
/help
/api-cups.tokens
528 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
529 --css ..
/doc
/cups-printable.css \
530 --header api-filedir.header
--intro api-filedir.shtml \
532 file.h file.c
dir.h
dir.c
>..
/doc
/help
/api-filedir.html
533 mxmldoc
--tokens api-filedir.xml
>..
/doc
/help
/api-filedir.tokens
534 $(RM
) api-filedir.xml
535 mxmldoc
--section
"Programming" --title
"PPD API (DEPRECATED)" \
536 --css ..
/doc
/cups-printable.css \
537 --header api-ppd.header
--intro api-ppd.shtml \
539 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
540 ppd.c
>..
/doc
/help
/api-ppd.html
541 mxmldoc
--tokens help
/api-ppd.html api-ppd.xml
>..
/doc
/help
/api-ppd.tokens
543 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
544 --css ..
/doc
/cups-printable.css \
545 --header api-httpipp.header
--intro api-httpipp.shtml \
547 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
548 http.c http-addr.c http-support.c ipp.c ipp-support.c \
549 md5passwd.c request.c
>..
/doc
/help
/api-httpipp.html
550 mxmldoc
--tokens help
/api-httpipp.html api-httpipp.xml
>..
/doc
/help
/api-httpipp.tokens
551 $(RM
) api-httpipp.xml
552 mxmldoc
--section
"Programming" \
553 --title
"Filter and Backend Programming" \
554 --css ..
/doc
/cups-printable.css \
555 --header api-filter.header
--intro api-filter.shtml \
557 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
558 >..
/doc
/help
/api-filter.html
559 mxmldoc
--tokens help
/api-filter.html api-filter.xml
>..
/doc
/help
/api-filter.tokens
563 echo Generating CUPS API help files...
564 mxmldoc
--framed api-overview \
565 --section
"Programming" \
566 --title
"Introduction to CUPS Programming" \
567 --css ..
/doc
/cups-printable.css \
568 --header api-overview.header
--intro api-overview.shtml
569 mxmldoc
--framed api-array \
570 --section
"Programming" --title
"Array API" \
571 --css ..
/doc
/cups-printable.css \
572 --header api-array.header
--intro api-array.shtml \
574 mxmldoc
--framed api-cups \
575 --section
"Programming" --title
"CUPS API" \
576 --css ..
/doc
/cups-printable.css \
577 --header api-cups.header
--intro api-cups.shtml \
578 cups.h adminutil.c dest
*.c language.c notify.c \
579 options.c tempfile.c usersys.c \
581 mxmldoc
--framed api-filedir \
582 --section
"Programming" --title
"File and Directory APIs" \
583 --css ..
/doc
/cups-printable.css \
584 --header api-filedir.header
--intro api-filedir.shtml \
585 file.h file.c
dir.h
dir.c
586 mxmldoc
--framed api-ppd \
587 --section
"Programming" --title
"PPD API (DEPRECATED)" \
588 --css ..
/doc
/cups-printable.css \
589 --header api-ppd.header
--intro api-ppd.shtml \
590 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
592 mxmldoc
--framed api-httpipp \
593 --section
"Programming" --title
"HTTP and IPP APIs" \
594 --css ..
/doc
/cups-printable.css \
595 --header api-httpipp.header
--intro api-httpipp.shtml \
596 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
597 http.c http-addr.c http-support.c ipp.c ipp-support.c \
598 md5passwd.c request.c
599 mxmldoc
--framed api-filter \
600 --section
"Programming" \
601 --title
"Filter and Backend Programming" \
602 --css ..
/doc
/cups-printable.css \
603 --header api-filter.header
--intro api-filter.shtml \
604 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
608 # Lines of code computation...
612 echo
"libcupslite: \c"
613 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
615 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
623 http.o
: tls-darwin.c tls-gnutls.c tls-sspi.c