Clearmake与GNU make的比较

Clearmake主要适用于使用UNIX型的makefile的用户,它本身兼容GNU make 在执行建立脚本期间,clearmakeClearCase的多版本文件系统下执行一个建立追踪,它会记录每个派生对象被构建时的信息。
使用Clearmake的优势:
1).
它可以和clearcase配合,将生成的目标文件,库文件和二进制文件(DO)共享;
2).
支持并行构建和分布式构建,并行构建能够同时执行多重编译,分布式构建允许用户使用多台机器完整构建步骤;
3).  
可以生成配置记录(config record),作审计用。

clearmake provides partial compatibility with GNU make. This section provides the details.

Supported GNU make Command Options

clearmake –C gnu supports most of the single-character and long-form spellings of GNU make command options, as follows:

–b

Disables GNU's built-in rules (equivalent to gnumake –R).

– –directory=dir

Change to the specified directory before reading the makefiles.

–d – –debug

Prints debugging information in addition to normal processing messages.

–e – –environment-override

Gives variables taken from the environment precedence over variables from makefiles.

–f file – –file=file – –makefile=file

Reads file as a makefile.

–I dir

Specifies a directory dir to search for included makefiles.

–i – –ignore-errors

Ignores all errors in commands executed to remake files.

– –include-dir=dir

Specifies a directory in which to search for included makefiles.

–k – –keep-going

Continues as much as possible after an error.

– –no-builtin-variables

Eliminate use of built-in, rule-specific variables.

– –-no-print-directory

Disables printing of the working directory under –w.

–n – –just-print – –dry-run – –-recon

Prints the commands that would be executed, but does not execute them.

–p – –print-data-base

Prints the database (rules and variable values) that results from reading the makefiles, then executes as usual or as otherwise specified.

–q – –question

Question mode. Does not run any commands or print anything. Returns an exit status of 0 if the specified targets are already up to date, or 1 if any remaking is required.

–r – –no-builtin-rules

Eliminates use of the built-in implicit rules.

–s – –silent – –quiet

Silent operation. Does not print the commands as they are executed.

– –warn-undefined-variables

Issues a warning whenever a reference to an undefined variable is found. Null warnings for VPATH and SHELL are suppressed by default; null warnings for these can be displayed using the clearmake options –v or –d.

–w – –print-directory

Prints a message containing the working directory both before and after executing the makefile.

Unsupported GNU make Command-Line Options

The following options are not supported:

  • -m
  • -C dir
  • -h --help
  • -I dir
  • -j [jobs] --jobs[=jobs]
  • -l [load] --load-average[=load] --max-load[=load]
  • -o file --old-file=file --assume-old=file
  • -R (this is supported as –b)
  • -S --no-keep-going --stop
  • -t --touch
  • -v --version
  • -W file --what-if=file --new-file=file --assume-new=file
Supported GNU make Features

The following features are enabled with –C gnu (see the GNU make documentation):

  • Conditional makefile interpretation. For example:

ifeq ($(CC),gcc)
        $(CC) -o foo $(objects) $(libs_for_gcc)
else
        $(CC) -o foo $(objects) $(normal_libs)
endif

  • Simply expanded variables in which the RHS is expanded once when the assignment is first scanned. For example:

y := $(x) bar

  • The += syntax to append to the value of a variable.
  • The ?= macro operator.
  • The use of $$ in target names as an equivalent to a literal $.
  • Special characters ()<>;!=&|$#:”{}/ (UNIX) or ()<>;!=&|$#:” (Windows) within macro names
  • Escaping special characters in target names by preceding them with a /. Note that the escaping must be consistent within the makefile. For example,

test: test#footest/#foo:
echo $@test: test#footest/#foo:
echo $@

generates a Don't know how to make error.

  • Stripping leading sequences of ./ (UNIX) or ./ (Windows) from file names, so that (for example) ./file and file are considered the same target
  • Variable references using pattern substitution:

${VAR:PATTERN_1=PATTERN_2}

  • Text-manipulation functions:

$(subst FROM,TO,TEXT)
$(patsubst PATTERN,REPLACEMENT,TEXT)
$(strip STRING)
$(findstring FIND,IN)
$(filter PATTERN...,TEXT)
$(filter-out PATTERN...,TEXT)
$(sort LIST)
$(dir NAMES...)
$(notdir NAMES...)
$(suffix NAMES...)
$(basename NAMES...)
$(addsuffix SUFFIX,NAMES...)
$(addprefix PREFIX,NAMES...)
$(join LIST1,LIST2)
$(word N,TEXT)
$(words TEXT)
$(wordlist START, END, TEXT) 
$(firstword NAMES...)
$(wildcard PATTERN)
$(foreach VAR,LIST,TEXT)
$(origin VARIABLE)
$(shell COMMAND)

  • The VPATH variable for specifying a search path for every dependency.

Note: clearmake searches only in the current view. For more information, see the makefile_ccase reference page.

  • The MAKECMDGOALS variable for specifying the targets given on the command line.
  • The vpath statement for specifying a search path for a specified class of names.
  • The export statement.
  • The unexport directive.
  • The .PHONY target declaration.
  • All of GNU make's built-in implicit rules.
  • Pattern rules. For example:

%.o : %.c
    COMMANDS
    ...

  • Static pattern rules:

TARGETS ...: TARGET-PATTERN: DEP-PATTERNS ...
    COMMANDS
    ...

  • The automatic variables:

$@  $*  $<  $%  $?  $^  $+ 

Also, their file-name and directory-name variants. For example:

$(@F)  $(@D)  ...

  • Multiline variable definition:

define VAR
    TEXT
    ...
endef

  • Target-specific variable values:

target ... : variable-assignment

or

target ... : override variable-assignment

Unsupported GNU make Features

The following features are not supported:

  • Automatic remaking of any makefiles that are declared as targets (you must explicitly rebuild them).
  • The declarations .DELETE_ON_ERROR, .INTERMEDIATE, .SECONDARY.
  • Automatic makefile regeneration and restart if the makefile and included makefile fragments are targets in the makefile itself.
  • Automatic deletion of intermediate results of a chain of implicit-rules.
  • Special search method for library dependencies written in the form -lNAME. For each directory on the VPATH/vpath list, GNU make searches in DIR/lib .
  • When MAKEFILES is defined, GNU make considers its value as a list of names of additional makefiles to be read before the others, as though they were implicitly included.
  • The following functions:
    • $(error ...)
    • $(warning ...)
    • $(call ...)
    • $(if ...)

猜你喜欢

转载自blog.csdn.net/carlshen/article/details/4503239