Re:Brushing up on operating systems and C programming
by spatulon on Sunday January 21, 2018 @07:48AM
(#16197870)
I like your thinking regarding using simpler build tools. I took this to the extreme and now my build tool for personal C/C++ projects is just a file called build.sh/build.bat. That does little more than:
main.c #includes any other .c files that are needed (the term for this appears to be a 'unity build'). Compiling this way is /really/ fast, which is why it's okay to use a dumb build script that always recompiles everything.
[ Parent
| on HN ]
Re:Brushing up on operating systems and C programming
by earenndil on Sunday January 21, 2018 @02:32PM
(#16199519)
I would tbh recommend make (bsd make is a wider-supported subset of gnu make) over a shell script, because it can automatically detect which source files need to be rebuilt and which can be kept from previous builds, greatly reducing compile times. Also, it supports parallel builds, although this one is relatively easy with a shellscript.
Re:Brushing up on operating systems and C programming
by int_19h on Sunday January 21, 2018 @08:25PM
(#16201189)
If the sole purpose is to track which files changed, then redo is arguably a simpler solution to this problem - you don't need to learn a new language either (and its funky rules like the tab/space difference), just shell scripts with a couple new commands.
Re:Brushing up on operating systems and C programming
by senorsmile on Sunday January 21, 2018 @08:32PM
(#16201227)
I've never seen this before... I shall have to try it out on a C project I'm starting. Thanks!
Re:Brushing up on operating systems and C programming
by keldaris on Sunday January 21, 2018 @09:55AM
(#16198241)
I do exactly the same thing whenever I write C/C++. Genuinely large projects aside, I see no compelling reason to waste your time with build systems. This approach is simple, easy to maintain and lets you get on with writing actual code.
Re:Brushing up on operating systems and C programming
by ramzyo on Sunday January 21, 2018 @10:55AM
(#16198495)
Out of curiosity, why not use make for something so simple instead of a Shell script?
Re:Brushing up on operating systems and C programming
by keldaris on Monday January 22, 2018 @09:05AM
(#16204379)
Because I don't see any value from using it. It's not easier to read or write, it doesn't force you to keep it sane and simple like a bash/cmd script generally would, and it's just another dependency I don't really need. If I take a minimalistic approach to build systems, I prefer to go all the way.
Also, although this is merely a personal quirk that shouldn't persuade anyone else, I've seen enough horrific, unreadable make files to instinctively dislike them by now.
Re:Brushing up on operating systems and C programming
by spatulon on Sunday January 21, 2018 @12:32PM
(#16198942)
In my mind, shell scripts are simpler. I have no reason to need the extra complexity that make brings.
Also, I do a lot of programming on Windows, where GNU make would be another dependency to install. (Also, in my experience, make is slow on Windows, since they have to emulate fork()). I guess I could use Microsoft nmake, since I assume it's still installed along with Visual Studio, but again, batch files are simpler.
Re:Brushing up on operating systems and C programming
by int_19h on Sunday January 21, 2018 @08:26PM
(#16201198)
Take a look at this:
http://news.dieweltistgarnichtso.net/bin/redo-sh.html
And for GNU tools on Windows, I would heavily recommend MSYS2 these days - having Pacman as the package manager is very nice, and there are already a lot of packages there.
Re:Brushing up on operating systems and C programming
by grawprog on Sunday January 21, 2018 @11:56AM
(#16198744)
My thoughts are a shell is usually installed by default. Make may not be. This is only a guess. I'm not sure myself.
Re:Brushing up on operating systems and C programming
by ramzyo on Sunday January 21, 2018 @10:55AM
(#16198492)
Out of curiosity, why did you not choose make to do this?