我正试图为asm文件的交叉编译编写一个制作配方。问题是,我想使用regex作为输出目标的makefile先决条件,因为这些程序集文件是以某种程度上的自动方式生成的。
因此,它们的名称遵循以下模式:
1_mps.S # i want this to be compiled into 1_mps.elf
2_mps.S # i want this to be compiled into 2_mps.elf
3_mps.S # i want this to be compiled into 3_mps.elf
等等..。
我正试图在Makefile文档中找到这个有点动态的规则定义的适当处理方法,但是
我目前正在学习如何编写makefiles。我得到了以下makefile (它是为应该在ARM芯片上运行的C项目自动生成的),我正在试图理解它:
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include FreeRTOS/Supp_Components/subdir.mk
-include FreeRTOS/MemMang/subdir.mk
-...
-include subdir.
我的makefile如下所示:
SRCS = $(wildcard *.asm)
OBJS = ${SRCS:.asm=.o}
# define a suffix rule for .asm -> .o
.asm.o : $(SRCS)
nasm -f elf $<
all: $(OBJS)
gcc -o ?? $<
^need the name of the target without file extension here ($* is blank)
然而,$*在.asm.o中工作,但在all中为空白。如何将gcc输
我有一些代码,用于处理项目中通常包含的.h/.c对中与uart相关的所有函数和操作。我有一个makefile,它将我所有的.c文件编译成.o文件,然后将它们链接到一个可执行文件。由于某些原因,我使用这一对的一个项目编译得很好,但另一个项目给出了以下错误:
obj/fiveax.o: In function `fiveax_init':
fiveax.c:(.text+0x10): undefined reference to `uart_init'
collect2: error: ld returned 1 exit status
在编译完所有.o文件后,尝试链接到可执行文件