>>S32DS编译时的主make过程
1 #<<<<<<<<<<主makefile重要流程>>>>>>>>>> 2 #======1.定义first的依赖项为all 3 first:all 4 5 #======2.定义RM 用于clean操作时的删除当前目录下的所有文件 6 RM := rm -rf 7 #======3.包含sources.mk和surbdir.mk(工程子文件夹中所有用到.c的子makefile文件) 8 -include sources.mk 9 -include subdir.mk 10 -include APP/DEA/subdir.mk 11 12 #======3.0 sources.mk主要用于: 13 #======3.0.1 定义所有全局变量并赋空值 14 TODISASSEMBLE_SRCS_QUOTED := 15 OBJ_SRCS_OS_FORMAT := 16 #======3.0.2 定义文件夹路径变量SUBDIRS 17 SUBDIRS := 18 APP/DEA 19 APP/SWVersion 20 21 #======3.1 subdir.mk主要用于: 22 #======3.1.1 追加全局变量:C_SRCS_QUOTED C_SRCS C_DEPS_QUOTED OBJS_QUOTED C_DEPS OBJS_OS_FORMAT OBJS 23 C_SRCS_QUOTED += 24 "../APP/DEA/DeaCoding.c" 25 26 #======3.1.2 定义各自.o的依赖项及生成.d文件 27 APP/DEA/DeaDiag.o: ../APP/DEA/DeaDiag.c 28 arm-none-eabi-gcc "@APP/DEA/DeaDiag.args" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "APP/DEA/DeaDiag.o" "$<" 29 30 #====================================4.定义all的依赖项 31 # All Target 32 all: warning-messages explicit-dependencies app.elf secondary-outputs 33 # Tool invocations 34 app.elf: $(OBJS) E:/workspace/S32K/ioc/Projects/D532_MC/D532_MC_APP/Project_Settings/Linker_Files/S32K148_256_flash.ld $(USER_OBJS) 35 @echo 'Building target: $@' 36 @echo 'Executing target #340 $@' 37 @echo 'Invoking: Standard S32DS C Linker' 38 arm-none-eabi-gcc -o "app.elf" "@app.args" $(USER_OBJS_QUOTED) 39 @echo 'Finished building target: $@' 40 @echo ' ' 41 42 app.bin: $(EXECUTABLES) 43 @echo 'Executing target #341 $@' 44 @echo 'Invoking: Standard S32DS Create Flash Image' 45 arm-none-eabi-objcopy -O binary $(EXECUTABLES) "app.bin" 46 @echo 'Finished building: $@' 47 @echo ' ' 48 49 app.siz: $(EXECUTABLES) 50 @echo 'Executing target #342 $@' 51 @echo 'Invoking: Standard S32DS Print Size' 52 arm-none-eabi-size --format=berkeley $(EXECUTABLES) 53 @echo 'Finished building: $@' 54 @echo ' ' 55 56 # Other Targets 57 clean: 58 -$(RM) $(SECONDARY_FLASH_QUOTED) ./*/*/*/*.d ./*/*/*/*/*/*/*.d ./*/*/*/*/*/*/*/*.d ./*/*/*/*/*.d ./*/*/*/*/*/*.d ./*/*.d ./*/*/*.d ./*/*/*/*.o ./*/*/*/*/*/*/*.o ./*/*/*/*/*/*/*/*.o ./*/*/*/*/*.o ./*/*/*/*/*/*.o ./*/*/*.o ./*/*.o $(SECONDARY_SIZE_QUOTED) $(EXECUTABLES_QUOTED) 59 -@echo ' ' 60 61 secondary-outputs: $(SECONDARY_FLASH) $(SECONDARY_SIZE) 62 63 .PHONY: all clean dependents explicit-dependencies warning-messages 64 .SECONDARY: 65 66 -include ../makefile.targets 67 68 explicit-dependencies: 69 70 warning-messages:
>>S32DS编译时的子make过程
1 -include ../../makefile.local 2 3 # Add inputs and outputs from these tool invocations to the build variables 4 #======3.1.1 追加全局变量:C_SRCS_QUOTED C_SRCS C_DEPS_QUOTED OBJS_QUOTED C_DEPS OBJS_OS_FORMAT OBJS 5 C_SRCS_QUOTED += 6 "../APP/Task_Com/CanApp.c" 7 8 C_SRCS += 9 ../APP/Task_Com/CanApp.c 10 11 C_DEPS_QUOTED += 12 "./APP/Task_Com/CanApp.d" 13 14 OBJS_QUOTED += 15 "./APP/Task_Com/CanApp.o" 16 17 C_DEPS += 18 ./APP/Task_Com/CanApp.d 19 20 OBJS_OS_FORMAT += 21 ./APP/Task_Com/CanApp.o 22 23 OBJS += 24 ./APP/Task_Com/CanApp.o 25 26 #======3.1.2 定义各自.o的依赖项及生成.d文件 27 # Each subdirectory must supply rules for building sources it contributes 28 APP/Task_Com/CanApp.o: ../APP/Task_Com/CanApp.c | pre-build 29 @echo 'Building file: $<' 30 @echo 'Executing target #50 $<' 31 @echo 'Invoking: Standard S32DS C Compiler' 32 arm-none-eabi-gcc "@APP/Task_Com/CanApp.args" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "APP/Task_Com/CanApp.o" "$<" 33 @echo 'Finished building: $<' 34 @echo ' '