Ich lerne gerade, Makefiles zu schreiben. Ich habe die folgende Makefile bekommt (das automatisch für ein C-Projekt erzeugt wurde, der auf einem ARM-Chip ausgeführt werden soll), und ich versuche, es zu verstehen:
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: [email protected]'
@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: [email protected]'
@echo ' '
$(MAKE) --no-print-directory post-build
# Other Targets
clean:
-$(RM) *
[email protected] ' '
post-build:
[email protected] '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"
[email protected] ' '
.PHONY: all clean dependents
.SECONDARY: post-build
-include ../makefile.targets
Ich versuche, meinen Kopf zu wickeln um die Linie $(MAKE) --no-print-directory post-build
in der Regel für die Erstellung der .elf
Datei.
Ich kann keine Definition für die Variable $(MAKE)
finden, also nehme ich an, dass es etwas eingebautes ist. Was macht diese Linie eigentlich?
https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html#MAKE-Variable – Notlikethat