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