The small white diary:
Error 1: meet
The following errors in compilation. O file handling
X86_64 - - the gnu/Linux crt1. O: In function ` _start
'Compile dynamic link libraries need to add the -shared,
Record multiple. At the same time a and. So links into. So, the compilation of a need to increase the -fpic,
GCC -shared hello. O - o hello
2: scripting language: a makefile
Linux c/c + + must be used to have a build script
Makefile large project development demo
The first layer:
The second layer: use - are replaced with $(variable name)
. The third layer: the implicit rules % % c. O * c *. All o. O all the files. C file
The fourth layer: the wildcard $@ $^ all object files all depend on the file $& lt; All depends on the file of the first file
The fifth layer:
Rm - rf hello. O hello. Hello. I s//choose to delete the file
# 1: # # are comments
The first layer: display rules
# the target file: depend on the file
# [TAB] command
#
# the first goal is the final file!!!!!! Recursive
#
# rm - rf hello. O hello. Hello. I S hello
# false target: PHONY
The second layer: variable=(replace), +=(additional) :=(identical to)
The TAR=test
OBJ=circle. O cube. Hello. O s
CC: GCC=
RMRF:=rm - rf
The main test: circle. O cube. O. O $(TAR) : $(OBJ)
GCC - Shared circle. O cube. O main. O - o test $(CC) - shard $$(OBJ) - o (TAR)
Circle. O: circle. The circle c. O: circle. C
GCC -c circle. C - o circle. O $(CC) - c circle.
c - o circle. OCube. O: cube. The cube c. O: cube. C
GCC -c cube. The cube c - o. C o $(CC) - cube. The cube. C - o o
The main. O: main. The main c. O: main. C
GCC -c main. C - o main. O $(CC) - the main c. C - o main. O
. The PHONY:. PHONY:
Clearall: clearall:
Rm - rf circle. O cube. O main. O test rm - rf circle. O cube. O main. O test
The clear: clear:
Main RMRF circle. O cube. O. O rm - rf $(OBJ)
The third layer:
%. O: c
%.$(CC) - c %.
c - o %. O
The fourth layer: the wildcard $@ $^ all object files all depend on the file $& lt; All depends on the file of the first file
$(CC) - c circle.
c - o circle. O$(CC) - c $@ - o $^
$(RMRF) circle. O cube. O main. O
$(RMRF) $(OBJ)