Search code examples
nmake

Why would nmake execute a link target when no dependents have changed?


The link target of my nmake makefile is always executed - even when no changes have been done since the last nmake run. I have no idea what to look for here, what could be wrong. It's quite annoying that link.exe is run redundantly.

This is the gist of my nmake makefile:

BINDIR=..\bin\x64\release

OBJS= \
    $(BINDIR)\main.obj

{..}.cpp{$(BINDIR)}.obj:
    cl.exe /c /Fo$(BINDIR)\ /Fd$(BINDIR)\ $<

app: $(OBJS)
    link.exe $(CFLAGS) /out:$(BINDIR)\app.exe $(OBJS)

Does anyone know what I could look for?


Solution

  • Answering this myself since I just found the part I was missing.

    When I split the app target into a command target and a command-less target it works fine:

    app.exe: $(OBJS)
        link.exe $(CFLAGS) /out:$(BINDIR)\app.exe $*
    
    app: app.exe