scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

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