OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Sep 22, 2017 6:23 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Build Systems
PostPosted: Tue Sep 12, 2017 3:04 am 
Offline

Joined: Thu Sep 07, 2017 1:29 pm
Posts: 7
I hate build systems, I really do, and I'm sure many here share the sentiment. I mean, it's not their fault; they're doing their best, but C/C++ were simply not designed with complex build systems in mind.

So here I wanted to ask, what build systems do you use/recommend? Personally, I've tried nearly everything under the sun, but my favorites so far are:
  • tup: It's very fast, which is nice though not my priority. Really what I like about this one more has to do with its variant build feature, macros, and its rule syntax.
  • Meson: This is more heavy-duty than tup, but still very fast (it uses Ninja as a backend). However, what I like most about it is that it's very intuitive as far as build systems go.
  • CMake: What build system list can go without mentioning this beast? It's big, very featureful, and has a weird scripting language. (Does anyone know where they came up with this language??)


Top
 Profile  
 
 Post subject: Re: Build Systems
PostPosted: Tue Sep 12, 2017 5:20 am 
Offline
Member
Member

Joined: Fri Aug 07, 2015 6:13 am
Posts: 865
I personally think that good old Make is the best. Not too complicated, can do everything I need. There is no point to complicate something that is not supposed to be complicated.

_________________
OS: Basic OS, Monolithic Kernel, Written in C++
Current Task: Physical Address Space Multi-functional Manager
Forever monolithic! Don't let the micro people reassure you.


Top
 Profile  
 
 Post subject: Re: Build Systems
PostPosted: Tue Sep 12, 2017 9:58 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2965
Location: Chichester, UK
+1

Make is versatile enough to handle the Linux kernel, so it's certainly good enough for anything I write. It's simple and tried and trusted.


Top
 Profile  
 
 Post subject: Re: Build Systems
PostPosted: Tue Sep 12, 2017 6:39 pm 
Offline

Joined: Thu Sep 07, 2017 1:29 pm
Posts: 7
Make is versatile, sure, but it has many issues as well. For one, relationships between file dependencies is broken; Make can't detect that foo.c is dependent on foo.h. Tup does this by watching what files get modified by a command, while preserving Make's versatility.


Top
 Profile  
 
 Post subject: Re: Build Systems
PostPosted: Wed Sep 13, 2017 12:24 am 
Offline
Member
Member

Joined: Thu Jul 05, 2007 8:58 am
Posts: 155
jordyd wrote:
Make is versatile, sure, but it has many issues as well. For one, relationships between file dependencies is broken; Make can't detect that foo.c is dependent on foo.h. Tup does this by watching what files get modified by a command, while preserving Make's versatility.


I prefer having to specify dependencies myself, as that way I can specify only those files that really matter as dependencies. The specific problem of header file dependencies can already be solved by instructing the compiler to generate dependency files, and by specifying the rest myself I can for example avoid minor libc updates on the host system causing a need to recompile my entire kernel, whereas tup's philosophy of everything opened for reading is a dependency would also pull those in.


Top
 Profile  
 
 Post subject: Re: Build Systems
PostPosted: Wed Sep 13, 2017 12:56 am 
Offline
Member
Member
User avatar

Joined: Sun Dec 25, 2016 1:54 am
Posts: 205
CMake... and only CMake....

why?

1) Integration with CTest test system which in turn integrates with CDash build dashboard system...

2) invoking cmake with the GUI/TUI option allows menu of options specific to your project - this is extremely useful for helping train new internal users/programmers about what the options are and how they effect/cascade into other options

3) robust dependency management - whether you let cmake figure 'em out or specifically forcing dependencies cmake kicks butt - especially for multiple target architectures/OS's

4) sufficient language capabilities which allow writing human understandable build scripts... meaning you can look at a project which uses cmake and even if you don't really know cmake you can understand what is going on.... unlike others ( scons :cry: )

5) more than anything else... not ever having to write a freakin' makefile again AND never having to debug someone else's crappy makefile

on the cmake language:

A) everything is a function

Code:
KEYWORD(info or tag or arg)


B) simple push/pop stack machine parser where entering a new keyword function is a push - leaving a pop

C) remember - just because you write cmake code doesn't mean cmake is the engine which executes that code - many of the cmake statements you write are translated to statements for the target build system such as make or ninja - this can be confusing


cheers

_________________
Plagiarize. Plagiarize. Let not one line escape thine eyes...


Top
 Profile  
 
 Post subject: Re: Build Systems
PostPosted: Wed Sep 13, 2017 1:28 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2965
Location: Chichester, UK
jordyd wrote:
Make is versatile, sure, but it has many issues as well. For one, relationships between file dependencies is broken

I've never had any problems when using auto-dependencies: http://make.mad-scientist.net/papers/ad ... eneration/

As I said, it works for the Linux kernel, which is a moderately complicated project.


Top
 Profile  
 
 Post subject: Re: Build Systems
PostPosted: Wed Sep 13, 2017 1:58 am 
Offline
Member
Member
User avatar

Joined: Wed Dec 01, 2010 3:41 am
Posts: 1721
Location: Hong Kong
I wrote a simple configure shell script to generate Makefile by taking a few options. That pretty much cover all cases I could imagine.


Top
 Profile  
 
 Post subject: Re: Build Systems
PostPosted: Wed Sep 13, 2017 2:45 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7127
Location: Germany
+1 for CMake.

Adding to what dchapiesky wrote:

CMake allows you to generate Makefiles. But it also allows you to generate Ninja files, NMake Makefiles (for command-line use with Visual Studio), it allows you to build Visual Studio solutions, for Win32 and Win64, Debug and Release, all from the same configuration you are building your Unix Makefiles from (and without configurations slowly drifting apart over time).

(This was what made me dive into CMake in the first place -- my 9-to-5 job included holding hands for five different "build setups", one for each target system, and I was so sick of it...)

You not only get CTest tests forwarded to a CDash dashboard, you also get CPack package building -- RPM, DEB, TGZ, NSIS setup.exe for both 32 and 64 bit releases etc., without doing much (if any) additional configuration work.

With MXE.cc, you get out-of-the-box cross-compiling capabilities, compiling and packaging your software for Windows from a Linux box by doing nothing more than using MXE's CMake wrapper script instead of your native cmake.

Plus, there are pre-built solutions for integrating LaTeX doc generation, Doxygen doc generation, Javadoc generation, source reformatting / beautifying, continuous and nightly builds, ...

Today the latest version of our software is built every night, for all target platforms, with one crontab'ed command per platform, using one single CMake configuration (which is 99% identical to the JAWS setup I linked above).

You can achieve many of these things with "plain" Makefiles as well. But be honest, who ever actually did that? CMake does most of these things more or less for free...

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group