OK, allow DESTDIR to be used as a default BUILDROOT, much like we do for
[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
21#
22# Make all targets...
23#
24
25all:
26 chmod +x cups-config
c9fc04c6 27 echo Using ARCHFLAGS="$(ARCHFLAGS)"
ac884b6a
MS
28 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
29 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
5f64df29
MS
30 echo Using CC="$(CC)"
31 echo Using CXX="$(CC)"
c9fc04c6 32 echo Using DSOFLAGS="$(DSOFLAGS)"
ac884b6a
MS
33 echo Using LDFLAGS="$(LDFLAGS)"
34 echo Using LIBS="$(LIBS)"
ef416fc2 35 for dir in $(DIRS); do\
36 echo Making all in $$dir... ;\
1f6f3dbc 37 (cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\
c9fc04c6
MS
38 done
39
40
41#
42# Make library targets...
43#
44
45libs:
46 echo Using ARCHFLAGS="$(ARCHFLAGS)"
47 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
48 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
5f64df29
MS
49 echo Using CC="$(CC)"
50 echo Using CXX="$(CC)"
c9fc04c6
MS
51 echo Using DSOFLAGS="$(DSOFLAGS)"
52 echo Using LDFLAGS="$(LDFLAGS)"
53 echo Using LIBS="$(LIBS)"
54 for dir in $(DIRS); do\
8922323b 55 echo Making libraries in $$dir... ;\
c9fc04c6 56 (cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\
ef416fc2 57 done
58
bd7854cb 59
5f64df29
MS
60#
61# Make unit test targets...
62#
63
64unittests:
65 echo Using ARCHFLAGS="$(ARCHFLAGS)"
66 echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
67 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
68 echo Using CC="$(CC)"
69 echo Using CXX="$(CC)"
70 echo Using DSOFLAGS="$(DSOFLAGS)"
71 echo Using LDFLAGS="$(LDFLAGS)"
72 echo Using LIBS="$(LIBS)"
73 for dir in $(DIRS); do\
74 echo Making all in $$dir... ;\
75 (cd $$dir ; $(MAKE) $(MFLAGS) unittests) || exit 1;\
76 done
77
78
ef416fc2 79#
80# Remove object and target files...
81#
82
83clean:
84 for dir in $(DIRS); do\
85 echo Cleaning in $$dir... ;\
86 (cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
87 done
88
bd7854cb 89
a9252913 90#
91# Remove all non-distribution files...
92#
93
94distclean: clean
95 $(RM) Makedefs config.h config.log config.status
d95bd167 96 $(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
0a682745 97 $(RM) cups-config
d95bd167
MS
98 $(RM) data/testprint
99 $(RM) desktop/cups.desktop
100 $(RM) doc/index.html
101 $(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 102 $(RM) packaging/cups.list
352d5a7d 103 $(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 104 $(RM) templates/header.tmpl
a9252913 105 -$(RM) doc/*/index.html
a9252913 106 -$(RM) templates/*/header.tmpl
d95bd167 107 -$(RM) -r autom4te*.cache clang cups/charmaps cups/locale
a9252913 108
109
ef416fc2 110#
111# Make dependencies
112#
113
114depend:
115 for dir in $(DIRS); do\
116 echo Making dependencies in $$dir... ;\
117 (cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
118 done
119
120
1f0275e3 121#
148d3699
MS
122# Run the Clang static code analysis tool on the sources, available here:
123#
124# http://clang-analyzer.llvm.org
125#
126# At least checker-231 is required.
1f0275e3 127#
95ece0cb
MS
128# Alternatively, use "--analyze -Xanalyzer -analyzer-output=text" for OPTIM (text
129# output instead of HTML...)
130#
1f0275e3 131
f8b3a85b 132.PHONY: clang clang-changes
1f0275e3 133clang:
c5571a1d 134 $(RM) -r clang
41681883 135 scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) clean all
f8b3a85b
MS
136clang-changes:
137 scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) all
1f0275e3
MS
138
139
148d3699
MS
140#
141# Run the STACK tool on the sources, available here:
142#
143# http://css.csail.mit.edu/stack/
144#
145# Do the following to pass options to configure:
146#
147# make CONFIGFLAGS="--foo --bar" stack
148#
149
150.PHONY: stack
151stack:
152 stack-build ./configure $(CONFIGFLAGS)
153 stack-build $(MAKE) $(MFLAGS) clean all
154 poptck
155 $(MAKE) $(MFLAGS) distclean
156 $(RM) */*.ll
157 $(RM) */*.ll.out
158
159
b94498cf 160#
161# Generate a ctags file...
162#
163
164ctags:
165 ctags -R .
166
167
ef416fc2 168#
50fe7201 169# Install everything...
ef416fc2 170#
171
50fe7201
MS
172install: install-data install-headers install-libs install-exec
173
174
175#
176# Install data files...
177#
178
179install-data:
229681c1
MS
180 echo Making all in cups...
181 (cd cups; $(MAKE) $(MFLAGS) all)
ef416fc2 182 for dir in $(DIRS); do\
50fe7201
MS
183 echo Installing data files in $$dir... ;\
184 (cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
ef416fc2 185 done
ef416fc2 186 echo Installing cups-config script...
757d2cad 187 $(INSTALL_DIR) -m 755 $(BINDIR)
ef416fc2 188 $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
4d301e69 189
ef416fc2 190
50fe7201
MS
191#
192# Install header files...
193#
194
195install-headers:
196 for dir in $(DIRS); do\
197 echo Installing header files in $$dir... ;\
198 (cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
199 done
200
ef416fc2 201
202#
50fe7201 203# Install programs...
ef416fc2 204#
205
c9fc04c6 206install-exec: all
50fe7201
MS
207 for dir in $(DIRS); do\
208 echo Installing programs in $$dir... ;\
c9fc04c6 209 (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
50fe7201 210 done
ef416fc2 211
50fe7201
MS
212
213#
214# Install libraries...
215#
216
c9fc04c6 217install-libs: libs
50fe7201
MS
218 for dir in $(DIRS); do\
219 echo Installing libraries in $$dir... ;\
c9fc04c6 220 (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
50fe7201 221 done
ef416fc2 222
223
757d2cad 224#
225# Uninstall object and target files...
226#
227
228uninstall:
229 for dir in $(DIRS); do\
230 echo Uninstalling in $$dir... ;\
231 (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
232 done
233 echo Uninstalling cups-config script...
234 $(RM) $(BINDIR)/cups-config
235 -$(RMDIR) $(BINDIR)
757d2cad 236
237
ef416fc2 238#
239# Run the test suite...
240#
241
f11a948a 242test: all unittests
ef416fc2 243 echo Running CUPS test suite...
244 cd test; ./run-stp-tests.sh
245
246
f11a948a 247check: all unittests
d09495fa 248 echo Running CUPS test suite with defaults...
85dda01c
MS
249 cd test; ./run-stp-tests.sh 1 0 n n
250
251debugcheck: all unittests
252 echo Running CUPS test suite with debug printfs...
253 cd test; ./run-stp-tests.sh 1 0 n y
d09495fa 254
255
f11a948a 256#
f294fe22 257# Create HTML documentation using codedoc (http://www.msweet.org/codedoc)...
f11a948a
MS
258#
259
260apihelp:
d825017a 261 for dir in cups filter; do\
f11a948a
MS
262 echo Generating API help in $$dir... ;\
263 (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
264 done
265
178cb736 266
84315f46
MS
267#
268# Lines of code computation...
269#
270
271sloc:
a4845881 272 for dir in cups scheduler; do \
84315f46
MS
273 (cd $$dir; $(MAKE) $(MFLAGS) sloc) || exit 1;\
274 done
275
276
ef416fc2 277#
9520743f 278# Make software distributions using EPM (http://www.msweet.org/)...
ef416fc2 279#
280
d09495fa 281EPMFLAGS = -v --output-dir dist $(EPMARCH)
ef416fc2 282
8072030b 283bsd deb epm pkg rpm slackware:
4744bd90 284 epm $(EPMFLAGS) -f $@ cups packaging/cups.list
ef416fc2 285
83bf1f7b 286.PHONY: dist
d09495fa 287dist: all
288 $(RM) -r dist
289 $(MAKE) $(MFLAGS) epm
290 case `uname` in \
291 *BSD*) $(MAKE) $(MFLAGS) bsd;; \
97c9a8d7 292 Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
d09495fa 293 SunOS*) $(MAKE) $(MFLAGS) pkg;; \
294 esac
ef416fc2 295
bd7854cb 296
ef416fc2 297#
31db8ded
MS
298# Don't run top-level build targets in parallel...
299#
300
301.NOTPARALLEL: