Fix compiler warnings.
[thirdparty/cups.git] / Makefile
CommitLineData
ef416fc2 1#
f2d18633 2# "$Id$"
ef416fc2 3#
5a1d7a17 4# Top-level Makefile for CUPS.
ef416fc2 5#
d95bd167 6# Copyright 2007-2014 by Apple Inc.
5a1d7a17 7# Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8#
5a1d7a17
MS
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/".
ef416fc2 14#
15
16include Makedefs
17
49d87452 18
ef416fc2 19#
20# Directories to make...
21#
22
a4845881 23DIRS = cups test $(BUILDDIRS)
bd7854cb 24
ef416fc2 25
26#
27# Make all targets...
28#
29
30all:
31 chmod +x cups-config
c9fc04c6 32 echo Using ARCHFLAGS="$(ARCHFLAGS)"
ac884b6a
MS
33 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
34 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
5f64df29
MS
35 echo Using CC="$(CC)"
36 echo Using CXX="$(CC)"
c9fc04c6 37 echo Using DSOFLAGS="$(DSOFLAGS)"
ac884b6a
MS
38 echo Using LDFLAGS="$(LDFLAGS)"
39 echo Using LIBS="$(LIBS)"
ef416fc2 40 for dir in $(DIRS); do\
41 echo Making all in $$dir... ;\
1f6f3dbc 42 (cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\
c9fc04c6
MS
43 done
44
45
46#
47# Make library targets...
48#
49
50libs:
51 echo Using ARCHFLAGS="$(ARCHFLAGS)"
52 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
53 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
5f64df29
MS
54 echo Using CC="$(CC)"
55 echo Using CXX="$(CC)"
c9fc04c6
MS
56 echo Using DSOFLAGS="$(DSOFLAGS)"
57 echo Using LDFLAGS="$(LDFLAGS)"
58 echo Using LIBS="$(LIBS)"
59 for dir in $(DIRS); do\
8922323b 60 echo Making libraries in $$dir... ;\
c9fc04c6 61 (cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\
ef416fc2 62 done
63
bd7854cb 64
5f64df29
MS
65#
66# Make unit test targets...
67#
68
69unittests:
70 echo Using ARCHFLAGS="$(ARCHFLAGS)"
71 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
72 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
73 echo Using CC="$(CC)"
74 echo Using CXX="$(CC)"
75 echo Using DSOFLAGS="$(DSOFLAGS)"
76 echo Using LDFLAGS="$(LDFLAGS)"
77 echo Using LIBS="$(LIBS)"
78 for dir in $(DIRS); do\
79 echo Making all in $$dir... ;\
80 (cd $$dir ; $(MAKE) $(MFLAGS) unittests) || exit 1;\
81 done
82
83
ef416fc2 84#
85# Remove object and target files...
86#
87
88clean:
89 for dir in $(DIRS); do\
90 echo Cleaning in $$dir... ;\
91 (cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
92 done
93
bd7854cb 94
a9252913 95#
96# Remove all non-distribution files...
97#
98
99distclean: clean
100 $(RM) Makedefs config.h config.log config.status
d95bd167 101 $(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
0a682745 102 $(RM) cups-config
d95bd167
MS
103 $(RM) data/testprint
104 $(RM) desktop/cups.desktop
105 $(RM) doc/index.html
106 $(RM) man/client.conf.man man/cups-files.conf.man man/cups-lpd.man man/cups-snmp.man man/cupsaddsmb.man man/cupsd.conf.man man/cupsd.man man/lpoptions.man
f7deaa1a 107 $(RM) packaging/cups.list
d95bd167 108 $(RM) scheduler/cups-lpd.xinetd scheduler/cups.sh scheduler/cups.xml scheduler/org.cups.cups-lpd.plist scheduler/org.cups.cupsd.path scheduler/org.cups.cupsd.service scheduler/org.cups.cupsd.socket
db1f069b 109 $(RM) templates/header.tmpl
a9252913 110 -$(RM) doc/*/index.html
a9252913 111 -$(RM) templates/*/header.tmpl
d95bd167 112 -$(RM) -r autom4te*.cache clang cups/charmaps cups/locale
a9252913 113
114
ef416fc2 115#
116# Make dependencies
117#
118
119depend:
120 for dir in $(DIRS); do\
121 echo Making dependencies in $$dir... ;\
122 (cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
123 done
124
125
1f0275e3 126#
148d3699
MS
127# Run the Clang static code analysis tool on the sources, available here:
128#
129# http://clang-analyzer.llvm.org
130#
131# At least checker-231 is required.
1f0275e3
MS
132#
133
f8b3a85b 134.PHONY: clang clang-changes
1f0275e3 135clang:
c5571a1d 136 $(RM) -r clang
41681883 137 scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) clean all
f8b3a85b
MS
138clang-changes:
139 scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) all
1f0275e3
MS
140
141
148d3699
MS
142#
143# Run the STACK tool on the sources, available here:
144#
145# http://css.csail.mit.edu/stack/
146#
147# Do the following to pass options to configure:
148#
149# make CONFIGFLAGS="--foo --bar" stack
150#
151
152.PHONY: stack
153stack:
154 stack-build ./configure $(CONFIGFLAGS)
155 stack-build $(MAKE) $(MFLAGS) clean all
156 poptck
157 $(MAKE) $(MFLAGS) distclean
158 $(RM) */*.ll
159 $(RM) */*.ll.out
160
161
b94498cf 162#
163# Generate a ctags file...
164#
165
166ctags:
167 ctags -R .
168
169
ef416fc2 170#
50fe7201 171# Install everything...
ef416fc2 172#
173
50fe7201
MS
174install: install-data install-headers install-libs install-exec
175
176
177#
178# Install data files...
179#
180
181install-data:
229681c1
MS
182 echo Making all in cups...
183 (cd cups; $(MAKE) $(MFLAGS) all)
ef416fc2 184 for dir in $(DIRS); do\
50fe7201
MS
185 echo Installing data files in $$dir... ;\
186 (cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
ef416fc2 187 done
ef416fc2 188 echo Installing cups-config script...
757d2cad 189 $(INSTALL_DIR) -m 755 $(BINDIR)
ef416fc2 190 $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
4d301e69 191
ef416fc2 192
50fe7201
MS
193#
194# Install header files...
195#
196
197install-headers:
198 for dir in $(DIRS); do\
199 echo Installing header files in $$dir... ;\
200 (cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
201 done
71e16022
MS
202 if test "x$(privateinclude)" != x; then \
203 echo Installing config.h into $(PRIVATEINCLUDE)...; \
5180a04c
MS
204 $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \
205 $(INSTALL_DATA) config.h $(PRIVATEINCLUDE)/config.h; \
71e16022 206 fi
50fe7201 207
ef416fc2 208
209#
50fe7201 210# Install programs...
ef416fc2 211#
212
c9fc04c6 213install-exec: all
50fe7201
MS
214 for dir in $(DIRS); do\
215 echo Installing programs in $$dir... ;\
c9fc04c6 216 (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
50fe7201 217 done
ef416fc2 218
50fe7201
MS
219
220#
221# Install libraries...
222#
223
c9fc04c6 224install-libs: libs
50fe7201
MS
225 for dir in $(DIRS); do\
226 echo Installing libraries in $$dir... ;\
c9fc04c6 227 (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
50fe7201 228 done
ef416fc2 229
230
757d2cad 231#
232# Uninstall object and target files...
233#
234
235uninstall:
236 for dir in $(DIRS); do\
237 echo Uninstalling in $$dir... ;\
238 (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
239 done
240 echo Uninstalling cups-config script...
241 $(RM) $(BINDIR)/cups-config
242 -$(RMDIR) $(BINDIR)
757d2cad 243
244
ef416fc2 245#
246# Run the test suite...
247#
248
f11a948a 249test: all unittests
ef416fc2 250 echo Running CUPS test suite...
251 cd test; ./run-stp-tests.sh
252
253
f11a948a 254check: all unittests
d09495fa 255 echo Running CUPS test suite with defaults...
85dda01c
MS
256 cd test; ./run-stp-tests.sh 1 0 n n
257
258debugcheck: all unittests
259 echo Running CUPS test suite with debug printfs...
260 cd test; ./run-stp-tests.sh 1 0 n y
d09495fa 261
262
f11a948a 263#
9520743f 264# Create HTML documentation using Mini-XML's mxmldoc (http://www.msweet.org/)...
f11a948a
MS
265#
266
267apihelp:
a2326b5b 268 for dir in cgi-bin cups filter ppdc scheduler; do\
f11a948a
MS
269 echo Generating API help in $$dir... ;\
270 (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
271 done
272
273framedhelp:
a2326b5b 274 for dir in cgi-bin cups filter ppdc scheduler; do\
f11a948a
MS
275 echo Generating framed API help in $$dir... ;\
276 (cd $$dir; $(MAKE) $(MFLAGS) framedhelp) || exit 1;\
277 done
278
178cb736
MS
279
280#
9520743f 281# Create an Xcode docset using Mini-XML's mxmldoc (http://www.msweet.org/)...
178cb736
MS
282#
283
f11a948a
MS
284docset: apihelp
285 echo Generating docset directory tree...
286 $(RM) -r org.cups.docset
287 mkdir -p org.cups.docset/Contents/Resources/Documentation/help
288 mkdir -p org.cups.docset/Contents/Resources/Documentation/images
178cb736 289 cd man; $(MAKE) $(MFLAGS) html
f11a948a
MS
290 cd doc; $(MAKE) $(MFLAGS) docset
291 cd cgi-bin; $(MAKE) $(MFLAGS) makedocset
292 cgi-bin/makedocset org.cups.docset \
293 `svnversion . | sed -e '1,$$s/[a-zA-Z]//g'` \
294 doc/help/api-*.tokens
295 $(RM) doc/help/api-*.tokens
296 echo Indexing docset...
a29fd7dd 297 /Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil index org.cups.docset
f11a948a 298 echo Generating docset archive and feed...
85b5d1df 299 $(RM) org.cups.docset.atom
a29fd7dd 300 /Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
f11a948a
MS
301 --atom org.cups.docset.atom \
302 --download-url http://www.cups.org/org.cups.docset.xar \
303 org.cups.docset
304
305
84315f46
MS
306#
307# Lines of code computation...
308#
309
310sloc:
a4845881 311 for dir in cups scheduler; do \
84315f46
MS
312 (cd $$dir; $(MAKE) $(MFLAGS) sloc) || exit 1;\
313 done
314
315
ef416fc2 316#
9520743f 317# Make software distributions using EPM (http://www.msweet.org/)...
ef416fc2 318#
319
d09495fa 320EPMFLAGS = -v --output-dir dist $(EPMARCH)
ef416fc2 321
9aed20a5 322bsd deb pkg slackware:
4744bd90 323 epm $(EPMFLAGS) -f $@ cups packaging/cups.list
ef416fc2 324
325epm:
d09495fa 326 epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list
327
b86bc4cf 328rpm:
329 epm $(EPMFLAGS) -f rpm -s packaging/installer.gif cups packaging/cups.list
330
d09495fa 331.PHONEY: dist
332dist: all
333 $(RM) -r dist
334 $(MAKE) $(MFLAGS) epm
335 case `uname` in \
336 *BSD*) $(MAKE) $(MFLAGS) bsd;; \
337 Darwin*) $(MAKE) $(MFLAGS) osx;; \
97c9a8d7 338 Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
d09495fa 339 SunOS*) $(MAKE) $(MFLAGS) pkg;; \
340 esac
ef416fc2 341
bd7854cb 342
ef416fc2 343#
31db8ded
MS
344# Don't run top-level build targets in parallel...
345#
346
347.NOTPARALLEL:
348
349
350#
f2d18633 351# End of "$Id$".
ef416fc2 352#