2 # "$Id: Makefile 9979 2011-09-09 16:34:29Z 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...
129 # Targets in this directory...
158 # Make all targets...
165 # Make library targets...
175 unittests: $(UNITTARGETS)
179 # Remove object and target files...
183 $(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
184 $(RM) libcups.so libcups.sl libcups.dylib
189 # Update dependencies (without system header dependencies...)
193 touch Dependencies.tmp
194 makedepend -Y -I.. -fDependencies.tmp $(OBJS:.o=.c) >/dev/null 2>&1
196 cp Dependencies.tmp Dependencies
197 sed -E -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies
198 sed -E -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies
199 $(RM) Dependencies.tmp
203 # Install all targets...
206 install: all install-data install-headers install-libs install-exec
210 # Install data files...
217 # Install programs...
228 echo Installing header files into $(INCLUDEDIR)/cups...
229 $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
230 for file in $(HEADERS); do \
231 $(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \
233 if test "x$(privateinclude)" != x; then \
234 echo Installing private header files into $(PRIVATEINCLUDE)...; \
235 $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \
236 for file in $(HEADERSPRIV); do \
237 $(INSTALL_DATA) $$file $(PRIVATEINCLUDE)/$$file; \
243 # Install libraries...
246 install-libs: $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
247 echo Installing libraries in $(LIBDIR)...
248 $(INSTALL_DIR) -m 755 $(LIBDIR)
249 $(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
250 if test $(LIBCUPS) = "libcups.so.2" -o $(LIBCUPS) = "libcups.sl.2"; then \
251 $(RM) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
252 $(LN) $(LIBCUPS) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
254 if test $(LIBCUPS) = "libcups.2.dylib"; then \
255 $(RM) $(LIBDIR)/libcups.dylib; \
256 $(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \
258 if test "x$(SYMROOT)" != "x"; then \
259 $(INSTALL_DIR) $(SYMROOT); \
260 cp $(LIBCUPS) $(SYMROOT); \
264 $(INSTALL_DIR) -m 755 $(LIBDIR)
265 $(INSTALL_LIB) -m 755 $(LIBCUPSSTATIC) $(LIBDIR)
266 $(RANLIB) $(LIBDIR)/$(LIBCUPSSTATIC)
267 $(CHMOD) 555 $(LIBDIR)/$(LIBCUPSSTATIC)
270 echo Installing libraries in $(LIB32DIR)...
271 $(INSTALL_DIR) -m 755 $(LIB32DIR)
272 $(INSTALL_LIB) 32bit/libcups.so.2 $(LIB32DIR)/libcups.so.2
273 $(LN) libcups.so.2 $(LIB32DIR)/libcups.so
276 echo Installing libraries in $(LIB64DIR)...
277 $(INSTALL_DIR) -m 755 $(LIB64DIR)
278 $(INSTALL_LIB) 64bit/libcups.so.2 $(LIB64DIR)/libcups.so.2
279 $(LN) libcups.so.2 $(LIB64DIR)/libcups.so
283 # Uninstall object and target files...
286 uninstall: $(UNINSTALL32) $(UNINSTALL64)
287 $(RM) $(LIBDIR)/libcups.2.dylib
288 $(RM) $(LIBDIR)/$(LIBCUPSSTATIC)
289 $(RM) $(LIBDIR)/libcups.dylib
290 $(RM) $(LIBDIR)/libcups_s.a
291 $(RM) $(LIBDIR)/libcups.sl
292 $(RM) $(LIBDIR)/libcups.sl.2
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
302 $(RM) $(LIB32DIR)/libcups.so
303 $(RM) $(LIB32DIR)/libcups.so.2
304 -$(RMDIR) $(LIB32DIR)
307 $(RM) $(LIB64DIR)/libcups.so
308 $(RM) $(LIB64DIR)/libcups.so.2
309 -$(RMDIR) $(LIB64DIR)
313 # libcups.so.2, libcups.sl.2
316 libcups.so.2 libcups.sl.2: $(LIBOBJS)
318 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
319 $(SSLLIBS) $(DNSSDLIBS) -lpthread $(LIBZ) -lm
320 $(RM) `basename $@ .2`
321 $(LN) $@ `basename $@ .2`
328 32bit/libcups.so.2: $(LIB32OBJS)
329 echo Linking 32-bit $@...
331 $(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBGSSAPI) \
332 $(DNSSDLIBS) $(SSLLIBS) -lpthread $(LIBZ) -lm
333 $(RM) 32bit/libcups.so
334 $(LN) libcups.so.2 32bit/libcups.so
341 64bit/libcups.so.2: $(LIB64OBJS)
342 echo Linking 64-bit $@...
344 $(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBGSSAPI) \
345 $(DNSSDLIBS) $(SSLLIBS) -lpthread $(LIBZ) -lm
346 $(RM) 64bit/libcups.so
347 $(LN) libcups.so.2 64bit/libcups.so
354 libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
355 echo Creating export list for $@...
356 nm $(LIBOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}' | \
357 grep -v -e '^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
360 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
361 -install_name $(libdir)/$@ \
362 -current_version 2.9.0 \
363 -compatibility_version 2.0.0 \
364 -exported_symbols_list t.exp \
365 $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
366 -lpthread $(LIBZ) -lm
367 $(RM) libcups.dylib t.exp
368 $(LN) $@ libcups.dylib
375 libcups_s.a: $(LIBOBJS) libcups_s.exp
377 $(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o \
378 $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
379 -lpthread $(LIBZ) -lm
381 $(AR) $(ARFLAGS) $@ libcups_s.o
388 libcups.la: $(LIBOBJS)
390 $(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
391 -rpath $(LIBDIR) -version-info 2:9 $(LIBGSSAPI) $(SSLLIBS) \
392 $(DNSSDLIBS) -lpthread $(LIBZ) -lm
399 libcups.a: $(LIBOBJS)
402 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
407 # testadmin (dependency on static CUPS library is intentional)
410 testadmin: testadmin.o $(LIBCUPSSTATIC)
412 $(CC) $(LDFLAGS) -o $@ testadmin.o $(LIBCUPSSTATIC) \
413 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
417 # testarray (dependency on static CUPS library is intentional)
420 testarray: testarray.o $(LIBCUPSSTATIC)
422 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o $(LIBCUPSSTATIC) \
423 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
424 echo Running array API tests...
429 # testconflicts (dependency on static CUPS library is intentional)
432 testconflicts: testconflicts.o $(LIBCUPSSTATIC)
434 $(CC) $(LDFLAGS) -o $@ testconflicts.o $(LIBCUPSSTATIC) \
435 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
439 # testcups (dependency on static CUPS library is intentional)
442 testcups: testcups.o $(LIBCUPSSTATIC)
444 $(CC) $(LDFLAGS) -o $@ testcups.o $(LIBCUPSSTATIC) \
445 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
449 # testfile (dependency on static CUPS library is intentional)
452 testfile: testfile.o $(LIBCUPSSTATIC)
454 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o $(LIBCUPSSTATIC) \
455 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
456 echo Running file API tests...
461 # testhttp (dependency on static CUPS library is intentional)
464 testhttp: testhttp.o $(LIBCUPSSTATIC)
466 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o $(LIBCUPSSTATIC) \
467 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
468 echo Running HTTP API tests...
473 # testipp (dependency on static CUPS library is intentional)
476 testipp: testipp.o $(LIBCUPSSTATIC)
478 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o $(LIBCUPSSTATIC) \
479 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
480 echo Running IPP API tests...
485 # testi18n (dependency on static CUPS library is intentional)
488 testi18n: testi18n.o $(LIBCUPSSTATIC)
490 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o $(LIBCUPSSTATIC) \
491 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
492 echo Running internationalization API tests...
497 # testlang (dependency on static CUPS library is intentional)
500 testlang: testlang.o $(LIBCUPSSTATIC)
502 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o $(LIBCUPSSTATIC) \
503 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
504 echo Running language API tests...
509 # testoptions (dependency on static CUPS library is intentional)
512 testoptions: testoptions.o $(LIBCUPSSTATIC)
514 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o $(LIBCUPSSTATIC) \
515 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
516 echo Running option API tests...
521 # testppd (dependency on static CUPS library is intentional)
524 testppd: testppd.o $(LIBCUPSSTATIC) test.ppd test2.ppd
526 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o $(LIBCUPSSTATIC) \
527 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
528 echo Running PPD API tests...
533 # testpwg (dependency on static CUPS library is intentional)
536 testpwg: testpwg.o $(LIBCUPSSTATIC) test.ppd
538 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o $(LIBCUPSSTATIC) \
539 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
540 echo Running PWG API tests...
545 # testsnmp (dependency on static CUPS library is intentional)
548 testsnmp: testsnmp.o $(LIBCUPSSTATIC)
550 $(CC) $(LDFLAGS) -o $@ testsnmp.o $(LIBCUPSSTATIC) \
551 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
555 # Automatic API help files...
559 echo Generating CUPS API help files...
560 mxmldoc --section "Programming" \
561 --title "Introduction to CUPS Programming" \
562 --css ../doc/cups-printable.css \
563 --header api-overview.header --intro api-overview.shtml \
564 >../doc/help/api-overview.html
565 mxmldoc --section "Programming" --title "Array API" \
566 --css ../doc/cups-printable.css \
567 --header api-array.header --intro api-array.shtml \
569 array.h array.c >../doc/help/api-array.html
570 mxmldoc --tokens help/api-array.html api-array.xml >../doc/help/api-array.tokens
572 mxmldoc --section "Programming" --title "CUPS API" \
573 --css ../doc/cups-printable.css \
574 --header api-cups.header --intro api-cups.shtml \
576 cups.h adminutil.c dest.c language.c notify.c \
577 options.c tempfile.c usersys.c \
578 util.c >../doc/help/api-cups.html
579 mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
581 mxmldoc --section "Programming" --title "File and Directory APIs" \
582 --css ../doc/cups-printable.css \
583 --header api-filedir.header --intro api-filedir.shtml \
585 file.h file.c dir.h dir.c >../doc/help/api-filedir.html
586 mxmldoc --tokens api-filedir.xml >../doc/help/api-filedir.tokens
587 $(RM) api-filedir.xml
588 mxmldoc --section "Programming" --title "PPD API" \
589 --css ../doc/cups-printable.css \
590 --header api-ppd.header --intro api-ppd.shtml \
592 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
593 ppd.c >../doc/help/api-ppd.html
594 mxmldoc --tokens help/api-ppd.html api-ppd.xml >../doc/help/api-ppd.tokens
596 mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
597 --css ../doc/cups-printable.css \
598 --header api-httpipp.header --intro api-httpipp.shtml \
600 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
601 http.c http-addr.c http-support.c ipp.c ipp-support.c \
602 md5passwd.c request.c >../doc/help/api-httpipp.html
603 mxmldoc --tokens help/api-httpipp.html api-httpipp.xml >../doc/help/api-httpipp.tokens
604 $(RM) api-httpipp.xml
605 mxmldoc --section "Programming" \
606 --title "Filter and Backend Programming" \
607 --css ../doc/cups-printable.css \
608 --header api-filter.header --intro api-filter.shtml \
610 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
611 >../doc/help/api-filter.html
612 mxmldoc --tokens help/api-filter.html api-filter.xml >../doc/help/api-filter.tokens
616 echo Generating CUPS API help files...
617 mxmldoc --framed api-overview \
618 --section "Programming" \
619 --title "Introduction to CUPS Programming" \
620 --css ../doc/cups-printable.css \
621 --header api-overview.header --intro api-overview.shtml
622 mxmldoc --framed api-array \
623 --section "Programming" --title "Array API" \
624 --css ../doc/cups-printable.css \
625 --header api-array.header --intro api-array.shtml \
627 mxmldoc --framed api-cups \
628 --section "Programming" --title "CUPS API" \
629 --css ../doc/cups-printable.css \
630 --header api-cups.header --intro api-cups.shtml \
631 cups.h adminutil.c dest.c language.c notify.c \
632 options.c tempfile.c usersys.c \
634 mxmldoc --framed api-filedir \
635 --section "Programming" --title "File and Directory APIs" \
636 --css ../doc/cups-printable.css \
637 --header api-filedir.header --intro api-filedir.shtml \
638 file.h file.c dir.h dir.c
639 mxmldoc --framed api-ppd \
640 --section "Programming" --title "PPD API" \
641 --css ../doc/cups-printable.css \
642 --header api-ppd.header --intro api-ppd.shtml \
643 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
645 mxmldoc --framed api-httpipp \
646 --section "Programming" --title "HTTP and IPP APIs" \
647 --css ../doc/cups-printable.css \
648 --header api-httpipp.header --intro api-httpipp.shtml \
649 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
650 http.c http-addr.c http-support.c ipp.c ipp-support.c \
651 md5passwd.c request.c
652 mxmldoc --framed api-filter \
653 --section "Programming" \
654 --title "Filter and Backend Programming" \
655 --css ../doc/cups-printable.css \
656 --header api-filter.header --intro api-filter.shtml \
657 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
661 # Lines of code computation...
665 echo "libcupslite: \c"
666 sloccount $(LITEOBJS:.o=.c) 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
668 sloccount $(LIBOBJS:.o=.c) 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
679 # End of "$Id: Makefile 9979 2011-09-09 16:34:29Z mike $".