Unconsciously graduated five years ago, the previous learning of Linux Basic Forget, re-review up!
Here is the makefile file that you wrote for beginners and looking back
Cc=GCCEXE=C.OUTCCC=g++EEE=cc. Out INC=/home/malth/project/include/LIB=/home/malth/project/lib/#添加文件搜索路经vpath=/home/malth/project/Lib#vpath%.h ~/project/include out=main.o bubbling_sort.o thread.o share_memory.ocfile=main.c bubbling_sort.c thread.c share_memory.cctest:$ (out) @echo compiling start ... #命令前加-minus can ignore command execution error message # "@"The symbol can hide the command, the command executes but does not show the command itself # Debug Discovery*.O file do gcc-o connection generated executable file cannot be gdb debug Gu added *. c files directly generated for selection # $ (CC) $ (out)-static $ (LIB) Slib.a-lpthread-o $ (EXE) $ (CC) $ (CFILE)-i$ (INC)-static $ (LIB) Slib.a-lpthread-g-o $ (EXE) @echo compile successed!# @-RM-F *. OMAIN.O:MAIN.C $ (CC)-i$ (INC)-C-g main.c common.o:common.c $ (CC)-C-g common.c thread.o:thread.c $ (CC)-C-g THREAD.C bubbling_sort.o:bubbling_sort.c $ (CC)-C-g bubbling_sort.cshare_memory.o:share_memory.c $ (CC)-C-g Share_memory.ccctest:test.cc-RM-Fcc. Out $ (CCC)-O $ (EEE) test.cc###################################################### #create the static LIBRARYSLIB:STATIC_LIB.Oar-RCS SLIB.A STATIC_LIB.OMV-F SLIB.A $ (LIB) STATIC_LIB.O:STATIC_LIB.C $ (CC)-c static_lib.c##################################################### #clean:-RM-F $ (EXE) $ (EEE) *. Olsresult=Result:=$ (words Hello World) All: @echo-N"result is:"@echo $ (result). Phony:all
Linux C Learning Note 01--makefile