1.TH SCC-MAKE 1 scc\-VERSION2.SH NAME3scc-make \- maintain program dependencies4.SH SYNOPSIS5.B scc-make6.RB [ \-eiknprSstd ]7.RB [ \-f8.IR file ]9.RB [ \-j10.IR jobs ]11.RI [ macro = value12\&...]13.RI [ target14\&...]15.SH DESCRIPTION16.B scc-make17updates files derived from other files.18It reads a description file (the makefile) that specifies how targets19are built from their prerequisites,20and rebuilds only those targets whose prerequisites have changed since21the last build.22.PP23.B scc-make24conforms to the IEEE Std 1003.1\-2018 (POSIX.1) specification for the25.BR make26utility.27.PP28On startup,29.B scc-make30reads the31.B MAKEFLAGS32environment variable and applies any flags found there.33Command-line flags are then processed,34followed by the makefile.35If no36.B \-f37option is given,38.B scc-make39tries to open40.I makefile41and then42.I Makefile43in the current directory.44If no targets are specified on the command line,45the first non-special target defined in the makefile is built.46.SH OPTIONS47.TP48.B \-e49Environment variables override macro definitions in the makefile.50By default, macro definitions in the makefile take precedence over51the environment.52.B SHELL53and54.B MAKEFLAGS55are never taken from the environment regardless of this flag.56.TP57.BI \-f " file"58Use59.I file60as the makefile.61If62.I file63is64.BR \- ,65standard input is read.66This option may be specified multiple times;67each file is read in order.68.TP69.B \-i70Ignore non-zero exit status from commands.71Equivalent to specifying72.B \-73before each command line in the makefile.74.TP75.BI \-j " jobs"76Accepted for compatibility; parallel execution is not implemented.77.TP78.B \-k79Continue building other targets even if an error occurs,80as long as they do not depend on the failed target.81.TP82.B \-n83Print commands without executing them.84Commands prefixed with85.B +86are still executed.87.TP88.B \-p89Print all macro definitions and rules to standard output, then exit.90.TP91.B \-q92Query mode.93Exit 0 if all specified targets are up to date, non-zero otherwise.94No commands are executed.95.TP96.B \-r97Clear the default suffix list.98Equivalent to a99.B .SUFFIXES:100rule with no prerequisites.101Default inference rules remain but are not reachable without suffixes.102.TP103.B \-S104Stop on error.105This is the default behaviour and is used to cancel a previous106.B \-k107flag inherited via108.BR MAKEFLAGS .109.TP110.B \-s111Silent mode.112Do not echo commands before executing them.113Equivalent to specifying114.B @115before each command line in the makefile.116.TP117.B \-t118Touch mode.119Touch targets and their prerequisites instead of running commands,120marking them as up to date.121Commands prefixed with122.B +123are still executed.124.TP125.B \-d126Debug mode.127Print diagnostic messages describing the decisions128.B scc-make129makes while processing targets.130.SH MAKEFILE SYNTAX131A makefile consists of macro definitions, rules, and132.B include133directives.134Comments begin with135.B #136and extend to the end of the line.137A backslash at the end of a line continues it on the next line.138.SS Macro Definitions139Macros are defined with:140.IP141.EX142name = value143.EE144.PP145Macro values may span multiple lines by ending each continued line146with a backslash.147Macro definitions in the makefile take precedence over the environment148unless149.B \-e150is given.151Command-line macro assignments always take precedence over both.152.PP153Macros are expanded by writing:154.TP155.BI $( name )156or157.BI ${ name }158Expand the macro named159.IR name .160.TP161.BI $ x162Expand the single-character macro163.IR x .164.TP165.B $$166A literal dollar sign.167.PP168The substitution form169.BI $( name : old = new )170expands macro171.I name172replacing each word that ends in173.I old174with the same word but ending in175.I new176instead.177.SS Rules178Rules define how to build targets from prerequisites:179.IP180.EX181target ... : prerequisite ...182 command183 command184.EE185.PP186Each command line must begin with a tab character.187A command may also appear on the rule line itself, separated by a semicolon.188Commands are passed to the shell specified by the189.B SHELL190macro191.RB ( /bin/sh192by default).193.PP194A command line may be prefixed with one or more of:195.TP196.B @197Do not echo the command before executing it.198.TP199.B \-200Ignore a non-zero exit status from this command.201.TP202.B +203Execute this command even when204.BR \-n ,205.BR \-q ,206or207.B \-t208is given.209.SS Internal Macros210The following macros are set automatically when a rule is executed:211.TP212.B $@213The name of the current target.214.TP215.B $<216The name of the first prerequisite (the implicit prerequisite in217inference rules).218.TP219.B $*220The stem of the current target: the target name with its suffix removed.221.TP222.B $?223The list of prerequisites that are newer than the current target.224.SS Inference Rules225Inference rules define how to transform a file of one suffix to a file226of another.227They have the form:228.IP229.EX230\&.from.to:231 command232.EE233.PP234For an inference rule235.I .from.to236to apply,237both suffixes must appear in the238.B .SUFFIXES239list.240.B scc-make241searches the suffix list in order to find a matching rule whose242prerequisite exists on disk.243.SS Include Directive244A line of the form:245.IP246.EX247include file248.EE249.PP250causes251.B scc-make252to read and process253.I file254at that point.255Macro expansions are performed on the filename.256.SH SPECIAL TARGETS257.TP258.B .SUFFIXES259Defines the list of recognized suffixes used to search for inference260rules.261An empty262.B .SUFFIXES:263rule (no prerequisites) clears the list.264Multiple265.B .SUFFIXES266rules are cumulative.267.TP268.B .DEFAULT269Commands associated with this target are run for any target that has270no explicit rule and no applicable inference rule.271.TP272.B .PRECIOUS273Prerequisites listed for this target are not deleted if274.B scc-make275is interrupted by a signal.276.TP277.B .SILENT278When specified without prerequisites, enables silent mode globally.279When listed with prerequisites, commands for those targets are not echoed.280.TP281.B .IGNORE282When specified without prerequisites, errors from all commands are ignored.283When listed with prerequisites, errors from those targets are ignored.284.SH DEFAULT MACROS285.B scc-make286defines the following macros by default.287They can be overridden in the makefile or on the command line.288.TP289.B AR290Archive program (default:291.BR ar ).292.TP293.B ARFLAGS294Flags for295.B AR296(default:297.BR \-rv ).298.TP299.B CC300C compiler (default:301.BR c99 ).302.TP303.B CFLAGS304Flags for305.B CC306(default:307.BR \-O1 ).308.TP309.B FC310Fortran compiler (default:311.BR fort77 ).312.TP313.B FFLAGS314Flags for315.B FC316(default:317.BR \-O1 ).318.TP319.B LDFLAGS320Flags for the linker (default: empty).321.TP322.B LEX323Lexical analyser generator (default:324.BR lex ).325.TP326.B LFLAGS327Flags for328.B LEX329(default: empty).330.TP331.B YACC332Parser generator (default:333.BR yacc ).334.TP335.B YFLAGS336Flags for337.B YACC338(default: empty).339.TP340.B SHELL341Shell used to run commands (default:342.BR /bin/sh ).343This macro is never taken from the environment.344.TP345.B MAKE346Set to the path used to invoke347.BR scc-make .348.TP349.B MAKEFLAGS350Contains the set of flags in effect.351Updated as flags are processed so that recursive352.B scc-make353invocations inherit them.354.SH DEFAULT INFERENCE RULES355The following inference rules are built in:356.TP357.B .c:358Compile a C source file to an executable using359.BR CC .360.TP361.B .f:362Compile a Fortran source file to an executable using363.BR FC .364.TP365.B .sh:366Copy a shell script to the target and make it executable.367.TP368.B .c.o:369Compile a C source file to an object file using370.BR CC .371.TP372.B .f.o:373Compile a Fortran source file to an object file using374.BR FC .375.TP376.B .y.o:377Run378.B yacc379on the source file, compile the result, and remove the intermediate files.380.TP381.B .l.o:382Run383.B lex384on the source file, compile the result, and remove the intermediate files.385.TP386.B .y.c:387Run388.B yacc389on the source file and rename the result.390.TP391.B .l.c:392Run393.B lex394on the source file and rename the result.395.TP396.B .c.a:397Compile a C source file and add the object to an archive.398.TP399.B .f.a:400Compile a Fortran source file and add the object to an archive.401.SH ENVIRONMENT VARIABLES402.TP403.B MAKEFLAGS404Flags read by405.B scc-make406at startup, before command-line processing.407The value may be a plain flag string (e.g.408.BR eks )409or a full argument list with quoted macro assignments.410.B scc-make411appends flags to this variable as it processes them so that recursive412invocations inherit the current settings.413.SH EXAMPLES414.PP415Build the default target in416.IR Makefile :417.IP418.EX419scc-make420.EE421.PP422Build a specific target:423.IP424.EX425scc-make install426.EE427.PP428Override a macro on the command line:429.IP430.EX431scc-make CC=gcc CFLAGS='-O2 -g'432.EE433.PP434Use an alternate makefile:435.IP436.EX437scc-make \-f build.mk438.EE439.PP440Print all macros and rules without building:441.IP442.EX443scc-make \-p444.EE445.PP446Dry run showing commands that would be executed:447.IP448.EX449scc-make \-n450.EE451.PP452Continue building unrelated targets after an error:453.IP454.EX455scc-make \-k456.EE457.PP458Read the makefile from standard input:459.IP460.EX461scc-make \-f \-462.EE463.SH STANDARDS464.B scc-make465is designed to conform to IEEE Std 1003.1\-2018 (POSIX.1).466.SH SEE ALSO467.BR scc (1),468.BR scc\-cc (1),469.BR scc\-ar (1),470.BR sh (1)471.SH BUGS472The473.B \-j474option is accepted but parallel execution is not implemented.475The library interface is not implemented.