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