Makefiles compatible with both BSD and GNU make?
Dan Nelson
dnelson at allantgroup.com
Wed Mar 16 12:50:19 PST 2005
In the last episode (Mar 16), David Kelly said:
> I got the silly idea that I want one Makefile to work with both BSD
> and GNU makes. Silly me. Fairly simple Makefiles work but when
> expanding my Makefile to include .depend generation I get tripped.
>
> BSD make automagically uses .depend if one is found. GNU make
> requires the file be named in an include, but the syntax of GNU
> include is different than BSD. As is the syntax of conditional
> statements.
FreeBSD's make understands the gnu-style include syntax with no leading
dot, even though it's undocumented (grep for SYSVINCLUDE in the
source). Automake is the usual way around compatibility issues; it has
its own conditional syntax that it expands out when it generates the
Makefile, and will create the appropriate dependency lines.
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list