Is there a known way to make Linux's make reject unintended use of GNU‑Make specific extensions in Makefile when editing or using other's Makefile in Linux? I mean, restricting GNU‑Make to behave as the make specified in POSIX and reject any GNU‑Make specific extensions?

The .POSIX special target is not enough, according to “4.9 Special Built-in Target Names (gnu.org)”. The man page does not mention a command line option for this.

Using another make utility may be an option.

— Update 2018-10-19 —

I still have not found a direct answer to my question, but here is at least a document about this issue, a document which did not exist at the time I had this question: A Tutorial on Portable Makefiles (nullprogram.com).

  • Looking at this list, it's not clear that there is or ever was a strict POSIX only make -- so perhaps it makes more sense to start instead with the make that was intended for use with the "other's Makefile" in question. You've also said that GNU's ".POSIX target is not enough, according to" your reading of some documentation, but you have not demonstrated this up with an actual case, which is a little bit XY problemesque.
    – goldilocks
    Commented Jul 14, 2014 at 11:23
  • @goldilocks, the X is about checking a restriction I would like to stick to (for editing and modifying) due to lack of mastering GNU‑Make specifities and to help me be aware of the presence of some specificities (when there are). Eye‑checking is error‑prone, can't be mechanized, and I prefer to avoid error‑prone house‑made grep/sed/awk filters to check and draw my attention.
    – Hibou57
    Commented Jul 14, 2014 at 11:43
  • I'm no make wizard either, but wouldn't it be better to ask about that directly? (If so, Stack Overflow might be a better place for it.)
    – goldilocks
    Commented Jul 14, 2014 at 11:52
  • You may be right. By the way, after I posted it, I first deleted then again undeleted this question (was unsure of the place). I may later re‑ask on Stack Overflow as you suggest. Thanks for your concern.
    – Hibou57
    Commented Jul 14, 2014 at 12:30
  • 1
    There is an old but related question on Stack Overflow: How similar/different are gnu make, microsoft nmake and posix standard make?
    – Palec
    Commented Oct 17, 2014 at 23:40

1 Answer 1


I'm pretty sure that there is no way to disable GNU make extensions. The .POSIX target improves the compatibility but does not disable compatible extensions such as functions, proprietary dot targets, % patterns in targets, etc.

I don't know of any make implementation that sticks to POSIX features. For example MINIX, Solaris, OpenBSD all have their own extensions. You could at least try to build your programs with these four implementations (assuming that your programs do build on all these platforms), which will give you a pretty good portability assurance in practice. Add Windows with the make utility from Visual Studio, plus a port of some Unix shell tools, if you can use a non-free OS (I think there's a free version of VS that would be enough).

  • 5
    On Debian Linux, I am using pmake to test portability of my makefiles. It claims it is make flavor from NetBSD. (In newer versions of Debian it is bmake.)
    – Palec
    Commented Oct 17, 2014 at 23:29

You must log in to answer this question.

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