首先明白編譯的目標(biāo)文件是啥,搞單片機(jī)一般要用到的就是.hex,.bin,.elf. 而有了.elf就能轉(zhuǎn)換成*.hex和*.bin.
所以目標(biāo)是生成*.elf文件,而elf文件是由*.o文件鏈接而成,.o文件是由.c,*.cpp, .s等文件生成。*
#mermaid-svg-cbGuMP3xV40CSU6F .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-cbGuMP3xV40CSU6F .label text{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .node rect,#mermaid-svg-cbGuMP3xV40CSU6F .node circle,#mermaid-svg-cbGuMP3xV40CSU6F .node ellipse,#mermaid-svg-cbGuMP3xV40CSU6F .node polygon,#mermaid-svg-cbGuMP3xV40CSU6F .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-cbGuMP3xV40CSU6F .node .label{text-align:center;fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .node.clickable{cursor:pointer}#mermaid-svg-cbGuMP3xV40CSU6F .arrowheadPath{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-cbGuMP3xV40CSU6F .flowchart-link{stroke:#333;fill:none}#mermaid-svg-cbGuMP3xV40CSU6F .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-cbGuMP3xV40CSU6F .edgeLabel rect{opacity:0.9}#mermaid-svg-cbGuMP3xV40CSU6F .edgeLabel span{color:#333}#mermaid-svg-cbGuMP3xV40CSU6F .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-cbGuMP3xV40CSU6F .cluster text{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-cbGuMP3xV40CSU6F .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-cbGuMP3xV40CSU6F text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-cbGuMP3xV40CSU6F .actor-line{stroke:grey}#mermaid-svg-cbGuMP3xV40CSU6F .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-cbGuMP3xV40CSU6F .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-cbGuMP3xV40CSU6F #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-cbGuMP3xV40CSU6F .sequenceNumber{fill:#fff}#mermaid-svg-cbGuMP3xV40CSU6F #sequencenumber{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F #crosshead path{fill:#333;stroke:#333}#mermaid-svg-cbGuMP3xV40CSU6F .messageText{fill:#333;stroke:#333}#mermaid-svg-cbGuMP3xV40CSU6F .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-cbGuMP3xV40CSU6F .labelText,#mermaid-svg-cbGuMP3xV40CSU6F .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-cbGuMP3xV40CSU6F .loopText,#mermaid-svg-cbGuMP3xV40CSU6F .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-cbGuMP3xV40CSU6F .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-cbGuMP3xV40CSU6F .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-cbGuMP3xV40CSU6F .noteText,#mermaid-svg-cbGuMP3xV40CSU6F .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-cbGuMP3xV40CSU6F .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-cbGuMP3xV40CSU6F .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-cbGuMP3xV40CSU6F .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-cbGuMP3xV40CSU6F .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F .section{stroke:none;opacity:0.2}#mermaid-svg-cbGuMP3xV40CSU6F .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-cbGuMP3xV40CSU6F .section2{fill:#fff400}#mermaid-svg-cbGuMP3xV40CSU6F .section1,#mermaid-svg-cbGuMP3xV40CSU6F .section3{fill:#fff;opacity:0.2}#mermaid-svg-cbGuMP3xV40CSU6F .sectionTitle0{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .sectionTitle1{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .sectionTitle2{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .sectionTitle3{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-cbGuMP3xV40CSU6F .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F .grid path{stroke-width:0}#mermaid-svg-cbGuMP3xV40CSU6F .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-cbGuMP3xV40CSU6F .task{stroke-width:2}#mermaid-svg-cbGuMP3xV40CSU6F .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F .taskText:not([font-size]){font-size:11px}#mermaid-svg-cbGuMP3xV40CSU6F .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-cbGuMP3xV40CSU6F .task.clickable{cursor:pointer}#mermaid-svg-cbGuMP3xV40CSU6F .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-cbGuMP3xV40CSU6F .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-cbGuMP3xV40CSU6F .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-cbGuMP3xV40CSU6F .taskText0,#mermaid-svg-cbGuMP3xV40CSU6F .taskText1,#mermaid-svg-cbGuMP3xV40CSU6F .taskText2,#mermaid-svg-cbGuMP3xV40CSU6F .taskText3{fill:#fff}#mermaid-svg-cbGuMP3xV40CSU6F .task0,#mermaid-svg-cbGuMP3xV40CSU6F .task1,#mermaid-svg-cbGuMP3xV40CSU6F .task2,#mermaid-svg-cbGuMP3xV40CSU6F .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-cbGuMP3xV40CSU6F .taskTextOutside0,#mermaid-svg-cbGuMP3xV40CSU6F .taskTextOutside2{fill:#000}#mermaid-svg-cbGuMP3xV40CSU6F .taskTextOutside1,#mermaid-svg-cbGuMP3xV40CSU6F .taskTextOutside3{fill:#000}#mermaid-svg-cbGuMP3xV40CSU6F .active0,#mermaid-svg-cbGuMP3xV40CSU6F .active1,#mermaid-svg-cbGuMP3xV40CSU6F .active2,#mermaid-svg-cbGuMP3xV40CSU6F .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-cbGuMP3xV40CSU6F .activeText0,#mermaid-svg-cbGuMP3xV40CSU6F .activeText1,#mermaid-svg-cbGuMP3xV40CSU6F .activeText2,#mermaid-svg-cbGuMP3xV40CSU6F .activeText3{fill:#000 !important}#mermaid-svg-cbGuMP3xV40CSU6F .done0,#mermaid-svg-cbGuMP3xV40CSU6F .done1,#mermaid-svg-cbGuMP3xV40CSU6F .done2,#mermaid-svg-cbGuMP3xV40CSU6F .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-cbGuMP3xV40CSU6F .doneText0,#mermaid-svg-cbGuMP3xV40CSU6F .doneText1,#mermaid-svg-cbGuMP3xV40CSU6F .doneText2,#mermaid-svg-cbGuMP3xV40CSU6F .doneText3{fill:#000 !important}#mermaid-svg-cbGuMP3xV40CSU6F .crit0,#mermaid-svg-cbGuMP3xV40CSU6F .crit1,#mermaid-svg-cbGuMP3xV40CSU6F .crit2,#mermaid-svg-cbGuMP3xV40CSU6F .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-cbGuMP3xV40CSU6F .activeCrit0,#mermaid-svg-cbGuMP3xV40CSU6F .activeCrit1,#mermaid-svg-cbGuMP3xV40CSU6F .activeCrit2,#mermaid-svg-cbGuMP3xV40CSU6F .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-cbGuMP3xV40CSU6F .doneCrit0,#mermaid-svg-cbGuMP3xV40CSU6F .doneCrit1,#mermaid-svg-cbGuMP3xV40CSU6F .doneCrit2,#mermaid-svg-cbGuMP3xV40CSU6F .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-cbGuMP3xV40CSU6F .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-cbGuMP3xV40CSU6F .milestoneText{font-style:italic}#mermaid-svg-cbGuMP3xV40CSU6F .doneCritText0,#mermaid-svg-cbGuMP3xV40CSU6F .doneCritText1,#mermaid-svg-cbGuMP3xV40CSU6F .doneCritText2,#mermaid-svg-cbGuMP3xV40CSU6F .doneCritText3{fill:#000 !important}#mermaid-svg-cbGuMP3xV40CSU6F .activeCritText0,#mermaid-svg-cbGuMP3xV40CSU6F .activeCritText1,#mermaid-svg-cbGuMP3xV40CSU6F .activeCritText2,#mermaid-svg-cbGuMP3xV40CSU6F .activeCritText3{fill:#000 !important}#mermaid-svg-cbGuMP3xV40CSU6F .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-cbGuMP3xV40CSU6F g.classGroup text .title{font-weight:bolder}#mermaid-svg-cbGuMP3xV40CSU6F g.clickable{cursor:pointer}#mermaid-svg-cbGuMP3xV40CSU6F g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-cbGuMP3xV40CSU6F g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-cbGuMP3xV40CSU6F .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-cbGuMP3xV40CSU6F .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-cbGuMP3xV40CSU6F .dashed-line{stroke-dasharray:3}#mermaid-svg-cbGuMP3xV40CSU6F #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F .commit-id,#mermaid-svg-cbGuMP3xV40CSU6F .commit-msg,#mermaid-svg-cbGuMP3xV40CSU6F .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-cbGuMP3xV40CSU6F g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-cbGuMP3xV40CSU6F g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-cbGuMP3xV40CSU6F g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-cbGuMP3xV40CSU6F .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-cbGuMP3xV40CSU6F .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-cbGuMP3xV40CSU6F .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-cbGuMP3xV40CSU6F .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-cbGuMP3xV40CSU6F .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-cbGuMP3xV40CSU6F .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-cbGuMP3xV40CSU6F .edgeLabel text{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-cbGuMP3xV40CSU6F .node circle.state-start{fill:black;stroke:black}#mermaid-svg-cbGuMP3xV40CSU6F .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-cbGuMP3xV40CSU6F #statediagram-barbEnd{fill:#9370db}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-state .divider{stroke:#9370db}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-cbGuMP3xV40CSU6F .note-edge{stroke-dasharray:5}#mermaid-svg-cbGuMP3xV40CSU6F .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-cbGuMP3xV40CSU6F .error-icon{fill:#522}#mermaid-svg-cbGuMP3xV40CSU6F .error-text{fill:#522;stroke:#522}#mermaid-svg-cbGuMP3xV40CSU6F .edge-thickness-normal{stroke-width:2px}#mermaid-svg-cbGuMP3xV40CSU6F .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-cbGuMP3xV40CSU6F .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-cbGuMP3xV40CSU6F .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-cbGuMP3xV40CSU6F .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-cbGuMP3xV40CSU6F .marker{fill:#333}#mermaid-svg-cbGuMP3xV40CSU6F .marker.cross{stroke:#333}:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}#mermaid-svg-cbGuMP3xV40CSU6F {color: rgba(0, 0, 0, 0.75);font: ;}
編譯鏈接轉(zhuǎn)換程序源文件c,cpp,s,ho文件elf文件bin,hex
再了解一下makefile的簡(jiǎn)單語(yǔ)法
如
AXX = BXX,就是聲明AXX并賦值為BXX
AXX = BXX CXX DXX 就是聲明AXX并賦值為BXX CXX DXX
EXX = $(AXX) 就是聲明EXX并引用AXX所包含的內(nèi)容,沿用上面的話EXX就是BXX CXX DXX,而不是AXX
要生成*.o文件的話就要找到所有的頭文件路徑
# Working directories
# 根目錄
ROOT
:= $
(patsubst
%/,%,$
(dir $
(lastword $
(MAKEFILE_LIST
))))# 工程目錄
TARGET_INCLUDE_DIR
= $
(ROOT
)/cores
# 庫(kù)目錄
SYSTEM_INC
= $
(ROOT
)/system
/inc
# 全部目錄
INCLUDES
= $
(SYSTEM_INC
) $
(TARGET_INCLUDE_DIR
) $
(TARGET_STARTUP_DIR
)
以及所有源文件
#查找所有c文件
SYSTEM_SRC
= $
(wildcard $
(SYSTEM_DIR
)
然后定義編譯工具
# Tool names
ARM_SDK_PREFIX
?= arm
-none
-eabi
-
CROSS_CC
:= $
(ARM_SDK_PREFIX
)gcc
CROSS_CXX
:= $
(ARM_SDK_PREFIX
)g
++
OBJCOPY
:= $
(ARM_SDK_PREFIX
)objcopy
SIZE
:= $
(ARM_SDK_PREFIX
)size
AR
:= $
(ARM_SDK_PREFIX
)ar
再定義編譯的選項(xiàng),要根據(jù)各自單片機(jī)的需要加上去(‘\’的意思是內(nèi)容沒(méi)有結(jié)束,接下一行)
#build flags
ARCH_FLAGS
= -mthumb
-mcpu
=cortex
-m4
CFLAGS
= \$
(ARCH_FLAGS
) \$
(addprefix
-I
,$
(INCLUDES
)) \
-c \
-O2 \
-g \
-ffast
-math \
-std
=gnu11 \
-Wall \
-ffunction
-sections \
-fdata
-sections \
-fsingle
-precision
-constant \
-Wdouble
-promotion \
-Wunsafe
-loop
-optimizations \
-save
-temps
=obj \
-MMD \
-MP \
ASFLAGS
= $
(ARCH_FLAGS
) \
-x assembler
-with
-cpp \$
(addprefix
-I
,$
(INCLUDES
)) \
-MMD
-MP
準(zhǔn)備開(kāi)始生成了,定義好要生成的目標(biāo)
makefile的第一個(gè)xxxx : yyyy格式的內(nèi)容會(huì)自動(dòng)成為makefile的最終目標(biāo),xxxx為目標(biāo),yyyy為生成目標(biāo)所需的依賴,makefile會(huì)自動(dòng)尋找目標(biāo)所需的全部依賴,包含依賴的依賴
#獲取當(dāng)前系統(tǒng)時(shí)間
DATE_TIME
= $
(shell date
+"%Y-%M-%d-%H:%M:%S")
#要輸出的目標(biāo),不列出來(lái)可能不輸出
OUTPUT
: $
(TARGET_BIN
) $
(TARGET_HEX
)
下面是各個(gè)依賴的生成
格式就是各個(gè)工具的使用方式
加@會(huì)隱藏編譯過(guò)程中的指令
$<是指依賴的第一個(gè)
$@是指目標(biāo)
#command tips visible
V1
= @
#command visible
V0
= @
$
(TARGET_BIN
): $
(TARGET_ELF
)$
(V0
) echo
"$(DATE_TIME) Generating binFile ... $@"$
(V1
) $
(OBJCOPY
) -O binary $
< $@$
(TARGET_HEX
): $
(TARGET_ELF
)$
(V0
) echo
"$(DATE_TIME) Generating hexFile ... $@"$
(V1
) $
(OBJCOPY
) -O ihex $
< $@
$
(TARGET_ELF
): $
(TARGET_OBJS
)$
(V0
) echo
"$(DATE_TIME) Linking everyting together... $@"$
(V1
)$
(CROSS_CC
) -o $@ $
^ $
(LDFLAGS
)$
(V0
) $
(SIZE
) $
(TARGET_ELF
)$
(TARGET_LIB
): $
(TARGET_LIB_OBJS
)$
(V0
) echo
"$(DATE_TIME) Linking static library... $@"$
(V1
) $
(AR
) -rc $@ $
^$
(OBJECT_DIR
)/$
(TARGET
)/%.o
: %.c $
(V0
) echo
"$(DATE_TIME) compiling... $<"$
(V1
) mkdir
-p $
(dir $@
)$
(V1
) $
(CROSS_CC
) -c
-o $@ $
(CFLAGS
)$
<
$
(OBJECT_DIR
)/$
(TARGET
)/%.o
: %.s $
(V0
) echo
"$(DATE_TIME) Assembling... $<"$
(V1
) mkdir
-p $
(dir $@
)$
(V1
) $
(CROSS_CC
) -c
-o $@ $
(ASFLAGS
) $
<$
(OBJECT_DIR
)/$
(TARGET
)/%.o
: %.S $
(V0
) echo
"$(DATE_TIME) Assembling... $<"$
(V1
) mkdir
-p $
(dir $@
)$
(V1
) $
(CROSS_CC
) -c
-o $@ $
(ASFLAGS
) $
< clean
:$
(V0
) echo
"Cleaning $(TARGET)"$
(V0
) rm
-f $
(CLEAN_ARTIFACTS
)$
(V0
) rm
-rf $
(OBJECT_DIR
)$
(V0
) rm
-rf $
(OBJECT_DIR
)/$
(TARGET
)$
(V0
) echo
"Cleaning $(TARGET) succeeded."
總結(jié)
以上是生活随笔為你收集整理的怎么写CORTEX在windows用arm-none-eabi-gcc编译时的makefile的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。