I have a very simple Makefile that just shells out to another Makefile:
all:
cd src && make all
My directory structure (the Makefile
is in the top-level directory):
[I] mqudsi@php ~/bbcp> tree -d
.
├── bin
│ └── FreeBSD
├── obj
│ └── FreeBSD
├── src
└── utils
This works just fine under Linux, but under FreeBSD, it gives an error about src
not being found.
To debug, I updated the Makefile command to pwd; cd src && make all
and I discovered that somehow when I run make
in the top-level directory, it is being executed under ./obj
instead, meaning it's looking for ./obj/src/
to cd
into.
Aside from the fact that I have no clue why it's doing that, I presumed for sure that calling gmake
instead of make
under FreeBSD would take care of it, but that wasn't the case (and I'm relieved, because I can't believe there is that huge of a difference between BSD make and GNU make in terms of core operation).
The odd thing is, deleting obj
makes everything work perfectly. So in the presence of an obj
directory, make
cds into ./obj
first; otherwise it executes as you'd expect it to.