#23 implicit rule omits dependency (vs gmake)


sometimes I add a dependency to an executable that otherwise gets created by an implicit rule, like

first: second.o

This works fine with gmake and mpp on linux, but on cygwin the dependency doesn't get picked up:

makepp: Loading makefile `/c/docs/sandbox/make/makepp/exe_suffix/makefile'
makepp: Scanning `/c/docs/sandbox/make/makepp/exe_suffix/first.cpp'
makepp: Entering directory `/c/docs/sandbox/make/makepp/exe_suffix'
g++ -g -Wall -c first.cpp -o first.o
g++ first.o -o first.exe
first.o: In function `main':
/c/docs/sandbox/make/makepp/exe_suffix/first.cpp:6: undefined reference to `f()'
collect2: ld returned 1 exit status
makepp: error: Failed to build target `/c/docs/sandbox/make/makepp/exe_suffix/first.exe' [1]
makepp: 1 file updated, 0 phony targets built and 1 target failed
makepp: error: $(prebuild first.exe) failed
$(prebuild first.exe) failed

Gmake works fine however. I attach all the files necesary to reproduce.


  • giksos

    giksos - 2009-10-18
  • Daniel Pfeiffer

    Daniel Pfeiffer - 2011-12-01

    Hmm, this is an unfortunate side effect of the way first is a phony target that depends on first.exe on Windows. Recently I had, what I thought was a bright idea, of making both of these two targets of the same rule, but this seemingly trivial solution has many drawbacks and led to more and more workarounds all over the place. So this is a no-go so shortly before releasing 2.0.

    I have archived my attempts and may revisit this next year.

  • Daniel Pfeiffer

    Daniel Pfeiffer - 2011-12-01
    • status: open --> pending

Log in to post a comment.