2 # Top-level Makefile for CUPS.
4 # Copyright 2007-2016 by Apple Inc.
5 # Copyright 1997-2007 by Easy Software Products, all rights reserved.
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 # missing or damaged, see the license at "http://www.cups.org/".
18 # Directories to make...
21 DIRS = cups test $(BUILDDIRS)
30 echo Using ARCHFLAGS="$(ARCHFLAGS)"
31 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
32 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
34 echo Using CXX="$(CC)"
35 echo Using DSOFLAGS="$(DSOFLAGS)"
36 echo Using LDFLAGS="$(LDFLAGS)"
37 echo Using LIBS="$(LIBS)"
38 for dir in $(DIRS); do\
39 echo Making all in $$dir... ;\
40 (cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\
45 # Make library targets...
49 echo Using ARCHFLAGS="$(ARCHFLAGS)"
50 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
51 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
53 echo Using CXX="$(CC)"
54 echo Using DSOFLAGS="$(DSOFLAGS)"
55 echo Using LDFLAGS="$(LDFLAGS)"
56 echo Using LIBS="$(LIBS)"
57 for dir in $(DIRS); do\
58 echo Making libraries in $$dir... ;\
59 (cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\
64 # Make unit test targets...
68 echo Using ARCHFLAGS="$(ARCHFLAGS)"
69 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
70 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
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;\
83 # Remove object and target files...
87 for dir in $(DIRS); do\
88 echo Cleaning in $$dir... ;\
89 (cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
94 # Remove all non-distribution files...
98 $(RM) Makedefs config.h config.log config.status
99 $(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
102 $(RM) desktop/cups.desktop
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
105 $(RM) packaging/cups.list
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
107 $(RM) templates/header.tmpl
108 -$(RM) doc/*/index.html
109 -$(RM) templates/*/header.tmpl
110 -$(RM) -r autom4te*.cache clang cups/charmaps cups/locale
118 for dir in $(DIRS); do\
119 echo Making dependencies in $$dir... ;\
120 (cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
125 # Run the Clang static code analysis tool on the sources, available here:
127 # http://clang-analyzer.llvm.org
129 # At least checker-231 is required.
131 # Alternatively, use "--analyze -Xanalyzer -analyzer-output=text" for OPTIM (text
132 # output instead of HTML...)
135 .PHONY: clang clang-changes
138 scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) clean all
140 scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) all
144 # Run the STACK tool on the sources, available here:
146 # http://css.csail.mit.edu/stack/
148 # Do the following to pass options to configure:
150 # make CONFIGFLAGS="--foo --bar" stack
155 stack-build ./configure $(CONFIGFLAGS)
156 stack-build $(MAKE) $(MFLAGS) clean all
158 $(MAKE) $(MFLAGS) distclean
164 # Generate a ctags file...
172 # Install everything...
175 install: install-data install-headers install-libs install-exec
179 # Install data files...
183 echo Making all in cups...
184 (cd cups; $(MAKE) $(MFLAGS) all)
185 for dir in $(DIRS); do\
186 echo Installing data files in $$dir... ;\
187 (cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
189 echo Installing cups-config script...
190 $(INSTALL_DIR) -m 755 $(BINDIR)
191 $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
195 # Install header files...
199 for dir in $(DIRS); do\
200 echo Installing header files in $$dir... ;\
201 (cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
203 if test "x$(privateinclude)" != x; then \
204 echo Installing config.h into $(PRIVATEINCLUDE)...; \
205 $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \
206 $(INSTALL_DATA) config.h $(PRIVATEINCLUDE)/config.h; \
211 # Install programs...
215 for dir in $(DIRS); do\
216 echo Installing programs in $$dir... ;\
217 (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
222 # Install libraries...
226 for dir in $(DIRS); do\
227 echo Installing libraries in $$dir... ;\
228 (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
233 # Uninstall object and target files...
237 for dir in $(DIRS); do\
238 echo Uninstalling in $$dir... ;\
239 (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
241 echo Uninstalling cups-config script...
242 $(RM) $(BINDIR)/cups-config
247 # Run the test suite...
251 echo Running CUPS test suite...
252 cd test; ./run-stp-tests.sh
256 echo Running CUPS test suite with defaults...
257 cd test; ./run-stp-tests.sh 1 0 n n
259 debugcheck: all unittests
260 echo Running CUPS test suite with debug printfs...
261 cd test; ./run-stp-tests.sh 1 0 n y
265 # Create HTML documentation using Mini-XML's mxmldoc (http://www.msweet.org/)...
269 for dir in cups filter; do\
270 echo Generating API help in $$dir... ;\
271 (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
276 # Create an Xcode docset using Mini-XML's mxmldoc (http://www.msweet.org/)...
280 echo Generating docset directory tree...
281 $(RM) -r org.cups.docset
282 mkdir -p org.cups.docset/Contents/Resources/Documentation/help
283 mkdir -p org.cups.docset/Contents/Resources/Documentation/images
284 cd man; $(MAKE) $(MFLAGS) html
285 cd doc; $(MAKE) $(MFLAGS) docset
286 cd cgi-bin; $(MAKE) $(MFLAGS) makedocset
287 cgi-bin/makedocset org.cups.docset \
288 `svnversion . | sed -e '1,$$s/[a-zA-Z]//g'` \
289 doc/help/api-*.tokens
290 $(RM) doc/help/api-*.tokens
291 echo Indexing docset...
292 /Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil index org.cups.docset
293 echo Generating docset archive and feed...
294 $(RM) org.cups.docset.atom
295 /Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
296 --atom org.cups.docset.atom \
297 --download-url http://www.cups.org/org.cups.docset.xar \
302 # Lines of code computation...
306 for dir in cups scheduler; do \
307 (cd $$dir; $(MAKE) $(MFLAGS) sloc) || exit 1;\
312 # Make software distributions using EPM (http://www.msweet.org/)...
315 EPMFLAGS = -v --output-dir dist $(EPMARCH)
317 bsd deb epm pkg rpm slackware:
318 epm $(EPMFLAGS) -f $@ cups packaging/cups.list
323 $(MAKE) $(MFLAGS) epm
325 *BSD*) $(MAKE) $(MFLAGS) bsd;; \
326 Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
327 SunOS*) $(MAKE) $(MFLAGS) pkg;; \
332 # Don't run top-level build targets in parallel...