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