2016-08-16 3 views
2

저는 현재 메이크 파일 작성 방법을 배우고 있습니다. 나는 (자동 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: [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 

을 내 머리를 정리하려고 해요 .elf 파일을 만들기위한 규칙에 $(MAKE) --no-print-directory post-build 줄 주위에 있습니다.

변수 $(MAKE)에 대한 정의를 찾을 수 없으므로 기본 제공되는 것으로 가정합니다. 이 라인은 실제로 무엇을하고 있습니까? docs에서

+1

https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html#MAKE-Variable – Notlikethat

답변

3

그것은 -t, -n-q 옵션을 전달 make의 재귀 호출 자체입니다. 이는 의미가 있습니다. 중첩 된 make 호출을이 옵션과 함께 실행하기를 원합니다.

+0

답변 해 주셔서 대단히 감사합니다. 나는 다른 (정말로 관련이없는) 질문을 가지고있다. post-build에서'@ echo' 명령 앞에'-' 문자가 오는 이유는 무엇입니까? 실행 파일을 만들기위한 규칙의'@ echo' 명령은 그것을 가지고 있지 않습니다. –

+0

@ K.Mulier : [기존 Q & A] (http://stackoverflow.com/a/14248293/15416)를 참조하십시오. – MSalters

1

:

이 변수의 값은 호출 만든다있는 파일 이름입니다

그것은 당신이 전화를해야 할 것 몇 가지 목표를 만드는 경우에 유용 메이크,하지만 당신은 몇 가지 -t (--touch)와 드라이 런의 종류, -n (--just-print), 또는 -q (--question) 플래그를하고있다. 이 동작은 ($MAKE)이 사용되면 재귀 적으로 전파됩니다.

+0

정확하게 "make가 실행 된 파일 이름"은 무엇입니까? –

+1

doc에서 단락의 나머지 : *이 파일 이름이/bin/make이면 실행 된 제조법은 'cd subdir &&/bin/make'입니다. 특수 버전의 make를 사용하여 최상위 메이크 파일을 실행하는 경우 재귀 호출에 대해 동일한 특수 버전이 실행됩니다. * – Daerdemandt

+0

따라서 C : \ Apps \ SysGCC 파일을 두 번 클릭하여 GNU make 프로그램을 시작하면 \ arm-eabi \ bin \ make.exe'를 입력하면 $ (MAKE) 변수가 문자열 "C : \ Apps \ SysGCC \ arm-eabi \ bin \ make.exe"로 확장됩니까? –

관련 문제