Merge changes from 1.4svn-r7979.
[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#
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
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) \
634763e8 33 conf data doc $(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... ;\
c9fc04c6
MS
52 (cd $$dir ; $(MAKE) $(MFLAGS) all) || exit 1;\
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
db1f069b 120 $(RM) templates/header.tmpl
c5571a1d
MS
121 $(RM) desktop/cups.desktop
122 $(RM) init/cups.xml
a9252913 123 -$(RM) doc/*/index.html
a9252913 124 -$(RM) templates/*/header.tmpl
125 -$(RM) -r autom4te*.cache
126
127
ef416fc2 128#
129# Make dependencies
130#
131
132depend:
133 for dir in $(DIRS); do\
134 echo Making dependencies in $$dir... ;\
135 (cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
136 done
137
138
1f0275e3
MS
139#
140# Run the clang.llvm.org static code analysis tool on the C sources.
141#
142
143.PHONY: clang
144clang:
c5571a1d
MS
145 $(RM) -r clang
146 scan-build -k -o `pwd`/clang $(MAKE) $(MFLAGS) \
147 CC=ccc-analyzer CXX=ccc-analyzer clean all
1f0275e3
MS
148
149
b94498cf 150#
151# Generate a ctags file...
152#
153
154ctags:
155 ctags -R .
156
157
ef416fc2 158#
50fe7201 159# Install everything...
ef416fc2 160#
161
50fe7201
MS
162install: install-data install-headers install-libs install-exec
163
164
165#
166# Install data files...
167#
168
169install-data:
ef416fc2 170 for dir in $(DIRS); do\
50fe7201
MS
171 echo Installing data files in $$dir... ;\
172 (cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
ef416fc2 173 done
ef416fc2 174 echo Installing cups-config script...
757d2cad 175 $(INSTALL_DIR) -m 755 $(BINDIR)
ef416fc2 176 $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
e1d6a774 177 if test "x$(INITDIR)" != x; then \
f301802f 178 echo Installing init scripts...; \
757d2cad 179 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
fa73b229 180 $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
f7deaa1a 181 for level in $(RCLEVELS); do \
182 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
183 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups; \
184 if test `uname` = HP-UX; then \
185 level=`expr $$level - 1`; \
186 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
187 fi; \
188 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups; \
189 done; \
757d2cad 190 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
f7deaa1a 191 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc0.d/K$(RCSTOP)cups; \
ef416fc2 192 fi
e1d6a774 193 if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
ef416fc2 194 $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
a41f09e2 195 if test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
d09495fa 196 echo Installing LaunchDaemons configuration files...; \
e00b005a 197 $(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
d09495fa 198 $(INSTALL_DATA) init/org.cups.cups-lpd.plist $(BUILDROOT)/System/Library/LaunchDaemons; \
3d8365b8 199 case `uname -r` in \
200 8.*) \
201 $(INSTALL_DIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices; \
202 $(INSTALL_SCRIPT) init/PrintingServices.launchd $(BUILDROOT)/System/Library/StartupItems/PrintingServices/PrintingServices; \
203 $(INSTALL_DATA) init/StartupParameters.plist $(BUILDROOT)/System/Library/StartupItems/PrintingServices/StartupParameters.plist; \
204 $(INSTALL_DIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices/Resources/English.lproj; \
205 $(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)/System/Library/StartupItems/PrintingServices/Resources/English.lproj/Localizable.strings; \
206 ;; \
207 esac \
ef416fc2 208 else \
f301802f 209 echo Installing RC script...; \
fa73b229 210 $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
ef416fc2 211 fi \
212 fi
749b1e90
MS
213 if test "x$(SMFMANIFESTDIR)" != x; then \
214 echo Installing SMF manifest in $(SMFMANIFESTDIR)...;\
215 $(INSTALL_DIR) $(BUILDROOT)/$(SMFMANIFESTDIR); \
216 $(INSTALL_SCRIPT) init/cups.xml $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
217 fi
e1d6a774 218 if test "x$(DBUSDIR)" != x; then \
b423cd4c 219 echo Installing cups.conf in $(DBUSDIR)...;\
f7deaa1a 220 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR)/system.d; \
221 $(INSTALL_DATA) packaging/cups-dbus.conf $(BUILDROOT)$(DBUSDIR)/system.d/cups.conf; \
bd7854cb 222 fi
e1d6a774 223 if test "x$(XINETD)" != x; then \
224 echo Installing xinetd configuration file for cups-lpd...; \
225 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(XINETD); \
226 $(INSTALL_DATA) init/cups-lpd $(BUILDROOT)$(XINETD)/cups-lpd; \
227 fi
f7deaa1a 228 if test "x$(MENUDIR)" != x; then \
229 echo Installing desktop menu...; \
230 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(MENUDIR); \
231 $(INSTALL_DATA) desktop/cups.desktop $(BUILDROOT)$(MENUDIR); \
232 fi
233 if test "x$(ICONDIR)" != x; then \
e1d6a774 234 echo Installing desktop icons...; \
f7deaa1a 235 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps; \
236 $(INSTALL_DATA) desktop/cups-16.png $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps/cups.png; \
237 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps; \
238 $(INSTALL_DATA) desktop/cups-32.png $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps/cups.png; \
239 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps; \
240 $(INSTALL_DATA) desktop/cups-64.png $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps/cups.png; \
241 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps; \
242 $(INSTALL_DATA) desktop/cups-128.png $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
e1d6a774 243 fi
ef416fc2 244
50fe7201
MS
245#
246# Install header files...
247#
248
249install-headers:
250 for dir in $(DIRS); do\
251 echo Installing header files in $$dir... ;\
252 (cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
253 done
254
ef416fc2 255
256#
50fe7201 257# Install programs...
ef416fc2 258#
259
c9fc04c6 260install-exec: all
50fe7201
MS
261 for dir in $(DIRS); do\
262 echo Installing programs in $$dir... ;\
c9fc04c6 263 (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
50fe7201 264 done
ef416fc2 265
50fe7201
MS
266
267#
268# Install libraries...
269#
270
c9fc04c6 271install-libs: libs
50fe7201
MS
272 for dir in $(DIRS); do\
273 echo Installing libraries in $$dir... ;\
c9fc04c6 274 (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
50fe7201 275 done
ef416fc2 276
277
757d2cad 278#
279# Uninstall object and target files...
280#
281
282uninstall:
283 for dir in $(DIRS); do\
284 echo Uninstalling in $$dir... ;\
285 (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
286 done
287 echo Uninstalling cups-config script...
288 $(RM) $(BINDIR)/cups-config
289 -$(RMDIR) $(BINDIR)
290 echo Uninstalling startup script...
e1d6a774 291 if test "x$(INITDIR)" != x; then \
757d2cad 292 $(RM) $(BUILDROOT)$(INITDIR)/init.d/cups; \
293 $(RMDIR) $(BUILDROOT)$(INITDIR)/init.d; \
294 $(RM) $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
295 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc0.d; \
296 $(RM) $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
297 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc2.d; \
298 $(RM) $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
299 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc3.d; \
300 $(RM) $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
301 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc5.d; \
302 fi
e1d6a774 303 if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
757d2cad 304 if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
305 $(RM) $(BUILDROOT)$(INITDDIR)/PrintingServices; \
306 $(RM) $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
307 $(RM) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
308 $(RMDIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
309 elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
3d8365b8 310 $(RM) $(BUILDROOT)$(INITDDIR)/org.cups.cupsd.plist; \
311 $(RM) $(BUILDROOT)$(INITDDIR)/org.cups.cups-lpd.plist; \
312 $(RMDIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices; \
757d2cad 313 else \
314 $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
315 fi \
316 $(RMDIR) $(BUILDROOT)$(INITDDIR); \
317 fi
e1d6a774 318 if test "x$(DBUSDIR)" != x; then \
757d2cad 319 echo Uninstalling cups.conf in $(DBUSDIR)...;\
320 $(RM) $(BUILDROOT)$(DBUSDIR)/cups.conf; \
321 $(RMDIR) $(BUILDROOT)$(DBUSDIR); \
322 fi
e1d6a774 323 $(RM) $(BUILDROOT)/etc/xinetd.d/cups-lpd
324 $(RM) $(BUILDROOT)/usr/share/applications/cups.desktop
325 $(RM) $(BUILDROOT)/usr/share/icons/hicolor/16x16/apps/cups.png
326 $(RM) $(BUILDROOT)/usr/share/icons/hicolor/32x32/apps/cups.png
327 $(RM) $(BUILDROOT)/usr/share/icons/hicolor/64x64/apps/cups.png
328 $(RM) $(BUILDROOT)/usr/share/icons/hicolor/128x128/apps/cups.png
757d2cad 329
330
ef416fc2 331#
332# Run the test suite...
333#
334
d09495fa 335test: all
ef416fc2 336 echo Running CUPS test suite...
337 cd test; ./run-stp-tests.sh
338
339
d09495fa 340check: all
341 echo Running CUPS test suite with defaults...
342 cd test; ./run-stp-tests.sh 1 0 n
343
344
ef416fc2 345#
4744bd90 346# Make software distributions using EPM (http://www.easysw.com/epm/)...
ef416fc2 347#
348
d09495fa 349EPMFLAGS = -v --output-dir dist $(EPMARCH)
ef416fc2 350
b86bc4cf 351aix bsd deb depot inst pkg setld slackware swinstall tardist:
4744bd90 352 epm $(EPMFLAGS) -f $@ cups packaging/cups.list
ef416fc2 353
354epm:
d09495fa 355 epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list
356
357osx:
358 epm $(EPMFLAGS) -f osx -s packaging/installer.tif cups packaging/cups.list
359
b86bc4cf 360rpm:
361 epm $(EPMFLAGS) -f rpm -s packaging/installer.gif cups packaging/cups.list
362
d09495fa 363.PHONEY: dist
364dist: all
365 $(RM) -r dist
366 $(MAKE) $(MFLAGS) epm
367 case `uname` in \
368 *BSD*) $(MAKE) $(MFLAGS) bsd;; \
369 Darwin*) $(MAKE) $(MFLAGS) osx;; \
370 IRIX*) $(MAKE) $(MFLAGS) tardist;; \
371 Linux*) $(MAKE) $(MFLAGS) rpm;; \
372 SunOS*) $(MAKE) $(MFLAGS) pkg;; \
373 esac
ef416fc2 374
bd7854cb 375
ef416fc2 376#
b19ccc9e 377# End of "$Id: Makefile 7961 2008-09-17 19:52:46Z mike $".
ef416fc2 378#