【ARM&Linux】Makefile基本模式
作者:互联网
《嵌入式Linux中Makefile万能写法》
SRC := $(wildcard *.c)
OBJ := $(patsubst %.c, %.o, $(SRC))
CC = gcc
CCLINK = g++
CFLAGS = -g -Wall
xdma: $(OBJ)
$(CCLINK) $(CFLAGS) $^ -o $@
$(OBJ): %.o:%.c
$(CC) $(CFLAGS) -c $^ -o $@
.PHONY:clean
clean:
rm *.o xdma
SRC := ${wildcard *.c}
OBJ := ${patsubst %.c, %.o, $(SRC)}
CC = arm-linux-gcc
CCLINK = arm-linux-ld
CFLAGS = -g -c -Wall
all: $(OBJ)
$(CCLINK) -Wall $^ -o main.bin
$(OBJ): %.o:%.c
$(CC) $(CFLAGS) $^ -o $@
.PHONY:clean
clean:
find ./ -iname '*.o' -print0 | xargs -0 rm
# find ./ \( -iname "*.o" -o -iname "*.exe" \) -print0 | xargs -0 rm
标签:SRC,%.,OBJ,CC,Makefile,CCLINK,CFLAGS,Linux,ARM 来源: https://blog.csdn.net/qq153471503/article/details/79326830