makepp_rules

makepp_rules is a tutorial about how to tell makepp to build something.
Download

makepp_rules Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Gary Holt
  • Publisher web site:
  • http://search.cpan.org/~pfeiffer/makepp-1.50-cvs-070728/pod/makepp_rules.pod

makepp_rules Tags


makepp_rules Description

makepp_rules is a tutorial about how to tell makepp to build something. makepp_rules is a tutorial about how to tell makepp to build something.A rule is what tells makepp how to build a file or a class of files. Makepp supports the same rule syntax as other implementations of make, plus some additions of its own.A rule has the general format target_expression : dependency_expression actionsThe list of targets may not contain any automatic variables (except $(foreach)). The dependency list may contain only automatic variables referring to the target (i.e., $(output), $(outputs), or their synonyms). The action may contain any automatic variables.If makepp decides that the rule needs to be executed, each line of the rule is executed sequentially, and if any returns a non-zero status, the remainder are not executed (and makepp aborts with an error unless you specified the -k option on the command line.) Each action should be only one line. If an action is too long to write conveniently on a single line, you can split it into several lines and put a backslash to indicate that the several lines should be combined into one.In order to distinguish actions from the next rule, the action should be indented more than the line containing the targets and dependencies. Unlike other implementations of make, makepp doesn't really care how much you indent it or whether you use tab characters rather than spaces. To keep backward compatibility with traditional make, the rules makepp uses to decide when actions end and the next rule begins are somewhat complicated:The first action line must be indented more than the line containing the target.If a line is indented by one tab character or 8 spaces or more, then it is considered an action line.A blank line or a comment line with the # character at the right margin ends the rule, unless the next non-blank line is indented more than 8 spaces (or more than one tab).If a line is indented as much or more than the first action line, then it is considered an additional action line.There are a few special action items:noecho @Normally, each shell command is printed as it is executed. However, if the first word of the action is noecho (or if it begins with the character @), then the command is not printed. For example, %.o: %.cxx noecho $(LIBTOOL) --mode=compile $(CC) -c $(input)This means that when the libtool command is executed, it is not printed. (Libtool itself usually prints the modified command that it executes, so it's redundant to print it twice.)ignore_error -Normally, if the shell command returns a non-zero status, then makepp aborts because the command failed. However, some programs incorrectly set the status on exit, or there may be an error which really isn't fatal and shouldn't abort the whole compilation. You can cause makepp to ignore the return status by specifying ignore_error as the first word of the command line (or - as the first character). For example, $(phony distribution): ignore_error rm -r my_program-$(VERSION) # Get rid of previous junk. &mkdir my_program-$(VERSION) &cp $(FILES) my_program-$(VERSION) tar cf my_program-$(VERSION).tar my_program-$(VERSION)This command makes a directory, copies a bunch of files into it, and then puts everything into a tar file for distribution. It's a good idea to clean out the previous contents of the directory, if there was anything there previously, and that's what the first line does. The rm might fail, but its return status is ignored.&This symbol shall be followed by a command name and any number of arguments. Shell syntax is not understood fully here, only single and double quotes and backslashed characters within, as throughout makepp. The command name either leads to a function c_name to be called with the remaining strings as arguments. If such a function can not be found, this is identical to calling "run" in makepp_extending from a perl block.This allows efficiently calling a built-in, makefile-provided or external command. The prefix & has been chosen because it is the function invoker in Perl, and because at the beginning it is illegal in Shell. $(ROOT)/include/%.h: %.h &ln $(input) $(output)perl makeperlThis is essentially the same as the perl statement, but it is performed each time when running the rule, not when reading the makefile. The first variant is plain Perl code, while the second variant first passes the statement through Make-style variable expansion.For the two possibilities of putting the braces of the body, see the explanation at "perl" in makepp_statements. Note that the third variant explained there makes no sence here, because all action lines must be indented. You must signal failure in Perl statements, by calling die.Per rule the Perl statements are currently evaluated in a common subprocess, except on Windows. That means they have only read access to any makefile variables. It is also the process which executes non-Perl actions. So calling exec or exit will confuse makepp. But this may change in the future. For an efficient way to call Perl scripts, see the previous item & or "run" in makepp_extending. $(phony version): noecho perl {{ # $(target) & $(VERSION) from Perl: print "This is ".f_target()." $VERSIONn"; }} echo You can mix this with Shell commands -makeperl { print "This is $(target) $(VERSION)n" }There are several different kinds of rules, each with different purposes. Requirements: · Perl


makepp_rules Related Software