I would like to force make on FreeBSD to execute the target I specify no matter if it's up to date or not.

I know that it could be done with a -B flag in GNU make but I cannot find anything similar in the FreeBSD make manual page.

2 Answers 2


If you want only some targets (and always) you can use the ! instead of :, check:

target! source
    touch target

If you try make target the touch target will run even if target is newer than source.

Check the man make:


     Dependency   lines consist of one or more targets, an operator, and zero or
     more sources.  This creates a relationship   where the targets ``depend''
     on   the sources and are usually created from them.  The exact relationship
     between the target   and the source is determined by the operator that sep-
     arates them.  The three operators are as follows:


!    Targets are always re-created, but not until all sources have been
     examined and re-created as necessary.  Sources for a target accumu-
     late over dependency lines when this operator is used.  The target
     is removed if make is interrupted.
  • Thank you! Unfortunately, I knew this mechanism before but this is not what I am looking for. I'm looking for a solution for all targets, which is not always on. Actually, I may just run make clean before and I'll get a somewhat similar behaviour to the -B flag. Commented Mar 30, 2018 at 15:31
  • Ah, understand. Maybe you can create a rebuild (PHONY) target whose dependencies are clean and all targets (maybe with .WAIT or .ORDER).
    – uzsolt
    Commented Mar 30, 2018 at 17:51

Alright, so after almost 5 years I've found a way to force bmake to do what I want (in most cases at least).

It seems like a potential equivalent of gmake -B for bmake is:

printf '%s\n' ".PHONY: $(bmake -V .ALLTARGETS)" ".include \"./Makefile\"" | bmake -f -

Here's what this snippet does:

  1. $(bmake -V .ALLTARGETS) gets the list of all the targets known to bmake. This is one of my favorite features of bmake. It is very handy to be able to just ask bmake for a complete list of targets that the user can specify.
  2. .PHONY: ... assigns the phony attribute to all the existing targets. This way all the targets are going to be considered outdated, which will cause bmake to execute them regardless of whether they are up-to-date or not.
  3. .include "./Makefile" includes the actual makefile.
  4. bmake -f - tells bmake to take its makefile on the standard input instead of the usual makefile and Makefile.

There are various edge cases here but it's good enough for small projects. GNU Make's -B flag is not very useful for complex code bases anyway. Nevertheless, the lack of GNU Make style -B flag in bmake is a bit of a limitation with no clear workarounds.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .