Update changelog
[platform/upstream/cups.git] / cups / Makefile
1 #
2 # "$Id: Makefile 11173 2013-07-23 12:31:34Z msweet $"
3 #
4 #   API library Makefile for CUPS.
5 #
6 #   Copyright 2007-2012 by Apple Inc.
7 #   Copyright 1997-2006 by Easy Software Products, all rights reserved.
8 #
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/".
14 #
15 #   This file is subject to the Apple OS-Developed Software exception.
16 #
17
18 include ../Makedefs
19
20 #
21 # Object files...
22 #
23
24 LIBOBJS =       \
25                 adminutil.o \
26                 array.o \
27                 attr.o \
28                 auth.o \
29                 backchannel.o \
30                 backend.o \
31                 conflicts.o \
32                 custom.o \
33                 debug.o \
34                 dest.o \
35                 dest-job.o \
36                 dest-localization.o \
37                 dest-options.o \
38                 dir.o \
39                 emit.o \
40                 encode.o \
41                 file.o \
42                 getdevices.o \
43                 getifaddrs.o \
44                 getputfile.o \
45                 globals.o \
46                 http.o \
47                 http-addr.o \
48                 http-addrlist.o \
49                 http-support.o \
50                 ipp.o \
51                 ipp-support.o \
52                 langprintf.o \
53                 language.o \
54                 localize.o \
55                 mark.o \
56                 md5.o \
57                 md5passwd.o \
58                 notify.o \
59                 options.o \
60                 page.o \
61                 ppd.o \
62                 ppd-cache.o \
63                 pwg-media.o \
64                 request.o \
65                 sidechannel.o \
66                 snmp.o \
67                 snprintf.o \
68                 string.o \
69                 tempfile.o \
70                 thread.o \
71                 transcode.o \
72                 usersys.o \
73                 util.o
74 TESTOBJS        = \
75                 testadmin.o \
76                 testarray.o \
77                 testconflicts.o \
78                 testcups.o \
79                 testfile.o \
80                 testhttp.o \
81                 testi18n.o \
82                 testipp.o \
83                 testoptions.o \
84                 testlang.o \
85                 testppd.o \
86                 testpwg.o \
87                 testsnmp.o
88 OBJS    =       \
89                 $(LIBOBJS) \
90                 $(TESTOBJS)
91
92
93 #
94 # Header files to install...
95 #
96
97 HEADERS =       \
98                 adminutil.h \
99                 array.h \
100                 backend.h \
101                 cups.h \
102                 dir.h \
103                 file.h \
104                 http.h \
105                 ipp.h \
106                 language.h \
107                 ppd.h \
108                 raster.h \
109                 sidechannel.h \
110                 transcode.h \
111                 versioning.h
112
113 HEADERSPRIV =   \
114                 array-private.h \
115                 cups-private.h \
116                 debug-private.h \
117                 file-private.h \
118                 http-private.h \
119                 ipp-private.h \
120                 language-private.h \
121                 md5-private.h \
122                 ppd-private.h \
123                 pwg-private.h \
124                 raster-private.h \
125                 snmp-private.h \
126                 string-private.h \
127                 thread-private.h
128
129
130 #
131 # Targets in this directory...
132 #
133
134 LIBTARGETS =    \
135                 $(LIBCUPSSTATIC) \
136                 $(LIBCUPS)
137
138 UNITTARGETS =   \
139                 testadmin \
140                 testarray \
141                 testconflicts \
142                 testcups \
143                 testfile \
144                 testhttp \
145                 testi18n \
146                 testipp \
147                 testlang \
148                 testoptions \
149                 testppd \
150                 testpwg \
151                 testsnmp
152
153 TARGETS =       \
154                 $(LIBTARGETS)
155
156
157 #
158 # Make all targets...
159 #
160
161 all:            $(TARGETS)
162
163
164 #
165 # Make library targets...
166 #
167
168 libs:           $(LIBTARGETS)
169
170
171 #
172 # Make unit tests...
173 #
174
175 unittests:      $(UNITTARGETS)
176
177
178 #
179 # Remove object and target files...
180 #
181
182 clean:
183         $(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
184         $(RM) libcups.so libcups.sl libcups.dylib
185
186
187 #
188 # Update dependencies (without system header dependencies...)
189 #
190
191 depend:
192         $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
193
194
195 #
196 # Run oclint to check code coverage...
197 #
198
199 oclint:
200         oclint -o=oclint.html -html $(LIBOBJS:.o=.c) -- $(ALL_CFLAGS)
201
202
203 #
204 # Install all targets...
205 #
206
207 install:        all install-data install-headers install-libs install-exec
208
209
210 #
211 # Install data files...
212 #
213
214 install-data:
215
216
217 #
218 # Install programs...
219 #
220
221 install-exec:
222
223
224 #
225 # Install headers...
226 #
227
228 install-headers:
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; \
233         done
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; \
239                 done; \
240         fi
241
242
243 #
244 # Install libraries...
245 #
246
247 install-libs: $(INSTALLSTATIC)
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`; \
254         fi
255         if test $(LIBCUPS) = "libcups.2.dylib"; then \
256                 $(RM) $(LIBDIR)/libcups.dylib; \
257                 $(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \
258         fi
259         if test "x$(SYMROOT)" != "x"; then \
260                 $(INSTALL_DIR) $(SYMROOT); \
261                 cp $(LIBCUPS) $(SYMROOT); \
262         fi
263
264 installstatic:
265         $(INSTALL_DIR) -m 755 $(LIBDIR)
266         $(INSTALL_LIB) -m 755 $(LIBCUPSSTATIC) $(LIBDIR)
267         $(RANLIB) $(LIBDIR)/$(LIBCUPSSTATIC)
268         $(CHMOD) 555 $(LIBDIR)/$(LIBCUPSSTATIC)
269
270
271 #
272 # Uninstall object and target files...
273 #
274
275 uninstall:
276         $(RM) $(LIBDIR)/libcups.2.dylib
277         $(RM) $(LIBDIR)/$(LIBCUPSSTATIC)
278         $(RM) $(LIBDIR)/libcups.dylib
279         $(RM) $(LIBDIR)/libcups_s.a
280         $(RM) $(LIBDIR)/libcups.sl
281         $(RM) $(LIBDIR)/libcups.sl.2
282         $(RM) $(LIBDIR)/libcups.so
283         $(RM) $(LIBDIR)/libcups.so.2
284         -$(RMDIR) $(LIBDIR)
285         for file in $(HEADERS); do \
286                 $(RM) $(INCLUDEDIR)/cups/$$file; \
287         done
288         -$(RMDIR) $(INCLUDEDIR)/cups
289
290
291 #
292 # libcups.so.2, libcups.sl.2
293 #
294
295 libcups.so.2 libcups.sl.2:      $(LIBOBJS)
296         echo Linking $@...
297         $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
298                 $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
299         $(RM) `basename $@ .2`
300         $(LN) $@ `basename $@ .2`
301
302
303 #
304 # libcups.2.dylib
305 #
306
307 libcups.2.dylib:        $(LIBOBJS) $(LIBCUPSORDER)
308         echo Creating export list for $@...
309         nm $(LIBOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}' | \
310                 grep -v -e '^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
311                 sort >t.exp
312         echo Linking $@...
313         $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
314                 -install_name $(libdir)/$@ \
315                 -current_version 2.10.0 \
316                 -compatibility_version 2.0.0 \
317                 -exported_symbols_list t.exp \
318                 $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
319                 $(COMMONLIBS) $(LIBZ)
320         $(RM) libcups.dylib t.exp
321         $(LN) $@ libcups.dylib
322
323
324 #
325 # libcups_s.a
326 #
327
328 libcups_s.a:    $(LIBOBJS) libcups_s.exp
329         echo Creating $@...
330         $(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o \
331                 $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
332                 $(COMMONLIBS) $(LIBZ)
333         $(RM) $@
334         $(AR) $(ARFLAGS) $@ libcups_s.o
335
336
337 #
338 # libcups.la
339 #
340
341 libcups.la:    $(LIBOBJS)
342         echo Linking $@...
343         $(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
344                 -rpath $(LIBDIR) -version-info 2:10 $(LIBGSSAPI) $(SSLLIBS) \
345                 $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
346
347
348 #
349 # libcups.a
350 #
351
352 libcups.a:      $(LIBOBJS)
353         echo Archiving $@...
354         $(RM) $@
355         $(AR) $(ARFLAGS) $@ $(LIBOBJS)
356         $(RANLIB) $@
357
358
359 #
360 # testadmin (dependency on static CUPS library is intentional)
361 #
362
363 testadmin:      testadmin.o $(LIBCUPSSTATIC)
364         echo Linking $@...
365         $(CC) $(LDFLAGS) -o $@ testadmin.o $(LIBCUPSSTATIC) \
366                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
367
368
369 #
370 # testarray (dependency on static CUPS library is intentional)
371 #
372
373 testarray:      testarray.o $(LIBCUPSSTATIC)
374         echo Linking $@...
375         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o $(LIBCUPSSTATIC) \
376                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
377         echo Running array API tests...
378         ./testarray
379
380
381 #
382 # testconflicts (dependency on static CUPS library is intentional)
383 #
384
385 testconflicts:  testconflicts.o $(LIBCUPSSTATIC)
386         echo Linking $@...
387         $(CC) $(LDFLAGS) -o $@ testconflicts.o $(LIBCUPSSTATIC) \
388                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
389
390
391 #
392 # testcups (dependency on static CUPS library is intentional)
393 #
394
395 testcups:       testcups.o $(LIBCUPSSTATIC)
396         echo Linking $@...
397         $(CC) $(LDFLAGS) -o $@ testcups.o $(LIBCUPSSTATIC) \
398                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
399
400
401 #
402 # testfile (dependency on static CUPS library is intentional)
403 #
404
405 testfile:       testfile.o $(LIBCUPSSTATIC)
406         echo Linking $@...
407         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o $(LIBCUPSSTATIC) \
408                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
409         echo Running file API tests...
410         ./testfile
411
412
413 #
414 # testhttp (dependency on static CUPS library is intentional)
415 #
416
417 testhttp:       testhttp.o $(LIBCUPSSTATIC)
418         echo Linking $@...
419         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o $(LIBCUPSSTATIC) \
420                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
421         echo Running HTTP API tests...
422         ./testhttp
423
424
425 #
426 # testipp (dependency on static CUPS library is intentional)
427 #
428
429 testipp:        testipp.o $(LIBCUPSSTATIC)
430         echo Linking $@...
431         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o $(LIBCUPSSTATIC) \
432                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
433         echo Running IPP API tests...
434         ./testipp
435
436
437 #
438 # testi18n (dependency on static CUPS library is intentional)
439 #
440
441 testi18n:       testi18n.o $(LIBCUPSSTATIC)
442         echo Linking $@...
443         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o $(LIBCUPSSTATIC) \
444                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
445         echo Running internationalization API tests...
446         ./testi18n
447
448
449 #
450 # testlang (dependency on static CUPS library is intentional)
451 #
452
453 testlang:       testlang.o $(LIBCUPSSTATIC)
454         echo Linking $@...
455         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o $(LIBCUPSSTATIC) \
456                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
457         echo Running language API tests...
458         ./testlang
459
460
461 #
462 # testoptions (dependency on static CUPS library is intentional)
463 #
464
465 testoptions:    testoptions.o $(LIBCUPSSTATIC)
466         echo Linking $@...
467         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o $(LIBCUPSSTATIC) \
468                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
469         echo Running option API tests...
470         ./testoptions
471
472
473 #
474 # testppd (dependency on static CUPS library is intentional)
475 #
476
477 testppd:        testppd.o $(LIBCUPSSTATIC) test.ppd test2.ppd
478         echo Linking $@...
479         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o $(LIBCUPSSTATIC) \
480                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
481         echo Running PPD API tests...
482         ./testppd
483
484
485 #
486 # testpwg (dependency on static CUPS library is intentional)
487 #
488
489 testpwg:        testpwg.o $(LIBCUPSSTATIC) test.ppd
490         echo Linking $@...
491         $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o $(LIBCUPSSTATIC) \
492                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
493         echo Running PWG API tests...
494         ./testpwg test.ppd
495
496
497 #
498 # testsnmp (dependency on static CUPS library is intentional)
499 #
500
501 testsnmp:       testsnmp.o $(LIBCUPSSTATIC)
502         echo Linking $@...
503         $(CC) $(LDFLAGS) -o $@ testsnmp.o $(LIBCUPSSTATIC) \
504                 $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
505
506
507 #
508 # Automatic API help files...
509 #
510
511 apihelp:
512         echo Generating CUPS API help files...
513         mxmldoc --section "Programming" \
514                 --title "Introduction to CUPS Programming" \
515                 --css ../doc/cups-printable.css \
516                 --header api-overview.header --intro api-overview.shtml \
517                 >../doc/help/api-overview.html
518         mxmldoc --section "Programming" --title "Array API" \
519                 --css ../doc/cups-printable.css \
520                 --header api-array.header --intro api-array.shtml \
521                 api-array.xml \
522                 array.h array.c >../doc/help/api-array.html
523         mxmldoc --tokens help/api-array.html api-array.xml >../doc/help/api-array.tokens
524         $(RM) api-array.xml
525         mxmldoc --section "Programming" --title "CUPS API" \
526                 --css ../doc/cups-printable.css \
527                 --header api-cups.header --intro api-cups.shtml \
528                 api-cups.xml \
529                 cups.h adminutil.c dest*.c language.c notify.c \
530                 options.c tempfile.c usersys.c \
531                 util.c >../doc/help/api-cups.html
532         mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
533         $(RM) api-cups.xml
534         mxmldoc --section "Programming" --title "File and Directory APIs" \
535                 --css ../doc/cups-printable.css \
536                 --header api-filedir.header --intro api-filedir.shtml \
537                 api-filedir.xml \
538                 file.h file.c dir.h dir.c >../doc/help/api-filedir.html
539         mxmldoc --tokens api-filedir.xml >../doc/help/api-filedir.tokens
540         $(RM) api-filedir.xml
541         mxmldoc --section "Programming" --title "PPD API (DEPRECATED)" \
542                 --css ../doc/cups-printable.css \
543                 --header api-ppd.header --intro api-ppd.shtml \
544                 api-ppd.xml \
545                 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
546                 ppd.c >../doc/help/api-ppd.html
547         mxmldoc --tokens help/api-ppd.html api-ppd.xml >../doc/help/api-ppd.tokens
548         $(RM) api-ppd.xml
549         mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
550                 --css ../doc/cups-printable.css \
551                 --header api-httpipp.header --intro api-httpipp.shtml \
552                 api-httpipp.xml \
553                 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
554                 http.c http-addr.c http-support.c ipp.c ipp-support.c \
555                 md5passwd.c request.c >../doc/help/api-httpipp.html
556         mxmldoc --tokens help/api-httpipp.html api-httpipp.xml >../doc/help/api-httpipp.tokens
557         $(RM) api-httpipp.xml
558         mxmldoc --section "Programming" \
559                 --title "Filter and Backend Programming" \
560                 --css ../doc/cups-printable.css \
561                 --header api-filter.header --intro api-filter.shtml \
562                 api-filter.xml \
563                 backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
564                 >../doc/help/api-filter.html
565         mxmldoc --tokens help/api-filter.html api-filter.xml >../doc/help/api-filter.tokens
566         $(RM) api-filter.xml
567
568 framedhelp:
569         echo Generating CUPS API help files...
570         mxmldoc --framed api-overview \
571                 --section "Programming" \
572                 --title "Introduction to CUPS Programming" \
573                 --css ../doc/cups-printable.css \
574                 --header api-overview.header --intro api-overview.shtml
575         mxmldoc --framed api-array \
576                 --section "Programming" --title "Array API" \
577                 --css ../doc/cups-printable.css \
578                 --header api-array.header --intro api-array.shtml \
579                 array.h array.c
580         mxmldoc --framed api-cups \
581                 --section "Programming" --title "CUPS API" \
582                 --css ../doc/cups-printable.css \
583                 --header api-cups.header --intro api-cups.shtml \
584                 cups.h adminutil.c dest*.c language.c notify.c \
585                 options.c tempfile.c usersys.c \
586                 util.c
587         mxmldoc --framed api-filedir \
588                 --section "Programming" --title "File and Directory APIs" \
589                 --css ../doc/cups-printable.css \
590                 --header api-filedir.header --intro api-filedir.shtml \
591                 file.h file.c dir.h dir.c
592         mxmldoc --framed api-ppd \
593                 --section "Programming" --title "PPD API (DEPRECATED)" \
594                 --css ../doc/cups-printable.css \
595                 --header api-ppd.header --intro api-ppd.shtml \
596                 ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
597                 page.c ppd.c
598         mxmldoc --framed api-httpipp \
599                 --section "Programming" --title "HTTP and IPP APIs" \
600                 --css ../doc/cups-printable.css \
601                 --header api-httpipp.header --intro api-httpipp.shtml \
602                 http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
603                 http.c http-addr.c http-support.c ipp.c ipp-support.c \
604                 md5passwd.c request.c
605         mxmldoc --framed api-filter \
606                 --section "Programming" \
607                 --title "Filter and Backend Programming" \
608                 --css ../doc/cups-printable.css \
609                 --header api-filter.header --intro api-filter.shtml \
610                 backchannel.c backend.h backend.c sidechannel.c sidechannel.h
611
612
613 #
614 # Lines of code computation...
615 #
616
617 sloc:
618         echo "libcupslite: \c"
619         sloccount $(LITEOBJS:.o=.c) 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
620         echo "libcups: \c"
621         sloccount $(LIBOBJS:.o=.c) 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
622
623
624 #
625 # Dependencies...
626 #
627
628 include Dependencies
629
630
631 #
632 # End of "$Id: Makefile 11173 2013-07-23 12:31:34Z msweet $".
633 #