【ARM&Linux】Makefile基本模式

《嵌入式Linux中Makefile万能写法》


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

这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq153471503/article/details/79326830