[1]define的用法
makefile文件:
foo.c:foo.y
define run-yacc
yacc $(firstword $^)
mv y.tab.c $@
endef
.PHONY all:
all:
$(run-yacc)
foo.y文件:
%{void yyerror(const char *s);
%}
%%
program:
;
%%
void yyerror(const char *s){}
int main()
{
yyparse();
return 0;
}
[2]$1,$2
reverse=$2$1
foo=$(call reverse,a,b)
helloworld:
@echo =========================
@echo "foo is:$(foo)"
@echo =========================
clean:
rm -rf *.o helloworld
make以后显示:
=========================
foo is:ba
=========================