target : sources
"The target depends on the sources."
: colon are called dependency lines.
The last-changed time is the time as it appears in the file-system directory = timestamp
if timestamp(target) is earlier than timestamp(sources) then build a new one.
include hearder
main.o : main.c def.h
io.o : io.c def.h
or
main.o io.o : def.h
Shell Lines
- the indented lines that follow each dependency line are called shell lines, which tell Make how to build the target.
- Make checks the shell line exit status. If the first shell line returning a non-zero exit status, it will stop.
- adding "-" prefix let Make ignore the exit status and continue.
Macros
- macro definition: name = value
- expressions form: $(name) or ${name}
- if the name is a single letter, the parentheses or braces are optional, ex. $X
- defining on the command line:
- make CFLAGS=-ms
- (including spaces) make "CFLAGS=-ms -z -p"
- run-time macros
- .TARGET is the name of the current target
- .SOURCES is the name of the inferred source
- macro modifiers
- $(name, modifier[,modifier ...]), ex. SRCS = $(OBJS,.o=.c)
- filename components, if PATH = /home/heron/test.txt
- D, directory, $(PATH, D) = /home/heron
- E, extensions, $(PATH, E) = .txt
- F, file name, $(PATH, F) = test.txt
ex.
%if $(CC) == gcc
CC = g++
%elif $(CC) == g++
CC = gcc
%else
echo "haha"
%endif
For More Info : http://unixhelp.ed.ac.uk/CGI/man-cgi?make
No comments:
Post a Comment