gpt4 book ai didi

makefile - makefile 中的变量 $(MAKE) 是什么?

转载 作者:IT老高 更新时间:2023-10-28 11:22:23 31 4
gpt4 key购买 nike

我目前正在学习如何编写 makefile。我有以下 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.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: FreeRTOS_T02.elf

# Tool invocations
FreeRTOS_T02.elf: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: MCU GCC Linker'
arm-none-eabi-gcc -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -specs=nosys.specs -specs=nano.specs -T LinkerScript.ld -Wl,-Map=output.map -Wl,--gc-sections -lm -o "FreeRTOS_T02.elf" @"objects.list" $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
$(MAKE) --no-print-directory post-build

# Other Targets
clean:
-$(RM) *
-@echo ' '

post-build:
-@echo 'Generating binary and Printing size information:'
arm-none-eabi-objcopy -O binary "FreeRTOS_T02.elf" "FreeRTOS_T02.bin"
arm-none-eabi-size "FreeRTOS_T02.elf"
-@echo ' '

.PHONY: all clean dependents
.SECONDARY: post-build

-include ../makefile.targets

我正试图围绕 $(MAKE) --no-print-directory post-build 行在制作 .elf 的规则中文件。

我找不到变量 $(MAKE) 的定义,所以我假设它是内置的。这条线实际上在做什么?

最佳答案

这是make本身的递归调用,转发-t-n-q选项.这是有道理的:您希望嵌套的 make 调用也使用这些选项运行。

关于makefile - makefile 中的变量 $(MAKE) 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38978627/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com