Imported Upstream version 2.2.6
[platform/upstream/cups.git] / Makefile
1 #
2 # Top-level Makefile for CUPS.
3 #
4 # Copyright 2007-2016 by Apple Inc.
5 # Copyright 1997-2007 by Easy Software Products, all rights reserved.
6 #
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/".
12 #
13
14 include Makedefs
15
16
17 #
18 # Directories to make...
19 #
20
21 DIRS    =       cups test $(BUILDDIRS)
22
23
24 #
25 # Make all targets...
26 #
27
28 all:
29         chmod +x cups-config
30         echo Using ARCHFLAGS="$(ARCHFLAGS)"
31         echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
32         echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
33         echo Using CC="$(CC)"
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;\
41         done
42
43
44 #
45 # Make library targets...
46 #
47
48 libs:
49         echo Using ARCHFLAGS="$(ARCHFLAGS)"
50         echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
51         echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
52         echo Using CC="$(CC)"
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;\
60         done
61
62
63 #
64 # Make unit test targets...
65 #
66
67 unittests:
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
82 #
83 # Remove object and target files...
84 #
85
86 clean:
87         for dir in $(DIRS); do\
88                 echo Cleaning in $$dir... ;\
89                 (cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
90         done
91
92
93 #
94 # Remove all non-distribution files...
95 #
96
97 distclean:      clean
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
100         $(RM) cups-config
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
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
111
112
113 #
114 # Make dependencies
115 #
116
117 depend:
118         for dir in $(DIRS); do\
119                 echo Making dependencies in $$dir... ;\
120                 (cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
121         done
122
123
124 #
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.
130 #
131 # Alternatively, use "--analyze -Xanalyzer -analyzer-output=text" for OPTIM (text
132 # output instead of HTML...)
133 #
134
135 .PHONY: clang clang-changes
136 clang:
137         $(RM) -r clang
138         scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) clean all
139 clang-changes:
140         scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) all
141
142
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
154 stack:
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
163 #
164 # Generate a ctags file...
165 #
166
167 ctags:
168         ctags -R .
169
170
171 #
172 # Install everything...
173 #
174
175 install:        install-data install-headers install-libs install-exec
176
177
178 #
179 # Install data files...
180 #
181
182 install-data:
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;\
188         done
189         echo Installing cups-config script...
190         $(INSTALL_DIR) -m 755 $(BINDIR)
191         $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
192
193
194 #
195 # Install header files...
196 #
197
198 install-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
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; \
207         fi
208
209
210 #
211 # Install programs...
212 #
213
214 install-exec:   all
215         for dir in $(DIRS); do\
216                 echo Installing programs in $$dir... ;\
217                 (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
218         done
219
220
221 #
222 # Install libraries...
223 #
224
225 install-libs:   libs
226         for dir in $(DIRS); do\
227                 echo Installing libraries in $$dir... ;\
228                 (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
229         done
230
231
232 #
233 # Uninstall object and target files...
234 #
235
236 uninstall:
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)
244
245
246 #
247 # Run the test suite...
248 #
249
250 test:   all unittests
251         echo Running CUPS test suite...
252         cd test; ./run-stp-tests.sh
253
254
255 check:  all unittests
256         echo Running CUPS test suite with defaults...
257         cd test; ./run-stp-tests.sh 1 0 n n
258
259 debugcheck:     all unittests
260         echo Running CUPS test suite with debug printfs...
261         cd test; ./run-stp-tests.sh 1 0 n y
262
263
264 #
265 # Create HTML documentation using Mini-XML's mxmldoc (http://www.msweet.org/)...
266 #
267
268 apihelp:
269         for dir in cups filter; do\
270                 echo Generating API help in $$dir... ;\
271                 (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
272         done
273
274
275 #
276 # Create an Xcode docset using Mini-XML's mxmldoc (http://www.msweet.org/)...
277 #
278
279 docset: apihelp
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 \
298                 org.cups.docset
299
300
301 #
302 # Lines of code computation...
303 #
304
305 sloc:
306         for dir in cups scheduler; do \
307                 (cd $$dir; $(MAKE) $(MFLAGS) sloc) || exit 1;\
308         done
309
310
311 #
312 # Make software distributions using EPM (http://www.msweet.org/)...
313 #
314
315 EPMFLAGS        =       -v --output-dir dist $(EPMARCH)
316
317 bsd deb epm pkg rpm slackware:
318         epm $(EPMFLAGS) -f $@ cups packaging/cups.list
319
320 .PHONY: dist
321 dist:   all
322         $(RM) -r dist
323         $(MAKE) $(MFLAGS) epm
324         case `uname` in \
325                 *BSD*) $(MAKE) $(MFLAGS) bsd;; \
326                 Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
327                 SunOS*) $(MAKE) $(MFLAGS) pkg;; \
328         esac
329
330
331 #
332 # Don't run top-level build targets in parallel...
333 #
334
335 .NOTPARALLEL: