Portable Makefile(s)

"C. Bergström" cbergstrom at pathscale.com
Sun Oct 31 12:19:35 UTC 2010


David DEMELIER wrote:
> Hello,
>
> I'm working on many projects, and writing makefile is really painful.
> I love the BSD Makefile syntax obviously, but I also love that people
> using Linux could run make to build my projects too. And using BSD
> makefile syntax disallow this.
>
> Reducing the makefile to the minimal makes them portable, but then you
> canno't use loops, conditionnals, and this is getting my nerves.
>
> What could I do to write Makefile compatible on every operating
> systems ? I'm thinking about Cmake but I hate the syntax, also for
> dmake...
>   
We had this same choice at our company and ended up going wiht cmake for 
everything. In the end you'll save time and get portability across all 
platforms and build environments.  Don't really think of cmake as a 
makefile replacement, but a replacement for auto* tools and makefiles 
together.  (cmake generates platform native makefiles)  If you do go 
with cmake don't try to support older versions though.  Anything 2.8.1+ 
is really quite solid from my experience..  /* no I don't work for 
kitware */

good luck

./C


More information about the freebsd-questions mailing list