scc-make.man (9103B)
1 .TH SCC-MAKE 1 scc\-VERSION 2 .SH NAME 3 scc-make \- maintain program dependencies 4 .SH SYNOPSIS 5 .B scc-make 6 .RB [ \-eiknprSstd ] 7 .RB [ \-f 8 .IR file ] 9 .RB [ \-j 10 .IR jobs ] 11 .RI [ macro = value 12 \&...] 13 .RI [ target 14 \&...] 15 .SH DESCRIPTION 16 .B scc-make 17 updates files derived from other files. 18 It reads a description file (the makefile) that specifies how targets 19 are built from their prerequisites, 20 and rebuilds only those targets whose prerequisites have changed since 21 the last build. 22 .PP 23 .B scc-make 24 conforms to the IEEE Std 1003.1\-2018 (POSIX.1) specification for the 25 .BR make 26 utility. 27 .PP 28 On startup, 29 .B scc-make 30 reads the 31 .B MAKEFLAGS 32 environment variable and applies any flags found there. 33 Command-line flags are then processed, 34 followed by the makefile. 35 If no 36 .B \-f 37 option is given, 38 .B scc-make 39 tries to open 40 .I makefile 41 and then 42 .I Makefile 43 in the current directory. 44 If no targets are specified on the command line, 45 the first non-special target defined in the makefile is built. 46 .SH OPTIONS 47 .TP 48 .B \-e 49 Environment variables override macro definitions in the makefile. 50 By default, macro definitions in the makefile take precedence over 51 the environment. 52 .B SHELL 53 and 54 .B MAKEFLAGS 55 are never taken from the environment regardless of this flag. 56 .TP 57 .BI \-f " file" 58 Use 59 .I file 60 as the makefile. 61 If 62 .I file 63 is 64 .BR \- , 65 standard input is read. 66 This option may be specified multiple times; 67 each file is read in order. 68 .TP 69 .B \-i 70 Ignore non-zero exit status from commands. 71 Equivalent to specifying 72 .B \- 73 before each command line in the makefile. 74 .TP 75 .BI \-j " jobs" 76 Accepted for compatibility; parallel execution is not implemented. 77 .TP 78 .B \-k 79 Continue building other targets even if an error occurs, 80 as long as they do not depend on the failed target. 81 .TP 82 .B \-n 83 Print commands without executing them. 84 Commands prefixed with 85 .B + 86 are still executed. 87 .TP 88 .B \-p 89 Print all macro definitions and rules to standard output, then exit. 90 .TP 91 .B \-q 92 Query mode. 93 Exit 0 if all specified targets are up to date, non-zero otherwise. 94 No commands are executed. 95 .TP 96 .B \-r 97 Clear the default suffix list. 98 Equivalent to a 99 .B .SUFFIXES: 100 rule with no prerequisites. 101 Default inference rules remain but are not reachable without suffixes. 102 .TP 103 .B \-S 104 Stop on error. 105 This is the default behaviour and is used to cancel a previous 106 .B \-k 107 flag inherited via 108 .BR MAKEFLAGS . 109 .TP 110 .B \-s 111 Silent mode. 112 Do not echo commands before executing them. 113 Equivalent to specifying 114 .B @ 115 before each command line in the makefile. 116 .TP 117 .B \-t 118 Touch mode. 119 Touch targets and their prerequisites instead of running commands, 120 marking them as up to date. 121 Commands prefixed with 122 .B + 123 are still executed. 124 .TP 125 .B \-d 126 Debug mode. 127 Print diagnostic messages describing the decisions 128 .B scc-make 129 makes while processing targets. 130 .SH MAKEFILE SYNTAX 131 A makefile consists of macro definitions, rules, and 132 .B include 133 directives. 134 Comments begin with 135 .B # 136 and extend to the end of the line. 137 A backslash at the end of a line continues it on the next line. 138 .SS Macro Definitions 139 Macros are defined with: 140 .IP 141 .EX 142 name = value 143 .EE 144 .PP 145 Macro values may span multiple lines by ending each continued line 146 with a backslash. 147 Macro definitions in the makefile take precedence over the environment 148 unless 149 .B \-e 150 is given. 151 Command-line macro assignments always take precedence over both. 152 .PP 153 Macros are expanded by writing: 154 .TP 155 .BI $( name ) 156 or 157 .BI ${ name } 158 Expand the macro named 159 .IR name . 160 .TP 161 .BI $ x 162 Expand the single-character macro 163 .IR x . 164 .TP 165 .B $$ 166 A literal dollar sign. 167 .PP 168 The substitution form 169 .BI $( name : old = new ) 170 expands macro 171 .I name 172 replacing each word that ends in 173 .I old 174 with the same word but ending in 175 .I new 176 instead. 177 .SS Rules 178 Rules define how to build targets from prerequisites: 179 .IP 180 .EX 181 target ... : prerequisite ... 182 command 183 command 184 .EE 185 .PP 186 Each command line must begin with a tab character. 187 A command may also appear on the rule line itself, separated by a semicolon. 188 Commands are passed to the shell specified by the 189 .B SHELL 190 macro 191 .RB ( /bin/sh 192 by default). 193 .PP 194 A command line may be prefixed with one or more of: 195 .TP 196 .B @ 197 Do not echo the command before executing it. 198 .TP 199 .B \- 200 Ignore a non-zero exit status from this command. 201 .TP 202 .B + 203 Execute this command even when 204 .BR \-n , 205 .BR \-q , 206 or 207 .B \-t 208 is given. 209 .SS Internal Macros 210 The following macros are set automatically when a rule is executed: 211 .TP 212 .B $@ 213 The name of the current target. 214 .TP 215 .B $< 216 The name of the first prerequisite (the implicit prerequisite in 217 inference rules). 218 .TP 219 .B $* 220 The stem of the current target: the target name with its suffix removed. 221 .TP 222 .B $? 223 The list of prerequisites that are newer than the current target. 224 .SS Inference Rules 225 Inference rules define how to transform a file of one suffix to a file 226 of another. 227 They have the form: 228 .IP 229 .EX 230 \&.from.to: 231 command 232 .EE 233 .PP 234 For an inference rule 235 .I .from.to 236 to apply, 237 both suffixes must appear in the 238 .B .SUFFIXES 239 list. 240 .B scc-make 241 searches the suffix list in order to find a matching rule whose 242 prerequisite exists on disk. 243 .SS Include Directive 244 A line of the form: 245 .IP 246 .EX 247 include file 248 .EE 249 .PP 250 causes 251 .B scc-make 252 to read and process 253 .I file 254 at that point. 255 Macro expansions are performed on the filename. 256 .SH SPECIAL TARGETS 257 .TP 258 .B .SUFFIXES 259 Defines the list of recognized suffixes used to search for inference 260 rules. 261 An empty 262 .B .SUFFIXES: 263 rule (no prerequisites) clears the list. 264 Multiple 265 .B .SUFFIXES 266 rules are cumulative. 267 .TP 268 .B .DEFAULT 269 Commands associated with this target are run for any target that has 270 no explicit rule and no applicable inference rule. 271 .TP 272 .B .PRECIOUS 273 Prerequisites listed for this target are not deleted if 274 .B scc-make 275 is interrupted by a signal. 276 .TP 277 .B .SILENT 278 When specified without prerequisites, enables silent mode globally. 279 When listed with prerequisites, commands for those targets are not echoed. 280 .TP 281 .B .IGNORE 282 When specified without prerequisites, errors from all commands are ignored. 283 When listed with prerequisites, errors from those targets are ignored. 284 .SH DEFAULT MACROS 285 .B scc-make 286 defines the following macros by default. 287 They can be overridden in the makefile or on the command line. 288 .TP 289 .B AR 290 Archive program (default: 291 .BR ar ). 292 .TP 293 .B ARFLAGS 294 Flags for 295 .B AR 296 (default: 297 .BR \-rv ). 298 .TP 299 .B CC 300 C compiler (default: 301 .BR c99 ). 302 .TP 303 .B CFLAGS 304 Flags for 305 .B CC 306 (default: 307 .BR \-O1 ). 308 .TP 309 .B FC 310 Fortran compiler (default: 311 .BR fort77 ). 312 .TP 313 .B FFLAGS 314 Flags for 315 .B FC 316 (default: 317 .BR \-O1 ). 318 .TP 319 .B LDFLAGS 320 Flags for the linker (default: empty). 321 .TP 322 .B LEX 323 Lexical analyser generator (default: 324 .BR lex ). 325 .TP 326 .B LFLAGS 327 Flags for 328 .B LEX 329 (default: empty). 330 .TP 331 .B YACC 332 Parser generator (default: 333 .BR yacc ). 334 .TP 335 .B YFLAGS 336 Flags for 337 .B YACC 338 (default: empty). 339 .TP 340 .B SHELL 341 Shell used to run commands (default: 342 .BR /bin/sh ). 343 This macro is never taken from the environment. 344 .TP 345 .B MAKE 346 Set to the path used to invoke 347 .BR scc-make . 348 .TP 349 .B MAKEFLAGS 350 Contains the set of flags in effect. 351 Updated as flags are processed so that recursive 352 .B scc-make 353 invocations inherit them. 354 .SH DEFAULT INFERENCE RULES 355 The following inference rules are built in: 356 .TP 357 .B .c: 358 Compile a C source file to an executable using 359 .BR CC . 360 .TP 361 .B .f: 362 Compile a Fortran source file to an executable using 363 .BR FC . 364 .TP 365 .B .sh: 366 Copy a shell script to the target and make it executable. 367 .TP 368 .B .c.o: 369 Compile a C source file to an object file using 370 .BR CC . 371 .TP 372 .B .f.o: 373 Compile a Fortran source file to an object file using 374 .BR FC . 375 .TP 376 .B .y.o: 377 Run 378 .B yacc 379 on the source file, compile the result, and remove the intermediate files. 380 .TP 381 .B .l.o: 382 Run 383 .B lex 384 on the source file, compile the result, and remove the intermediate files. 385 .TP 386 .B .y.c: 387 Run 388 .B yacc 389 on the source file and rename the result. 390 .TP 391 .B .l.c: 392 Run 393 .B lex 394 on the source file and rename the result. 395 .TP 396 .B .c.a: 397 Compile a C source file and add the object to an archive. 398 .TP 399 .B .f.a: 400 Compile a Fortran source file and add the object to an archive. 401 .SH ENVIRONMENT VARIABLES 402 .TP 403 .B MAKEFLAGS 404 Flags read by 405 .B scc-make 406 at startup, before command-line processing. 407 The value may be a plain flag string (e.g. 408 .BR eks ) 409 or a full argument list with quoted macro assignments. 410 .B scc-make 411 appends flags to this variable as it processes them so that recursive 412 invocations inherit the current settings. 413 .SH EXAMPLES 414 .PP 415 Build the default target in 416 .IR Makefile : 417 .IP 418 .EX 419 scc-make 420 .EE 421 .PP 422 Build a specific target: 423 .IP 424 .EX 425 scc-make install 426 .EE 427 .PP 428 Override a macro on the command line: 429 .IP 430 .EX 431 scc-make CC=gcc CFLAGS='-O2 -g' 432 .EE 433 .PP 434 Use an alternate makefile: 435 .IP 436 .EX 437 scc-make \-f build.mk 438 .EE 439 .PP 440 Print all macros and rules without building: 441 .IP 442 .EX 443 scc-make \-p 444 .EE 445 .PP 446 Dry run showing commands that would be executed: 447 .IP 448 .EX 449 scc-make \-n 450 .EE 451 .PP 452 Continue building unrelated targets after an error: 453 .IP 454 .EX 455 scc-make \-k 456 .EE 457 .PP 458 Read the makefile from standard input: 459 .IP 460 .EX 461 scc-make \-f \- 462 .EE 463 .SH STANDARDS 464 .B scc-make 465 is designed to conform to IEEE Std 1003.1\-2018 (POSIX.1). 466 .SH SEE ALSO 467 .BR scc (1), 468 .BR scc\-cc (1), 469 .BR scc\-ar (1), 470 .BR sh (1) 471 .SH BUGS 472 The 473 .B \-j 474 option is accepted but parallel execution is not implemented. 475 The library interface is not implemented.