[prev] [index] [next]

Abbreviations

To simplify writing rules, make provides default abbreviations:

$@ full name of target
$* name of target, without suffix
$< full name of first source
$? full names of all newer sources

Examples:

# one of above rules, re-written
lex.o : lex.c mycc.h lex.h
        $(CC) $(CFLAGS) -c $*.c -o $@
	# or ... $(CC) $(CFLAGS) -c $< -o $@

# update a library archive
lib.a: foo.o bar.o lose.o win.o
	ar r lib.a $?