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.sl 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" -o
$(LIBCUPS
) = "libcups.sl.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_s.a
290 $(RM
) $(LIBDIR
)/libcups.sl
291 $(RM
) $(LIBDIR
)/libcups.sl
.2
292 $(RM
) $(LIBDIR
)/libcups.so
293 $(RM
) $(LIBDIR
)/libcups.so
.2
295 for file in
$(HEADERS
); do \
296 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
298 -$(RMDIR
) $(INCLUDEDIR
)/cups
302 # libcups.so.2, libcups.sl.2
305 libcups.so
.2 libcups.sl
.2: $(LIBOBJS
)
307 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
308 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
309 $(RM
) `basename $@ .2`
310 $(LN
) $@
`basename $@ .2`
317 libcups
.2.dylib
: $(LIBOBJS
) $(LIBCUPSORDER
)
318 echo Creating
export list for
$@...
319 nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}' | \
320 grep
-v
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
323 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
324 -install_name
$(libdir)/$@ \
325 -current_version
2.10.0 \
326 -compatibility_version
2.0.0 \
327 -exported_symbols_list t.exp \
328 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
329 $(COMMONLIBS
) $(LIBZ
)
330 $(RM
) libcups.dylib t.exp
331 $(LN
) $@ libcups.dylib
338 libcups_s.a
: $(LIBOBJS
) libcups_s.exp
340 $(DSO
) $(DSOFLAGS
) -Wl
,-bexport
:libcups_s.exp
-o libcups_s.o \
341 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
342 $(COMMONLIBS
) $(LIBZ
)
344 $(AR
) $(ARFLAGS
) $@ libcups_s.o
351 libcups.la
: $(LIBOBJS
)
353 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
354 -rpath
$(LIBDIR
) -version-info
2:10 $(LIBGSSAPI
) $(SSLLIBS
) \
355 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
362 libcups.a
: $(LIBOBJS
)
365 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
370 # testadmin (dependency on static CUPS library is intentional)
373 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
375 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
376 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
380 # testarray (dependency on static CUPS library is intentional)
383 testarray
: testarray.o
$(LIBCUPSSTATIC
)
385 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
386 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
387 echo Running array API tests...
392 # testconflicts (dependency on static CUPS library is intentional)
395 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
397 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
398 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
402 # testcups (dependency on static CUPS library is intentional)
405 testcups
: testcups.o
$(LIBCUPSSTATIC
)
407 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
408 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
412 # testfile (dependency on static CUPS library is intentional)
415 testfile
: testfile.o
$(LIBCUPSSTATIC
)
417 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
418 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
419 echo Running file API tests...
424 # testhttp (dependency on static CUPS library is intentional)
427 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
429 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
430 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
431 echo Running HTTP API tests...
436 # testipp (dependency on static CUPS library is intentional)
439 testipp
: testipp.o
$(LIBCUPSSTATIC
)
441 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
442 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
443 echo Running IPP API tests...
448 # testi18n (dependency on static CUPS library is intentional)
451 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
453 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
454 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
455 echo Running internationalization API tests...
460 # testlang (dependency on static CUPS library is intentional)
463 testlang
: testlang.o
$(LIBCUPSSTATIC
)
465 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
466 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
467 echo Running language API tests...
472 # testoptions (dependency on static CUPS library is intentional)
475 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
477 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
478 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
479 echo Running option API tests...
484 # testppd (dependency on static CUPS library is intentional)
487 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
489 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
490 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
491 echo Running PPD API tests...
496 # testpwg (dependency on static CUPS library is intentional)
499 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
501 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
502 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
503 echo Running PWG API tests...
508 # testsnmp (dependency on static CUPS library is intentional)
511 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
513 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
514 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
518 # Automatic API help files...
522 echo Generating CUPS API help files...
523 mxmldoc
--section
"Programming" \
524 --title
"Introduction to CUPS Programming" \
525 --css ..
/doc
/cups-printable.css \
526 --header api-overview.header
--intro api-overview.shtml \
527 >..
/doc
/help
/api-overview.html
528 mxmldoc
--section
"Programming" --title
"Array API" \
529 --css ..
/doc
/cups-printable.css \
530 --header api-array.header
--intro api-array.shtml \
532 array.h array.c
>..
/doc
/help
/api-array.html
533 mxmldoc
--tokens help
/api-array.html api-array.xml
>..
/doc
/help
/api-array.tokens
535 mxmldoc
--section
"Programming" --title
"CUPS API" \
536 --css ..
/doc
/cups-printable.css \
537 --header api-cups.header
--intro api-cups.shtml \
539 cups.h pwg.h adminutil.c dest
*.c language.c notify.c \
540 options.c pwg-media.c tempfile.c usersys.c \
541 util.c
>..
/doc
/help
/api-cups.html
542 mxmldoc
--tokens help
/api-cups.html api-cups.xml
>..
/doc
/help
/api-cups.tokens
544 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
545 --css ..
/doc
/cups-printable.css \
546 --header api-filedir.header
--intro api-filedir.shtml \
548 file.h file.c
dir.h
dir.c
>..
/doc
/help
/api-filedir.html
549 mxmldoc
--tokens api-filedir.xml
>..
/doc
/help
/api-filedir.tokens
550 $(RM
) api-filedir.xml
551 mxmldoc
--section
"Programming" --title
"PPD API (DEPRECATED)" \
552 --css ..
/doc
/cups-printable.css \
553 --header api-ppd.header
--intro api-ppd.shtml \
555 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
556 ppd.c
>..
/doc
/help
/api-ppd.html
557 mxmldoc
--tokens help
/api-ppd.html api-ppd.xml
>..
/doc
/help
/api-ppd.tokens
559 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
560 --css ..
/doc
/cups-printable.css \
561 --header api-httpipp.header
--intro api-httpipp.shtml \
563 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
564 http.c http-addr.c http-support.c ipp.c ipp-support.c \
565 md5passwd.c request.c
>..
/doc
/help
/api-httpipp.html
566 mxmldoc
--tokens help
/api-httpipp.html api-httpipp.xml
>..
/doc
/help
/api-httpipp.tokens
567 $(RM
) api-httpipp.xml
568 mxmldoc
--section
"Programming" \
569 --title
"Filter and Backend Programming" \
570 --css ..
/doc
/cups-printable.css \
571 --header api-filter.header
--intro api-filter.shtml \
573 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
574 >..
/doc
/help
/api-filter.html
575 mxmldoc
--tokens help
/api-filter.html api-filter.xml
>..
/doc
/help
/api-filter.tokens
579 echo Generating CUPS API help files...
580 mxmldoc
--framed api-overview \
581 --section
"Programming" \
582 --title
"Introduction to CUPS Programming" \
583 --css ..
/doc
/cups-printable.css \
584 --header api-overview.header
--intro api-overview.shtml
585 mxmldoc
--framed api-array \
586 --section
"Programming" --title
"Array API" \
587 --css ..
/doc
/cups-printable.css \
588 --header api-array.header
--intro api-array.shtml \
590 mxmldoc
--framed api-cups \
591 --section
"Programming" --title
"CUPS API" \
592 --css ..
/doc
/cups-printable.css \
593 --header api-cups.header
--intro api-cups.shtml \
594 cups.h adminutil.c dest
*.c language.c notify.c \
595 options.c tempfile.c usersys.c \
597 mxmldoc
--framed api-filedir \
598 --section
"Programming" --title
"File and Directory APIs" \
599 --css ..
/doc
/cups-printable.css \
600 --header api-filedir.header
--intro api-filedir.shtml \
601 file.h file.c
dir.h
dir.c
602 mxmldoc
--framed api-ppd \
603 --section
"Programming" --title
"PPD API (DEPRECATED)" \
604 --css ..
/doc
/cups-printable.css \
605 --header api-ppd.header
--intro api-ppd.shtml \
606 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
608 mxmldoc
--framed api-httpipp \
609 --section
"Programming" --title
"HTTP and IPP APIs" \
610 --css ..
/doc
/cups-printable.css \
611 --header api-httpipp.header
--intro api-httpipp.shtml \
612 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
613 http.c http-addr.c http-support.c ipp.c ipp-support.c \
614 md5passwd.c request.c
615 mxmldoc
--framed api-filter \
616 --section
"Programming" \
617 --title
"Filter and Backend Programming" \
618 --css ..
/doc
/cups-printable.css \
619 --header api-filter.header
--intro api-filter.shtml \
620 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
624 # Lines of code computation...
628 echo
"libcupslite: \c"
629 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
631 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'