LGTM only supports C++ style comments...
[thirdparty/cups.git] / Makefile
CommitLineData
ef416fc2 1#
5a1d7a17 2# Top-level Makefile for CUPS.
ef416fc2 3#
f294fe22 4# Copyright © 2007-2019 by Apple Inc.
171c38f2 5# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 6#
171c38f2
MS
7# Licensed under Apache License v2.0. See the file "LICENSE" for more
8# information.
ef416fc2 9#
10
11include Makedefs
12
49d87452 13
ef416fc2 14#
15# Directories to make...
16#
17
171c38f2 18DIRS = cups $(BUILDDIRS)
bd7854cb 19
ef416fc2 20
feb13eea
MS
21#
22# Test suite options - normally blank, override with make command...
23#
24
25TESTOPTIONS =
26
27
ef416fc2 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... ;\
1f6f3dbc 44 (cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\
c9fc04c6
MS
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
d95bd167 103 $(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
0a682745 104 $(RM) cups-config
d95bd167
MS
105 $(RM) desktop/cups.desktop
106 $(RM) doc/index.html
f7deaa1a 107 $(RM) packaging/cups.list
352d5a7d 108 $(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 109 $(RM) templates/header.tmpl
a9252913 110 -$(RM) doc/*/index.html
a9252913 111 -$(RM) templates/*/header.tmpl
87030afb 112 -$(RM) -r autom4te*.cache 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
148d3699
MS
126#
127# Run the STACK tool on the sources, available here:
128#
129# http://css.csail.mit.edu/stack/
130#
131# Do the following to pass options to configure:
132#
133# make CONFIGFLAGS="--foo --bar" stack
134#
135
136.PHONY: stack
137stack:
138 stack-build ./configure $(CONFIGFLAGS)
139 stack-build $(MAKE) $(MFLAGS) clean all
140 poptck
141 $(MAKE) $(MFLAGS) distclean
142 $(RM) */*.ll
143 $(RM) */*.ll.out
144
145
b94498cf 146#
147# Generate a ctags file...
148#
149
150ctags:
151 ctags -R .
152
153
ef416fc2 154#
50fe7201 155# Install everything...
ef416fc2 156#
157
50fe7201
MS
158install: install-data install-headers install-libs install-exec
159
160
161#
162# Install data files...
163#
164
165install-data:
229681c1
MS
166 echo Making all in cups...
167 (cd cups; $(MAKE) $(MFLAGS) all)
ef416fc2 168 for dir in $(DIRS); do\
50fe7201
MS
169 echo Installing data files in $$dir... ;\
170 (cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
ef416fc2 171 done
ef416fc2 172 echo Installing cups-config script...
757d2cad 173 $(INSTALL_DIR) -m 755 $(BINDIR)
ef416fc2 174 $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
4d301e69 175
ef416fc2 176
50fe7201
MS
177#
178# Install header files...
179#
180
181install-headers:
182 for dir in $(DIRS); do\
183 echo Installing header files in $$dir... ;\
184 (cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
185 done
6bf37cc8
MS
186 if test "x$(privateinclude)" != x; then \
187 echo Installing config.h into $(PRIVATEINCLUDE)...; \
188 $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \
189 $(INSTALL_DATA) config.h $(PRIVATEINCLUDE)/config.h; \
190 fi
50fe7201 191
ef416fc2 192
193#
50fe7201 194# Install programs...
ef416fc2 195#
196
c9fc04c6 197install-exec: all
50fe7201
MS
198 for dir in $(DIRS); do\
199 echo Installing programs in $$dir... ;\
c9fc04c6 200 (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
50fe7201 201 done
ef416fc2 202
50fe7201
MS
203
204#
205# Install libraries...
206#
207
c9fc04c6 208install-libs: libs
50fe7201
MS
209 for dir in $(DIRS); do\
210 echo Installing libraries in $$dir... ;\
c9fc04c6 211 (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
50fe7201 212 done
ef416fc2 213
214
757d2cad 215#
216# Uninstall object and target files...
217#
218
219uninstall:
220 for dir in $(DIRS); do\
221 echo Uninstalling in $$dir... ;\
222 (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
223 done
224 echo Uninstalling cups-config script...
225 $(RM) $(BINDIR)/cups-config
226 -$(RMDIR) $(BINDIR)
757d2cad 227
228
ef416fc2 229#
230# Run the test suite...
231#
232
f11a948a 233test: all unittests
ef416fc2 234 echo Running CUPS test suite...
feb13eea 235 cd test; ./run-stp-tests.sh $(TESTOPTIONS)
ef416fc2 236
237
f11a948a 238check: all unittests
d09495fa 239 echo Running CUPS test suite with defaults...
85dda01c
MS
240 cd test; ./run-stp-tests.sh 1 0 n n
241
242debugcheck: all unittests
243 echo Running CUPS test suite with debug printfs...
244 cd test; ./run-stp-tests.sh 1 0 n y
d09495fa 245
246
f11a948a 247#
f294fe22 248# Create HTML documentation using codedoc (http://www.msweet.org/codedoc)...
f11a948a
MS
249#
250
251apihelp:
d825017a 252 for dir in cups filter; do\
f11a948a
MS
253 echo Generating API help in $$dir... ;\
254 (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
255 done
256
178cb736 257
84315f46
MS
258#
259# Lines of code computation...
260#
261
262sloc:
a4845881 263 for dir in cups scheduler; do \
84315f46
MS
264 (cd $$dir; $(MAKE) $(MFLAGS) sloc) || exit 1;\
265 done
266
267
ef416fc2 268#
9520743f 269# Make software distributions using EPM (http://www.msweet.org/)...
ef416fc2 270#
271
d09495fa 272EPMFLAGS = -v --output-dir dist $(EPMARCH)
ef416fc2 273
8072030b 274bsd deb epm pkg rpm slackware:
4744bd90 275 epm $(EPMFLAGS) -f $@ cups packaging/cups.list
ef416fc2 276
83bf1f7b 277.PHONY: dist
d09495fa 278dist: all
279 $(RM) -r dist
280 $(MAKE) $(MFLAGS) epm
281 case `uname` in \
282 *BSD*) $(MAKE) $(MFLAGS) bsd;; \
97c9a8d7 283 Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
d09495fa 284 SunOS*) $(MAKE) $(MFLAGS) pkg;; \
285 esac
ef416fc2 286
bd7854cb 287
ef416fc2 288#
31db8ded
MS
289# Don't run top-level build targets in parallel...
290#
291
292.NOTPARALLEL: