1# 2# Top-level Makefile for CUPS. 3# 4# Copyright © 2020-2023 by OpenPrinting 5# Copyright © 2007-2019 by Apple Inc. 6# Copyright © 1997-2007 by Easy Software Products, all rights reserved. 7# 8# Licensed under Apache License v2.0. See the file "LICENSE" for more 9# information. 10# 11 12include Makedefs 13 14 15# 16# Directories to make... 17# 18 19DIRS = cups $(BUILDDIRS) 20 21 22# 23# Test suite options - normally blank, override with make command... 24# 25 26TESTOPTIONS = 27 28 29# 30# Make all targets... 31# 32 33all: 34 chmod +x cups-config 35 echo Using ARCHFLAGS="$(ARCHFLAGS)" 36 echo Using ALL_CFLAGS="$(ALL_CFLAGS)" 37 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)" 38 echo Using CC="$(CC)" 39 echo Using CXX="$(CC)" 40 echo Using DSOFLAGS="$(DSOFLAGS)" 41 echo Using LDFLAGS="$(LDFLAGS)" 42 echo Using LIBS="$(LIBS)" 43 for dir in $(DIRS); do\ 44 echo Making all in $$dir... ;\ 45 (cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\ 46 done 47 48 49# 50# Make library targets... 51# 52 53libs: 54 echo Using ARCHFLAGS="$(ARCHFLAGS)" 55 echo Using ALL_CFLAGS="$(ALL_CFLAGS)" 56 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)" 57 echo Using CC="$(CC)" 58 echo Using CXX="$(CC)" 59 echo Using DSOFLAGS="$(DSOFLAGS)" 60 echo Using LDFLAGS="$(LDFLAGS)" 61 echo Using LIBS="$(LIBS)" 62 for dir in $(DIRS); do\ 63 echo Making libraries in $$dir... ;\ 64 (cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\ 65 done 66 67 68# 69# Make unit test targets... 70# 71 72unittests: 73 echo Using ARCHFLAGS="$(ARCHFLAGS)" 74 echo Using ALL_CFLAGS="$(ALL_CFLAGS)" 75 echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)" 76 echo Using CC="$(CC)" 77 echo Using CXX="$(CC)" 78 echo Using DSOFLAGS="$(DSOFLAGS)" 79 echo Using LDFLAGS="$(LDFLAGS)" 80 echo Using LIBS="$(LIBS)" 81 for dir in $(DIRS); do\ 82 echo Making all in $$dir... ;\ 83 (cd $$dir ; $(MAKE) $(MFLAGS) unittests) || exit 1;\ 84 done 85 86 87# 88# Remove object and target files... 89# 90 91clean: 92 for dir in $(DIRS); do\ 93 echo Cleaning in $$dir... ;\ 94 (cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\ 95 done 96 97 98# 99# Remove all non-distribution files... 100# 101 102distclean: clean 103 $(RM) Makedefs config.h config.log config.status 104 $(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf 105 $(RM) cups-config 106 $(RM) cups.pc 107 $(RM) desktop/cups.desktop 108 $(RM) doc/index.html 109 $(RM) packaging/cups.list 110 $(RM) scheduler/cups-lpd.xinetd scheduler/cups.sh scheduler/cups.xml scheduler/org.cups.cups-lpd.plist scheduler/cups-lpdAT.service scheduler/cups.path scheduler/cups.service scheduler/cups.socket 111 $(RM) templates/header.tmpl 112 -$(RM) doc/*/index.html 113 -$(RM) templates/*/header.tmpl 114 -$(RM) -r autom4te*.cache cups/charmaps cups/locale 115 116 117# 118# Make dependencies 119# 120 121depend: 122 for dir in $(DIRS); do\ 123 echo Making dependencies in $$dir... ;\ 124 (cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\ 125 done 126 127 128# 129# Run the STACK tool on the sources, available here: 130# 131# http://css.csail.mit.edu/stack/ 132# 133# Do the following to pass options to configure: 134# 135# make CONFIGFLAGS="--foo --bar" stack 136# 137 138.PHONY: stack 139stack: 140 stack-build ./configure $(CONFIGFLAGS) 141 stack-build $(MAKE) $(MFLAGS) clean all 142 poptck 143 $(MAKE) $(MFLAGS) distclean 144 $(RM) */*.ll 145 $(RM) */*.ll.out 146 147 148# 149# Generate a ctags file... 150# 151 152ctags: 153 ctags -R . 154 155 156# 157# Install everything... 158# 159 160install: install-data install-headers install-libs install-exec 161 162 163# 164# Install data files... 165# 166 167install-data: 168 echo Making all in cups... 169 (cd cups; $(MAKE) $(MFLAGS) all) 170 for dir in $(DIRS); do\ 171 echo Installing data files in $$dir... ;\ 172 (cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\ 173 done 174 echo Installing cups-config script... 175 $(INSTALL_DIR) -m 755 $(BINDIR) 176 $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config 177 echo Installing cups.pc file... 178 $(INSTALL_DIR) -m 755 $(CUPS_PKGCONFPATH) 179 $(INSTALL_DATA) cups.pc $(CUPS_PKGCONFPATH)/cups.pc 180 181 182# 183# Install header files... 184# 185 186install-headers: 187 for dir in $(DIRS); do\ 188 echo Installing header files in $$dir... ;\ 189 (cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\ 190 done 191 if test "x$(privateinclude)" != x; then \ 192 echo Installing config.h into $(PRIVATEINCLUDE)...; \ 193 $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \ 194 $(INSTALL_DATA) config.h $(PRIVATEINCLUDE)/config.h; \ 195 fi 196 197 198# 199# Install programs... 200# 201 202install-exec: all 203 for dir in $(DIRS); do\ 204 echo Installing programs in $$dir... ;\ 205 (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\ 206 done 207 208 209# 210# Install libraries... 211# 212 213install-libs: libs 214 for dir in $(DIRS); do\ 215 echo Installing libraries in $$dir... ;\ 216 (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\ 217 done 218 219 220# 221# Uninstall object and target files... 222# 223 224uninstall: 225 for dir in $(DIRS); do\ 226 echo Uninstalling in $$dir... ;\ 227 (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\ 228 done 229 echo Uninstalling cups-config script... 230 $(RM) $(BINDIR)/cups-config 231 -$(RMDIR) $(BINDIR) 232 echo Uninstalling cups.pc file... 233 $(RM) $(CUPS_PKGCONFPATH)/cups.pc 234 -$(RMDIR) $(CUPS_PKGCONFPATH) 235 236 237# 238# Run the test suite... 239# 240 241testserver: all unittests 242 echo Running CUPS test server... 243 cd test; ./run-stp-tests.sh $(TESTOPTIONS) 244 245 246check test: all unittests 247 echo Running CUPS test suite... 248 cd test; ./run-stp-tests.sh 1 0 n n 249 250debugcheck debugtest: all unittests 251 echo Running CUPS test suite with debug printfs... 252 cd test; ./run-stp-tests.sh 1 0 n y 253 254 255# 256# Create HTML documentation using codedoc (http://www.msweet.org/codedoc)... 257# 258 259apihelp: 260 for dir in cups filter; do\ 261 echo Generating API help in $$dir... ;\ 262 (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\ 263 done 264 265 266# 267# Lines of code computation... 268# 269 270sloc: 271 for dir in cups scheduler; do \ 272 (cd $$dir; $(MAKE) $(MFLAGS) sloc) || exit 1;\ 273 done 274 275 276# 277# Make software distributions using EPM (http://www.msweet.org/)... 278# 279 280EPMFLAGS = -v --output-dir dist $(EPMARCH) 281 282bsd deb epm pkg rpm slackware: 283 epm $(EPMFLAGS) -f $@ cups packaging/cups.list 284 285.PHONY: dist 286dist: all 287 $(RM) -r dist 288 $(MAKE) $(MFLAGS) epm 289 case `uname` in \ 290 *BSD*) $(MAKE) $(MFLAGS) bsd;; \ 291 Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \ 292 SunOS*) $(MAKE) $(MFLAGS) pkg;; \ 293 esac 294 295 296# 297# Don't run top-level build targets in parallel... 298# 299 300.NOTPARALLEL: 301