Search code examples
gnu-makenmake

nmake throw error if variable is not defined


I have a makefile which I am running through nmake, as opposed to gnumake.

I have some code taken from a makefile intended to gnumake...

# out_repo = 

ifndef out_repo
$(error out_repo is not set)
endif

This does not work with nmake. Is there a way in nmake where I can have the same behaviour, where the make process will error out if a variable is not defined?


Solution

  • The equivalent code in NMAKE syntax would be:

    # out_repo = 
    
    !ifndef out_repo
    !error out_repo is not set
    !endif
    

    See my answer to https://stackoverflow.com/a/54046754/318716 for a reference to older, more useful, NMAKE documentation.