Archive for the ‘Makefile’ Category

Variable reassignment in makefiles

August 5, 2006

To change the value of a variable assigned in makefile, inside a rule, use this:

target ... : variable-assignment

on a separate line by itself.

Example:

CC=gcc
...
prog: CC=g++
prog: prog.cpp
	${CC} -o prog prog.cpp

Found here:

http://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html

ignore return values

July 20, 2006

To ignore error return values from a command in a makefile, add a ‘-‘ before command.