0

Under FreeBSD, for some odd reason every time I execute a simple Makefile, it tries to create an obj directory under the current PWD.

I thought it might have to do with the default .OBJDIR for FreeBSD make, but setting .OBJDIR: ./ does not change this behavior.

This causes me problems down the line because it conflicts with SConstruct, but I managed to work around that by removing all read/write permissions for ./obj, however I still want to know why every time I run make, it tries to create the ./obj directory if it doesn't exist.

Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125
  • 1
    Whithout the Makefile it will be difficult to understand your problem. Can you provide a [MCVE](https://stackoverflow.com/help/mcve)? – Renaud Pacalet Aug 23 '17 at 06:49
  • 1
    [This related question](https://stackoverflow.com/q/45675365/2371524) explains that FreeBSD make only tries to `chdir()` to an `.OBJDIR`, but doesn't create it. There must be some other reason in your Makefile, so I second @RenaudPacalet's comment. –  Aug 23 '17 at 07:25
  • 1
    Object directories *do* get automatically created but only if inside of /usr/src. If it is being created outside of there it is a bug and I'd love to hear about it since I implemented this change. – Bryan Drewery Jul 13 '22 at 22:26
  • @BryanDrewery this was obviously many, many moons ago on an older version of FreeBSD. I still have the VM image saved somewhere and could probably dig it out to debug further if I were sufficiently motivated, but we no longer run into this problem in 2022 on FreeBSD 13 (and have also bid scons adieu). I’ve written my share of voodoo-filled Makefiles abusing documented behavior but never did figure this one out. Thanks for letting me know there’s a chance I’m not entirely crazy! – Mahmoud Al-Qudsi Sep 13 '22 at 17:48

1 Answers1

0

make does not create any ${.OBJDIR} automatically -- something in your Makefiles must be explicitly creating that (or trying to).

Could you post the makefile and/or the output of a make-run?

You can affect the value of the variable by setting MAKEOBJDIRPREFIX or MAKEOBJDIR in the environment or on command-line (neither can be set in /etc/make.conf).

See make(1) for more details.

Mikhail T.
  • 3,043
  • 3
  • 29
  • 46