Merge changes from CUPS 1.4svn-r8681 (tentative CUPS 1.4rc1)
[thirdparty/cups.git] / Makefile
CommitLineData
ef416fc2 1#
b19ccc9e 2# "$Id: Makefile 7961 2008-09-17 19:52:46Z mike $"
ef416fc2 3#
4# Top-level Makefile for the Common UNIX Printing System (CUPS).
5#
f11a948a 6# Copyright 2007-2009 by Apple Inc.
f7deaa1a 7# Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8#
9# These coded instructions, statements, and computer programs are the
bc44d920 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/".
ef416fc2 14#
15
16include Makedefs
17
49d87452
MS
18
19#
20# Don't run top-level build targets in parallel...
21#
22
23.NOTPARALLEL:
24
25
ef416fc2 26#
27# Directories to make...
28#
29
ac884b6a
MS
30DIRS = cups filter backend berkeley cgi-bin driver locale man monitor \
31 notifier ppdc scheduler systemv test \
757d2cad 32 $(PHPDIR) \
28b9d139 33 conf data doc examples $(FONTS) templates
bd7854cb 34
ef416fc2 35
36#
37# Make all targets...
38#
39
40all:
41 chmod +x cups-config
c9fc04c6 42 echo Using ARCHFLAGS="$(ARCHFLAGS)"
ac884b6a
MS
43 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
44 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
5f64df29
MS
45 echo Using CC="$(CC)"
46 echo Using CXX="$(CC)"
c9fc04c6 47 echo Using DSOFLAGS="$(DSOFLAGS)"
ac884b6a
MS
48 echo Using LDFLAGS="$(LDFLAGS)"
49 echo Using LIBS="$(LIBS)"
ef416fc2 50 for dir in $(DIRS); do\
51 echo Making all in $$dir... ;\
1f6f3dbc 52 (cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\
c9fc04c6
MS
53 done
54
55
56#
57# Make library targets...
58#
59
60libs:
61 echo Using ARCHFLAGS="$(ARCHFLAGS)"
62 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
63 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
5f64df29
MS
64 echo Using CC="$(CC)"
65 echo Using CXX="$(CC)"
c9fc04c6
MS
66 echo Using DSOFLAGS="$(DSOFLAGS)"
67 echo Using LDFLAGS="$(LDFLAGS)"
68 echo Using LIBS="$(LIBS)"
69 for dir in $(DIRS); do\
8922323b 70 echo Making libraries in $$dir... ;\
c9fc04c6 71 (cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\
ef416fc2 72 done
73
bd7854cb 74
5f64df29
MS
75#
76# Make unit test targets...
77#
78
79unittests:
80 echo Using ARCHFLAGS="$(ARCHFLAGS)"
81 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
82 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
83 echo Using CC="$(CC)"
84 echo Using CXX="$(CC)"
85 echo Using DSOFLAGS="$(DSOFLAGS)"
86 echo Using LDFLAGS="$(LDFLAGS)"
87 echo Using LIBS="$(LIBS)"
88 for dir in $(DIRS); do\
89 echo Making all in $$dir... ;\
90 (cd $$dir ; $(MAKE) $(MFLAGS) unittests) || exit 1;\
91 done
92
93
ef416fc2 94#
95# Remove object and target files...
96#
97
98clean:
99 for dir in $(DIRS); do\
100 echo Cleaning in $$dir... ;\
101 (cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
102 done
103
bd7854cb 104
a9252913 105#
106# Remove all non-distribution files...
107#
108
109distclean: clean
110 $(RM) Makedefs config.h config.log config.status
0a682745
MS
111 $(RM) cups-config
112 $(RM) conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
113 $(RM) doc/help/ref-cupsd-conf.html doc/help/standard.html doc/index.html
114 $(RM) init/cups.sh init/cups-lpd init/org.cups.cups-lpd.plist
b94498cf 115 $(RM) man/client.conf.man
a9252913 116 $(RM) man/cups-deviced.man man/cups-driverd.man
117 $(RM) man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
b19ccc9e 118 $(RM) man/cupsd.conf.man man/drv.man man/lpoptions.man
f7deaa1a 119 $(RM) packaging/cups.list
58dc1933 120 $(RM) packaging/cups-desc.plist packaging/cups-info.plist
db1f069b 121 $(RM) templates/header.tmpl
c5571a1d
MS
122 $(RM) desktop/cups.desktop
123 $(RM) init/cups.xml
a9252913 124 -$(RM) doc/*/index.html
a9252913 125 -$(RM) templates/*/header.tmpl
58dc1933 126 -$(RM) -r autom4te*.cache clang cups/charmaps cups/locale driver/test
a9252913 127
128
ef416fc2 129#
130# Make dependencies
131#
132
133depend:
134 for dir in $(DIRS); do\
135 echo Making dependencies in $$dir... ;\
136 (cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
137 done
138
139
1f0275e3
MS
140#
141# Run the clang.llvm.org static code analysis tool on the C sources.
142#
143
144.PHONY: clang
145clang:
c5571a1d 146 $(RM) -r clang
ed6e7faf 147 scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) \
c5571a1d 148 CC=ccc-analyzer CXX=ccc-analyzer clean all
1f0275e3
MS
149
150
b94498cf 151#
152# Generate a ctags file...
153#
154
155ctags:
156 ctags -R .
157
158
ef416fc2 159#
50fe7201 160# Install everything...
ef416fc2 161#
162
50fe7201
MS
163install: install-data install-headers install-libs install-exec
164
165
166#
167# Install data files...
168#
169
170install-data:
ef416fc2 171 for dir in $(DIRS); do\
50fe7201
MS
172 echo Installing data files in $$dir... ;\
173 (cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
ef416fc2 174 done
ef416fc2 175 echo Installing cups-config script...
757d2cad 176 $(INSTALL_DIR) -m 755 $(BINDIR)
ef416fc2 177 $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
e1d6a774 178 if test "x$(INITDIR)" != x; then \
f301802f 179 echo Installing init scripts...; \
757d2cad 180 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
fa73b229 181 $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
f7deaa1a 182 for level in $(RCLEVELS); do \
183 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
184 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups; \
185 if test `uname` = HP-UX; then \
186 level=`expr $$level - 1`; \
187 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
188 fi; \
189 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups; \
190 done; \
757d2cad 191 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
f7deaa1a 192 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc0.d/K$(RCSTOP)cups; \
ef416fc2 193 fi
e1d6a774 194 if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
ef416fc2 195 $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
a41f09e2 196 if test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
d09495fa 197 echo Installing LaunchDaemons configuration files...; \
e00b005a 198 $(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
d09495fa 199 $(INSTALL_DATA) init/org.cups.cups-lpd.plist $(BUILDROOT)/System/Library/LaunchDaemons; \
3d8365b8 200 case `uname -r` in \
201 8.*) \
202 $(INSTALL_DIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices; \
203 $(INSTALL_SCRIPT) init/PrintingServices.launchd $(BUILDROOT)/System/Library/StartupItems/PrintingServices/PrintingServices; \
204 $(INSTALL_DATA) init/StartupParameters.plist $(BUILDROOT)/System/Library/StartupItems/PrintingServices/StartupParameters.plist; \
205 $(INSTALL_DIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices/Resources/English.lproj; \
206 $(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)/System/Library/StartupItems/PrintingServices/Resources/English.lproj/Localizable.strings; \
207 ;; \
208 esac \
ef416fc2 209 else \
f301802f 210 echo Installing RC script...; \
fa73b229 211 $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
ef416fc2 212 fi \
213 fi
749b1e90
MS
214 if test "x$(SMFMANIFESTDIR)" != x; then \
215 echo Installing SMF manifest in $(SMFMANIFESTDIR)...;\
216 $(INSTALL_DIR) $(BUILDROOT)/$(SMFMANIFESTDIR); \
217 $(INSTALL_SCRIPT) init/cups.xml $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
218 fi
e1d6a774 219 if test "x$(DBUSDIR)" != x; then \
b423cd4c 220 echo Installing cups.conf in $(DBUSDIR)...;\
f7deaa1a 221 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR)/system.d; \
222 $(INSTALL_DATA) packaging/cups-dbus.conf $(BUILDROOT)$(DBUSDIR)/system.d/cups.conf; \
bd7854cb 223 fi
e1d6a774 224 if test "x$(XINETD)" != x; then \
225 echo Installing xinetd configuration file for cups-lpd...; \
226 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(XINETD); \
227 $(INSTALL_DATA) init/cups-lpd $(BUILDROOT)$(XINETD)/cups-lpd; \
228 fi
f7deaa1a 229 if test "x$(MENUDIR)" != x; then \
230 echo Installing desktop menu...; \
231 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(MENUDIR); \
232 $(INSTALL_DATA) desktop/cups.desktop $(BUILDROOT)$(MENUDIR); \
233 fi
234 if test "x$(ICONDIR)" != x; then \
e1d6a774 235 echo Installing desktop icons...; \
f7deaa1a 236 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps; \
237 $(INSTALL_DATA) desktop/cups-16.png $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps/cups.png; \
238 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps; \
239 $(INSTALL_DATA) desktop/cups-32.png $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps/cups.png; \
240 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps; \
241 $(INSTALL_DATA) desktop/cups-64.png $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps/cups.png; \
242 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps; \
243 $(INSTALL_DATA) desktop/cups-128.png $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
e1d6a774 244 fi
ef416fc2 245
50fe7201
MS
246#
247# Install header files...
248#
249
250install-headers:
251 for dir in $(DIRS); do\
252 echo Installing header files in $$dir... ;\
253 (cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
254 done
255
ef416fc2 256
257#
50fe7201 258# Install programs...
ef416fc2 259#
260
c9fc04c6 261install-exec: all
50fe7201
MS
262 for dir in $(DIRS); do\
263 echo Installing programs in $$dir... ;\
c9fc04c6 264 (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
50fe7201 265 done
ef416fc2 266
50fe7201
MS
267
268#
269# Install libraries...
270#
271
c9fc04c6 272install-libs: libs
50fe7201
MS
273 for dir in $(DIRS); do\
274 echo Installing libraries in $$dir... ;\
c9fc04c6 275 (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
50fe7201 276 done
ef416fc2 277
278
757d2cad 279#
280# Uninstall object and target files...
281#
282
283uninstall:
284 for dir in $(DIRS); do\
285 echo Uninstalling in $$dir... ;\
286 (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
287 done
288 echo Uninstalling cups-config script...
289 $(RM) $(BINDIR)/cups-config
290 -$(RMDIR) $(BINDIR)
291 echo Uninstalling startup script...
e1d6a774 292 if test "x$(INITDIR)" != x; then \
757d2cad 293 $(RM) $(BUILDROOT)$(INITDIR)/init.d/cups; \
294 $(RMDIR) $(BUILDROOT)$(INITDIR)/init.d; \
295 $(RM) $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
296 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc0.d; \
297 $(RM) $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
298 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc2.d; \
299 $(RM) $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
300 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc3.d; \
301 $(RM) $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
302 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc5.d; \
303 fi
e1d6a774 304 if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
757d2cad 305 if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
306 $(RM) $(BUILDROOT)$(INITDDIR)/PrintingServices; \
307 $(RM) $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
308 $(RM) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
309 $(RMDIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
310 elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
3d8365b8 311 $(RM) $(BUILDROOT)$(INITDDIR)/org.cups.cupsd.plist; \
312 $(RM) $(BUILDROOT)$(INITDDIR)/org.cups.cups-lpd.plist; \
313 $(RMDIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices; \
757d2cad 314 else \
315 $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
316 fi \
317 $(RMDIR) $(BUILDROOT)$(INITDDIR); \
318 fi
178cb736
MS
319 if test "x$(SMFMANIFESTDIR)" != x; then \
320 echo Uninstalling SMF manifest in $(SMFMANIFESTDIR)...;\
321 $(RM) $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
322 fi
e1d6a774 323 if test "x$(DBUSDIR)" != x; then \
757d2cad 324 echo Uninstalling cups.conf in $(DBUSDIR)...;\
325 $(RM) $(BUILDROOT)$(DBUSDIR)/cups.conf; \
326 $(RMDIR) $(BUILDROOT)$(DBUSDIR); \
327 fi
178cb736
MS
328 if test "x$(XINETD)" != x; then \
329 echo Uninstalling xinetd configuration file for cups-lpd...; \
330 $(RM) $(BUILDROOT)$(XINETD)/cups-lpd; \
331 fi
332 if test "x$(MENUDIR)" != x; then \
333 echo Uninstalling desktop menu...; \
334 $(RM) $(BUILDROOT)$(MENUDIR)/cups.desktop; \
335 fi
336 if test "x$(ICONDIR)" != x; then \
337 echo Uninstalling desktop icons...; \
338 $(RM) $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps/cups.png; \
339 $(RM) $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps/cups.png; \
340 $(RM) $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps/cups.png; \
341 $(RM) $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
342 fi
757d2cad 343
344
ef416fc2 345#
346# Run the test suite...
347#
348
f11a948a 349test: all unittests
ef416fc2 350 echo Running CUPS test suite...
351 cd test; ./run-stp-tests.sh
352
353
f11a948a 354check: all unittests
d09495fa 355 echo Running CUPS test suite with defaults...
356 cd test; ./run-stp-tests.sh 1 0 n
357
358
f11a948a 359#
178cb736 360# Create HTML documentation...
f11a948a
MS
361#
362
363apihelp:
364 for dir in cgi-bin cups filter driver ppdc scheduler; do\
365 echo Generating API help in $$dir... ;\
366 (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
367 done
368
369framedhelp:
370 for dir in cgi-bin cups filter driver ppdc scheduler; do\
371 echo Generating framed API help in $$dir... ;\
372 (cd $$dir; $(MAKE) $(MFLAGS) framedhelp) || exit 1;\
373 done
374
178cb736
MS
375
376#
377# Create an Xcode docset...
378#
379
f11a948a
MS
380docset: apihelp
381 echo Generating docset directory tree...
382 $(RM) -r org.cups.docset
383 mkdir -p org.cups.docset/Contents/Resources/Documentation/help
384 mkdir -p org.cups.docset/Contents/Resources/Documentation/images
178cb736 385 cd man; $(MAKE) $(MFLAGS) html
f11a948a
MS
386 cd doc; $(MAKE) $(MFLAGS) docset
387 cd cgi-bin; $(MAKE) $(MFLAGS) makedocset
388 cgi-bin/makedocset org.cups.docset \
389 `svnversion . | sed -e '1,$$s/[a-zA-Z]//g'` \
390 doc/help/api-*.tokens
391 $(RM) doc/help/api-*.tokens
392 echo Indexing docset...
393 /Developer/usr/bin/docsetutil index org.cups.docset
394 echo Generating docset archive and feed...
395 /Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
396 --atom org.cups.docset.atom \
397 --download-url http://www.cups.org/org.cups.docset.xar \
398 org.cups.docset
399
400
ef416fc2 401#
4744bd90 402# Make software distributions using EPM (http://www.easysw.com/epm/)...
ef416fc2 403#
404
d09495fa 405EPMFLAGS = -v --output-dir dist $(EPMARCH)
ef416fc2 406
b86bc4cf 407aix bsd deb depot inst pkg setld slackware swinstall tardist:
4744bd90 408 epm $(EPMFLAGS) -f $@ cups packaging/cups.list
ef416fc2 409
410epm:
d09495fa 411 epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list
412
413osx:
414 epm $(EPMFLAGS) -f osx -s packaging/installer.tif cups packaging/cups.list
415
b86bc4cf 416rpm:
417 epm $(EPMFLAGS) -f rpm -s packaging/installer.gif cups packaging/cups.list
418
d09495fa 419.PHONEY: dist
420dist: all
421 $(RM) -r dist
422 $(MAKE) $(MFLAGS) epm
423 case `uname` in \
424 *BSD*) $(MAKE) $(MFLAGS) bsd;; \
425 Darwin*) $(MAKE) $(MFLAGS) osx;; \
426 IRIX*) $(MAKE) $(MFLAGS) tardist;; \
427 Linux*) $(MAKE) $(MFLAGS) rpm;; \
428 SunOS*) $(MAKE) $(MFLAGS) pkg;; \
429 esac
ef416fc2 430
bd7854cb 431
ef416fc2 432#
b19ccc9e 433# End of "$Id: Makefile 7961 2008-09-17 19:52:46Z mike $".
ef416fc2 434#