makefile

Table of Contents

1. Suggestions

  • Have .PHONY targets next to the targets instead of one line somewhere else in the file, helps make sure that the .PHONY targets are up-to-date.

2. Random usage

  • Misc
$(info ${VAR_NAME}) # printing in a makefile
  • Existence of env var

    @test -n "$(VAR_NAME)" || (echo 'error msg' && exit 1) # inline variant
    
    # global variant, no indentation at all
    ifndef ENV_VAR_X
            $(error ENV_VAR_X is undefined)
    endif
    

Created: 2024-07-16 Tue 16:44

Validate