How do you specify that a FreeBSD Makefile place the objects (*.o) into a different directory?

StackOverflow https://stackoverflow.com/questions/19602157

  •  01-07-2022
  •  | 
  •  

Question

If I have some source files in another directory and I want to make some libraries using the source files, I want to have the *.o, *.po, and *.So files in the local directory. It isn't clear how to accomplish this. The transformation rules in bsd.lib.mk always point the .o into the source directory.

How do I get the results of the ${CC} -c to be in the local directory?

Was it helpful?

Solution

The file bsd.lib.mk inclused bsd.obj.mak, so you can use the MAKEOBJDIR environment variable.

Edit: If you cannot control how make is called, then don't use bsd.lib.mk and make explicit dependencies in your Makefile;

foo.o: ../bar/foo.c
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top