2 # "$Id: Makefile 12032 2014-07-15 20:37:32Z msweet $"
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
=""
104 # Header files to install...
142 # Targets in this directory...
171 # Make all targets...
178 # Make library targets...
188 unittests
: $(UNITTARGETS
)
192 # Remove object and target files...
196 $(RM
) $(OBJS
) $(TARGETS
) $(UNITTARGETS
)
197 $(RM
) libcups.so libcups.dylib
201 # Update dependencies (without system header dependencies...)
205 $(CC
) -MM
$(ALL_CFLAGS
) $(OBJS
:.o
=.c
) >Dependencies
209 # Run oclint to check code coverage...
213 oclint
-o
=oclint.html
-html
$(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
217 # Install all targets...
220 install: all install-data install-headers install-libs install-exec
224 # Install data files...
231 # Install programs...
242 echo Installing header files into
$(INCLUDEDIR
)/cups...
243 $(INSTALL_DIR
) -m
755 $(INCLUDEDIR
)/cups
244 for file in
$(HEADERS
); do \
245 $(INSTALL_DATA
) $$file $(INCLUDEDIR
)/cups
; \
247 if
test "x$(privateinclude)" != x
; then \
248 echo Installing private header files into
$(PRIVATEINCLUDE
)...
; \
249 $(INSTALL_DIR
) -m
755 $(PRIVATEINCLUDE
); \
250 for file in
$(HEADERSPRIV
); do \
251 $(INSTALL_DATA
) $$file $(PRIVATEINCLUDE
)/$$file; \
257 # Install libraries...
260 install-libs
: $(INSTALLSTATIC
)
261 echo Installing libraries in
$(LIBDIR
)...
262 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
263 $(INSTALL_LIB
) $(LIBCUPS
) $(LIBDIR
)
264 if
test $(LIBCUPS
) = "libcups.so.2"; then \
265 $(RM
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
266 $(LN
) $(LIBCUPS
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
268 if
test $(LIBCUPS
) = "libcups.2.dylib"; then \
269 $(RM
) $(LIBDIR
)/libcups.dylib
; \
270 $(LN
) $(LIBCUPS
) $(LIBDIR
)/libcups.dylib
; \
272 if
test "x$(SYMROOT)" != "x"; then \
273 $(INSTALL_DIR
) $(SYMROOT
); \
274 cp
$(LIBCUPS
) $(SYMROOT
); \
275 dsymutil
$(SYMROOT
)/$(LIBCUPS
); \
279 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
280 $(INSTALL_LIB
) -m
755 $(LIBCUPSSTATIC
) $(LIBDIR
)
281 $(RANLIB
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
282 $(CHMOD
) 555 $(LIBDIR
)/$(LIBCUPSSTATIC
)
286 # Uninstall object and target files...
290 $(RM
) $(LIBDIR
)/libcups
.2.dylib
291 $(RM
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
292 $(RM
) $(LIBDIR
)/libcups.dylib
293 $(RM
) $(LIBDIR
)/libcups.so
294 $(RM
) $(LIBDIR
)/libcups.so
.2
296 for file in
$(HEADERS
); do \
297 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
299 -$(RMDIR
) $(INCLUDEDIR
)/cups
306 libcups.so
.2: $(LIBOBJS
)
308 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
309 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
310 $(RM
) `basename $@ .2`
311 $(LN
) $@
`basename $@ .2`
318 libcups
.2.dylib
: $(LIBOBJS
) $(LIBCUPSORDER
)
319 echo Creating
export list for
$@...
320 nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}' | \
321 grep
-v
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
324 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
325 -install_name
$(libdir)/$@ \
326 -current_version
2.11.0 \
327 -compatibility_version
2.0.0 \
328 -exported_symbols_list t.exp \
329 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
330 $(COMMONLIBS
) $(LIBZ
)
331 $(RM
) libcups.dylib t.exp
332 $(LN
) $@ libcups.dylib
339 libcups.la
: $(LIBOBJS
)
341 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
342 -rpath
$(LIBDIR
) -version-info
2:11 $(LIBGSSAPI
) $(SSLLIBS
) \
343 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
350 libcups.a
: $(LIBOBJS
)
353 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
358 # libcups2.def (Windows DLL exports file...)
361 libcups2.def
: $(LIBOBJS
) Makefile
362 echo Generating
$@...
363 echo
"LIBRARY libcups2" >libcups2.def
364 echo
"VERSION 2.11" >>libcups2.def
365 echo
"EXPORTS" >>libcups2.def
366 (nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}'; \
367 echo __cups_strcpy
; echo __cups_strlcat
; echo __cups_strlcpy
) | \
369 -e
'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel' \
371 sed
-e
'1,$$s/^_//' |
sort >>libcups2.def
375 # testadmin (dependency on static CUPS library is intentional)
378 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
380 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
381 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
385 # testarray (dependency on static CUPS library is intentional)
388 testarray
: testarray.o
$(LIBCUPSSTATIC
)
390 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
391 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
392 echo Running array API tests...
397 # testcache (dependency on static CUPS library is intentional)
400 testcache
: testcache.o
$(LIBCUPSSTATIC
)
402 $(CC
) $(LDFLAGS
) -o
$@ testcache.o
$(LIBCUPSSTATIC
) \
403 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
407 # testconflicts (dependency on static CUPS library is intentional)
410 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
412 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
413 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
417 # testcups (dependency on static CUPS library is intentional)
420 testcups
: testcups.o
$(LIBCUPSSTATIC
)
422 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
423 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
427 # testdest (dependency on static CUPS library is intentional)
430 testdest
: testdest.o
$(LIBCUPSSTATIC
)
432 $(CC
) $(LDFLAGS
) -o
$@ testdest.o
$(LIBCUPSSTATIC
) \
433 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
437 # testfile (dependency on static CUPS library is intentional)
440 testfile
: testfile.o
$(LIBCUPSSTATIC
)
442 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
443 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
444 echo Running file API tests...
449 # testhttp (dependency on static CUPS library is intentional)
452 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
454 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
455 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
456 echo Running HTTP API tests...
461 # testipp (dependency on static CUPS library is intentional)
464 testipp
: testipp.o
$(LIBCUPSSTATIC
)
466 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
467 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
468 echo Running IPP API tests...
473 # testi18n (dependency on static CUPS library is intentional)
476 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
478 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
479 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
480 echo Running internationalization API tests...
485 # testlang (dependency on static CUPS library is intentional)
488 testlang
: testlang.o
$(LIBCUPSSTATIC
)
490 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
491 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
492 echo Running language API tests...
497 # testoptions (dependency on static CUPS library is intentional)
500 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
502 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
503 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
504 echo Running option API tests...
509 # testppd (dependency on static CUPS library is intentional)
512 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
514 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
515 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
516 echo Running PPD API tests...
521 # testpwg (dependency on static CUPS library is intentional)
524 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
526 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
527 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
528 echo Running PWG API tests...
533 # testsnmp (dependency on static CUPS library is intentional)
536 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
538 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
539 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
543 # Automatic API help files...
547 echo Generating CUPS API help files...
548 mxmldoc
--section
"Programming" \
549 --title
"Introduction to CUPS Programming" \
550 --css ..
/doc
/cups-printable.css \
551 --header api-overview.header
--intro api-overview.shtml \
552 >..
/doc
/help
/api-overview.html
553 mxmldoc
--section
"Programming" --title
"Array API" \
554 --css ..
/doc
/cups-printable.css \
555 --header api-array.header
--intro api-array.shtml \
557 array.h array.c
>..
/doc
/help
/api-array.html
558 mxmldoc
--tokens help
/api-array.html api-array.xml
>..
/doc
/help
/api-array.tokens
560 mxmldoc
--section
"Programming" --title
"CUPS API" \
561 --css ..
/doc
/cups-printable.css \
562 --header api-cups.header
--intro api-cups.shtml \
564 cups.h pwg.h adminutil.c dest
*.c language.c notify.c \
565 options.c pwg-media.c tempfile.c usersys.c \
566 util.c
>..
/doc
/help
/api-cups.html
567 mxmldoc
--tokens help
/api-cups.html api-cups.xml
>..
/doc
/help
/api-cups.tokens
569 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
570 --css ..
/doc
/cups-printable.css \
571 --header api-filedir.header
--intro api-filedir.shtml \
573 file.h file.c
dir.h
dir.c
>..
/doc
/help
/api-filedir.html
574 mxmldoc
--tokens api-filedir.xml
>..
/doc
/help
/api-filedir.tokens
575 $(RM
) api-filedir.xml
576 mxmldoc
--section
"Programming" --title
"PPD API (DEPRECATED)" \
577 --css ..
/doc
/cups-printable.css \
578 --header api-ppd.header
--intro api-ppd.shtml \
580 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
581 ppd.c
>..
/doc
/help
/api-ppd.html
582 mxmldoc
--tokens help
/api-ppd.html api-ppd.xml
>..
/doc
/help
/api-ppd.tokens
584 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
585 --css ..
/doc
/cups-printable.css \
586 --header api-httpipp.header
--intro api-httpipp.shtml \
588 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
589 http.c http-addr.c http-support.c ipp.c ipp-support.c \
590 md5passwd.c request.c
>..
/doc
/help
/api-httpipp.html
591 mxmldoc
--tokens help
/api-httpipp.html api-httpipp.xml
>..
/doc
/help
/api-httpipp.tokens
592 $(RM
) api-httpipp.xml
593 mxmldoc
--section
"Programming" \
594 --title
"Filter and Backend Programming" \
595 --css ..
/doc
/cups-printable.css \
596 --header api-filter.header
--intro api-filter.shtml \
598 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
599 >..
/doc
/help
/api-filter.html
600 mxmldoc
--tokens help
/api-filter.html api-filter.xml
>..
/doc
/help
/api-filter.tokens
604 echo Generating CUPS API help files...
605 mxmldoc
--framed api-overview \
606 --section
"Programming" \
607 --title
"Introduction to CUPS Programming" \
608 --css ..
/doc
/cups-printable.css \
609 --header api-overview.header
--intro api-overview.shtml
610 mxmldoc
--framed api-array \
611 --section
"Programming" --title
"Array API" \
612 --css ..
/doc
/cups-printable.css \
613 --header api-array.header
--intro api-array.shtml \
615 mxmldoc
--framed api-cups \
616 --section
"Programming" --title
"CUPS API" \
617 --css ..
/doc
/cups-printable.css \
618 --header api-cups.header
--intro api-cups.shtml \
619 cups.h adminutil.c dest
*.c language.c notify.c \
620 options.c tempfile.c usersys.c \
622 mxmldoc
--framed api-filedir \
623 --section
"Programming" --title
"File and Directory APIs" \
624 --css ..
/doc
/cups-printable.css \
625 --header api-filedir.header
--intro api-filedir.shtml \
626 file.h file.c
dir.h
dir.c
627 mxmldoc
--framed api-ppd \
628 --section
"Programming" --title
"PPD API (DEPRECATED)" \
629 --css ..
/doc
/cups-printable.css \
630 --header api-ppd.header
--intro api-ppd.shtml \
631 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
633 mxmldoc
--framed api-httpipp \
634 --section
"Programming" --title
"HTTP and IPP APIs" \
635 --css ..
/doc
/cups-printable.css \
636 --header api-httpipp.header
--intro api-httpipp.shtml \
637 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
638 http.c http-addr.c http-support.c ipp.c ipp-support.c \
639 md5passwd.c request.c
640 mxmldoc
--framed api-filter \
641 --section
"Programming" \
642 --title
"Filter and Backend Programming" \
643 --css ..
/doc
/cups-printable.css \
644 --header api-filter.header
--intro api-filter.shtml \
645 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
649 # Lines of code computation...
653 echo
"libcupslite: \c"
654 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
656 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
664 tls.o
: tls-darwin.c tls-gnutls.c tls-sspi.c
668 # End of "$Id: Makefile 12032 2014-07-15 20:37:32Z msweet $".