2 # "$Id: Makefile 7871 2008-08-27 21:12:43Z mike $"
4 # API library Makefile for CUPS.
6 # Copyright 2007-2011 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.
71 LIB32OBJS
= $(LIBOBJS
:.o
=.32.o
)
72 LIB64OBJS
= $(LIBOBJS
:.o
=.64.o
)
93 # Header files to install...
130 # Targets in this directory...
159 # Make all targets...
166 # Make library targets...
176 unittests
: $(UNITTARGETS
)
180 # Remove object and target files...
184 $(RM
) $(OBJS
) $(TARGETS
) $(UNITTARGETS
)
185 $(RM
) libcups.so libcups.sl libcups.dylib
190 # Update dependencies (without system header dependencies...)
194 touch Dependencies.tmp
195 makedepend
-Y
-I..
-fDependencies.tmp
$(OBJS
:.o
=.c
) >/dev
/null
2>&1
197 cp Dependencies.tmp Dependencies
198 sed
-E
-e
'1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp
>>Dependencies
199 sed
-E
-e
'1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp
>>Dependencies
200 $(RM
) Dependencies.tmp
204 # Install all targets...
207 install: all install-data install-headers install-libs install-exec
211 # Install data files...
218 # Install programs...
229 echo Installing header files into
$(INCLUDEDIR
)/cups...
230 $(INSTALL_DIR
) -m
755 $(INCLUDEDIR
)/cups
231 for file in
$(HEADERS
); do \
232 $(INSTALL_DATA
) $$file $(INCLUDEDIR
)/cups
; \
234 if
test "x$(privateinclude)" != x
; then \
235 echo Installing private header files into
$(PRIVATEINCLUDE
)...
; \
236 $(INSTALL_DIR
) -m
755 $(PRIVATEINCLUDE
); \
237 for file in
$(HEADERSPRIV
); do \
238 $(INSTALL_DATA
) $$file $(PRIVATEINCLUDE
)/$$file; \
244 # Install libraries...
247 install-libs
: $(INSTALLSTATIC
) $(INSTALL32
) $(INSTALL64
)
248 echo Installing libraries in
$(LIBDIR
)...
249 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
250 $(INSTALL_LIB
) $(LIBCUPS
) $(LIBDIR
)
251 if
test $(LIBCUPS
) = "libcups.so.2" -o
$(LIBCUPS
) = "libcups.sl.2"; then \
252 $(RM
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
253 $(LN
) $(LIBCUPS
) $(LIBDIR
)/`basename $(LIBCUPS) .2`; \
255 if
test $(LIBCUPS
) = "libcups.2.dylib"; then \
256 $(RM
) $(LIBDIR
)/libcups.dylib
; \
257 $(LN
) $(LIBCUPS
) $(LIBDIR
)/libcups.dylib
; \
259 if
test "x$(SYMROOT)" != "x"; then \
260 $(INSTALL_DIR
) $(SYMROOT
); \
261 cp
$(LIBCUPS
) $(SYMROOT
); \
265 $(INSTALL_DIR
) -m
755 $(LIBDIR
)
266 $(INSTALL_LIB
) -m
755 $(LIBCUPSSTATIC
) $(LIBDIR
)
267 $(RANLIB
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
268 $(CHMOD
) 555 $(LIBDIR
)/$(LIBCUPSSTATIC
)
271 echo Installing libraries in
$(LIB32DIR
)...
272 $(INSTALL_DIR
) -m
755 $(LIB32DIR
)
273 $(INSTALL_LIB
) 32bit
/libcups.so
.2 $(LIB32DIR
)/libcups.so
.2
274 $(LN
) libcups.so
.2 $(LIB32DIR
)/libcups.so
277 echo Installing libraries in
$(LIB64DIR
)...
278 $(INSTALL_DIR
) -m
755 $(LIB64DIR
)
279 $(INSTALL_LIB
) 64bit
/libcups.so
.2 $(LIB64DIR
)/libcups.so
.2
280 $(LN
) libcups.so
.2 $(LIB64DIR
)/libcups.so
284 # Uninstall object and target files...
287 uninstall: $(UNINSTALL32
) $(UNINSTALL64
)
288 $(RM
) $(LIBDIR
)/libcups
.2.dylib
289 $(RM
) $(LIBDIR
)/$(LIBCUPSSTATIC
)
290 $(RM
) $(LIBDIR
)/libcups.dylib
291 $(RM
) $(LIBDIR
)/libcups_s.a
292 $(RM
) $(LIBDIR
)/libcups.sl
293 $(RM
) $(LIBDIR
)/libcups.sl
.2
294 $(RM
) $(LIBDIR
)/libcups.so
295 $(RM
) $(LIBDIR
)/libcups.so
.2
297 for file in
$(HEADERS
); do \
298 $(RM
) $(INCLUDEDIR
)/cups
/$$file; \
300 -$(RMDIR
) $(INCLUDEDIR
)/cups
303 $(RM
) $(LIB32DIR
)/libcups.so
304 $(RM
) $(LIB32DIR
)/libcups.so
.2
305 -$(RMDIR
) $(LIB32DIR
)
308 $(RM
) $(LIB64DIR
)/libcups.so
309 $(RM
) $(LIB64DIR
)/libcups.so
.2
310 -$(RMDIR
) $(LIB64DIR
)
314 # libcups.so.2, libcups.sl.2
317 libcups.so
.2 libcups.sl
.2: $(LIBOBJS
)
319 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBGSSAPI
) \
320 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
321 $(RM
) `basename $@ .2`
322 $(LN
) $@
`basename $@ .2`
329 32bit
/libcups.so
.2: $(LIB32OBJS
)
330 echo Linking
32-bit
$@...
332 $(DSO
) $(ARCH32FLAGS
) $(DSO32FLAGS
) -o
$@
$(LIB32OBJS
) $(LIBGSSAPI
) \
333 $(DNSSDLIBS
) $(SSLLIBS
) $(COMMONLIBS
) $(LIBZ
)
334 $(RM
) 32bit
/libcups.so
335 $(LN
) libcups.so
.2 32bit
/libcups.so
342 64bit
/libcups.so
.2: $(LIB64OBJS
)
343 echo Linking
64-bit
$@...
345 $(DSO
) $(ARCH64FLAGS
) $(DSO64FLAGS
) -o
$@
$(LIB64OBJS
) $(LIBGSSAPI
) \
346 $(DNSSDLIBS
) $(SSLLIBS
) $(COMMONLIBS
) $(LIBZ
)
347 $(RM
) 64bit
/libcups.so
348 $(LN
) libcups.so
.2 64bit
/libcups.so
355 libcups
.2.dylib
: $(LIBOBJS
) $(LIBCUPSORDER
)
356 echo Creating
export list for
$@...
357 nm
$(LIBOBJS
) 2>/dev
/null | grep
"T _" | awk
'{print $$3}' | \
358 grep
-v
-e
'^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
361 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@ \
362 -install_name
$(libdir)/$@ \
363 -current_version
2.9.0 \
364 -compatibility_version
2.0.0 \
365 -exported_symbols_list t.exp \
366 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
367 $(COMMONLIBS
) $(LIBZ
)
368 $(RM
) libcups.dylib t.exp
369 $(LN
) $@ libcups.dylib
376 libcups_s.a
: $(LIBOBJS
) libcups_s.exp
378 $(DSO
) $(DSOFLAGS
) -Wl
,-bexport
:libcups_s.exp
-o libcups_s.o \
379 $(LIBOBJS
) $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) \
380 $(COMMONLIBS
) $(LIBZ
)
382 $(AR
) $(ARFLAGS
) $@ libcups_s.o
389 libcups.la
: $(LIBOBJS
)
391 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) \
392 -rpath
$(LIBDIR
) -version-info
2:9 $(LIBGSSAPI
) $(SSLLIBS
) \
393 $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
400 libcups.a
: $(LIBOBJS
)
403 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
408 # testadmin (dependency on static CUPS library is intentional)
411 testadmin
: testadmin.o
$(LIBCUPSSTATIC
)
413 $(CC
) $(LDFLAGS
) -o
$@ testadmin.o
$(LIBCUPSSTATIC
) \
414 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
418 # testarray (dependency on static CUPS library is intentional)
421 testarray
: testarray.o
$(LIBCUPSSTATIC
)
423 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testarray.o
$(LIBCUPSSTATIC
) \
424 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
425 echo Running array API tests...
430 # testconflicts (dependency on static CUPS library is intentional)
433 testconflicts
: testconflicts.o
$(LIBCUPSSTATIC
)
435 $(CC
) $(LDFLAGS
) -o
$@ testconflicts.o
$(LIBCUPSSTATIC
) \
436 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
440 # testcups (dependency on static CUPS library is intentional)
443 testcups
: testcups.o
$(LIBCUPSSTATIC
)
445 $(CC
) $(LDFLAGS
) -o
$@ testcups.o
$(LIBCUPSSTATIC
) \
446 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
450 # testfile (dependency on static CUPS library is intentional)
453 testfile
: testfile.o
$(LIBCUPSSTATIC
)
455 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testfile.o
$(LIBCUPSSTATIC
) \
456 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
457 echo Running file API tests...
462 # testhttp (dependency on static CUPS library is intentional)
465 testhttp
: testhttp.o
$(LIBCUPSSTATIC
)
467 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testhttp.o
$(LIBCUPSSTATIC
) \
468 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
469 echo Running HTTP API tests...
474 # testipp (dependency on static CUPS library is intentional)
477 testipp
: testipp.o
$(LIBCUPSSTATIC
)
479 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testipp.o
$(LIBCUPSSTATIC
) \
480 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
481 echo Running IPP API tests...
486 # testi18n (dependency on static CUPS library is intentional)
489 testi18n
: testi18n.o
$(LIBCUPSSTATIC
)
491 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testi18n.o
$(LIBCUPSSTATIC
) \
492 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
493 echo Running internationalization API tests...
498 # testlang (dependency on static CUPS library is intentional)
501 testlang
: testlang.o
$(LIBCUPSSTATIC
)
503 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testlang.o
$(LIBCUPSSTATIC
) \
504 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
505 echo Running language API tests...
510 # testoptions (dependency on static CUPS library is intentional)
513 testoptions
: testoptions.o
$(LIBCUPSSTATIC
)
515 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testoptions.o
$(LIBCUPSSTATIC
) \
516 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
517 echo Running option API tests...
522 # testppd (dependency on static CUPS library is intentional)
525 testppd
: testppd.o
$(LIBCUPSSTATIC
) test.ppd test2.ppd
527 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testppd.o
$(LIBCUPSSTATIC
) \
528 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
529 echo Running PPD API tests...
534 # testpwg (dependency on static CUPS library is intentional)
537 testpwg
: testpwg.o
$(LIBCUPSSTATIC
) test.ppd
539 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testpwg.o
$(LIBCUPSSTATIC
) \
540 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
541 echo Running PWG API tests...
546 # testsnmp (dependency on static CUPS library is intentional)
549 testsnmp
: testsnmp.o
$(LIBCUPSSTATIC
)
551 $(CC
) $(LDFLAGS
) -o
$@ testsnmp.o
$(LIBCUPSSTATIC
) \
552 $(LIBGSSAPI
) $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
)
556 # Automatic API help files...
560 echo Generating CUPS API help files...
561 mxmldoc
--section
"Programming" \
562 --title
"Introduction to CUPS Programming" \
563 --css ..
/doc
/cups-printable.css \
564 --header api-overview.header
--intro api-overview.shtml \
565 >..
/doc
/help
/api-overview.html
566 mxmldoc
--section
"Programming" --title
"Array API" \
567 --css ..
/doc
/cups-printable.css \
568 --header api-array.header
--intro api-array.shtml \
570 array.h array.c
>..
/doc
/help
/api-array.html
571 mxmldoc
--tokens help
/api-array.html api-array.xml
>..
/doc
/help
/api-array.tokens
573 mxmldoc
--section
"Programming" --title
"CUPS API" \
574 --css ..
/doc
/cups-printable.css \
575 --header api-cups.header
--intro api-cups.shtml \
577 cups.h adminutil.c dest.c language.c notify.c \
578 options.c tempfile.c usersys.c \
579 util.c
>..
/doc
/help
/api-cups.html
580 mxmldoc
--tokens help
/api-cups.html api-cups.xml
>..
/doc
/help
/api-cups.tokens
582 mxmldoc
--section
"Programming" --title
"File and Directory APIs" \
583 --css ..
/doc
/cups-printable.css \
584 --header api-filedir.header
--intro api-filedir.shtml \
586 file.h file.c
dir.h
dir.c
>..
/doc
/help
/api-filedir.html
587 mxmldoc
--tokens api-filedir.xml
>..
/doc
/help
/api-filedir.tokens
588 $(RM
) api-filedir.xml
589 mxmldoc
--section
"Programming" --title
"PPD API" \
590 --css ..
/doc
/cups-printable.css \
591 --header api-ppd.header
--intro api-ppd.shtml \
593 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
594 ppd.c
>..
/doc
/help
/api-ppd.html
595 mxmldoc
--tokens help
/api-ppd.html api-ppd.xml
>..
/doc
/help
/api-ppd.tokens
597 mxmldoc
--section
"Programming" --title
"HTTP and IPP APIs" \
598 --css ..
/doc
/cups-printable.css \
599 --header api-httpipp.header
--intro api-httpipp.shtml \
601 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
602 http.c http-addr.c http-support.c ipp.c ipp-support.c \
603 md5passwd.c request.c
>..
/doc
/help
/api-httpipp.html
604 mxmldoc
--tokens help
/api-httpipp.html api-httpipp.xml
>..
/doc
/help
/api-httpipp.tokens
605 $(RM
) api-httpipp.xml
606 mxmldoc
--section
"Programming" \
607 --title
"Filter and Backend Programming" \
608 --css ..
/doc
/cups-printable.css \
609 --header api-filter.header
--intro api-filter.shtml \
611 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
612 >..
/doc
/help
/api-filter.html
613 mxmldoc
--tokens help
/api-filter.html api-filter.xml
>..
/doc
/help
/api-filter.tokens
617 echo Generating CUPS API help files...
618 mxmldoc
--framed api-overview \
619 --section
"Programming" \
620 --title
"Introduction to CUPS Programming" \
621 --css ..
/doc
/cups-printable.css \
622 --header api-overview.header
--intro api-overview.shtml
623 mxmldoc
--framed api-array \
624 --section
"Programming" --title
"Array API" \
625 --css ..
/doc
/cups-printable.css \
626 --header api-array.header
--intro api-array.shtml \
628 mxmldoc
--framed api-cups \
629 --section
"Programming" --title
"CUPS API" \
630 --css ..
/doc
/cups-printable.css \
631 --header api-cups.header
--intro api-cups.shtml \
632 cups.h adminutil.c dest.c language.c notify.c \
633 options.c tempfile.c usersys.c \
635 mxmldoc
--framed api-filedir \
636 --section
"Programming" --title
"File and Directory APIs" \
637 --css ..
/doc
/cups-printable.css \
638 --header api-filedir.header
--intro api-filedir.shtml \
639 file.h file.c
dir.h
dir.c
640 mxmldoc
--framed api-ppd \
641 --section
"Programming" --title
"PPD API" \
642 --css ..
/doc
/cups-printable.css \
643 --header api-ppd.header
--intro api-ppd.shtml \
644 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
646 mxmldoc
--framed api-httpipp \
647 --section
"Programming" --title
"HTTP and IPP APIs" \
648 --css ..
/doc
/cups-printable.css \
649 --header api-httpipp.header
--intro api-httpipp.shtml \
650 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
651 http.c http-addr.c http-support.c ipp.c ipp-support.c \
652 md5passwd.c request.c
653 mxmldoc
--framed api-filter \
654 --section
"Programming" \
655 --title
"Filter and Backend Programming" \
656 --css ..
/doc
/cups-printable.css \
657 --header api-filter.header
--intro api-filter.shtml \
658 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
662 # Lines of code computation...
666 echo
"libcupslite: \c"
667 sloccount
$(LITEOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
669 sloccount
$(LIBOBJS
:.o
=.c
) 2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'
680 # End of "$Id: Makefile 7871 2008-08-27 21:12:43Z mike $".