Page 1 of 2
ant instead of make?
Posted: Wed Jun 21, 2006 1:12 pm
by Candamir
I kind of don't like make; far too complicated, yet it still seems the standard method of writing build scripts in this community...
So, i've asked myself why nobody uses ant instead of make? Has anyone got an idea how this could be done?
Please note that I'm trying to not start a flame, just trying to figure out if it's feasible...
Candamir
Re:ant instead of make?
Posted: Wed Jun 21, 2006 5:35 pm
by chasetec
http://ant-contrib.sourceforge.net/cc.html
You might also want to take a look at another build tool designed for C/C++ that is supposed to be much simpler then make.
http://www.perforce.com/jam/jam.html
Pesonally my OS stuff has always been small enough that I just write a shell script to do the compiling and linking.
Re:ant instead of make?
Posted: Wed Jun 21, 2006 5:44 pm
by Colonel Kernel
I don't like make either, but eventually I want my OS to be self-hosted... Is there source code available for Perforce jam?
If I ever write an OS in Java, then maybe I'll use Ant. ;D
Re:ant instead of make?
Posted: Wed Jun 21, 2006 10:41 pm
by Solar
The reason why people use C / make / CVS is "critical mass" - once enough people use product A, it starts being the "easier" solution no matter how good product B might be, simply because of available documentation / advice / prior art.
That's why Windows and MS Office are so successful.
That being said, I've never touched ant, sorry.
Re:ant instead of make?
Posted: Thu Jun 22, 2006 5:54 am
by df
I use rant in ruby. (never liked scons) sooo nice and easy and powerfull.
Re:ant instead of make?
Posted: Thu Jun 22, 2006 7:11 am
by chasetec
Colonel Kernel wrote:
I don't like make either, but eventually I want my OS to be self-hosted... Is there source code available for Perforce jam?
The Jam source code is downloadable. If you go through the page I linked to you'll see where they cover porting it to other platforms(already runs on all of the major ones) and they even have an example of building an OpenBeOS kernel with Jam.
Re:ant instead of make?
Posted: Thu Jun 22, 2006 11:02 am
by Pype.Clicker
i'd say you could use virtually the make system you want for an OS project. Whatever you do, you will probably
not avoid completely the need for additional scripts anyway, as the needs may be very specific (making drivers or modules, etc.)
Personnally, i'd probably give up compiling a hobby OS if i realise i don't have the proper tool on my system (that is, wrong version of GCC, or wrong version of python/java/etc.) as, in my experience, updating these may have severe side effects on your system -- or may simply be too complicated (try to install gcc 4.0 on a SuSE 8.x system, you'll see what i mean

)
For a project that inherently take ages (and OS deving *does* take ages), i'd be suspicious about hype-and-recently-introduced-tools as chances are that features will come and go faster than i can follow -- and people will just report "your OS did not compile".
Now, that's just me and i've been trained to think "make", so if you have a good knowledge of ANT, a "userbase" that believe ANT is superior to the rest of the world ( ;D ) and want to try it, go ahead. Probably you'll find people happy to test your OS just because it has been compiled with ANT

Re:ant instead of make?
Posted: Thu Jun 22, 2006 11:29 am
by Candy
Ant seems to be trained toward java usage and working on a certain way. I tend to work in different ways from other people so that counts it out for me.
Jam is better, because it automatically understands C and C++ and performs the necessary dependency checking + it uses multiple cpu's and keeps compiling after errors. That small sum makes me puke and wonder whether they've ever even read the make man page. -k == keep going, as in, keep compiling after errors. -j == use multiple cpu's. A build system that tries to understand my sources is inherently flawed, what if I want to use assembly? or whatnot? or a slightly different language from C that only just doesn't pass their parser?
The only thing I consider wrong with make at the moment (gmake) is that it doesn't change the relative root of parsing when you include a file, which makes the include statement a lot less powerful (say, totally useless for >1 layer of include). If they hadn't done that I would've been using it right now for everything, I'm actually doubting about it. I could make a patch for it (probably will), but that requires everybody to rebuild their make. Anyway...
Re:ant instead of make?
Posted: Thu Jun 22, 2006 11:32 am
by Pype.Clicker
the only thing that could make me change of make system would be the promise of faster compilation -- for instance through a "gcc server" process that would remain up and keep track of pre-parsed header files ... There are gcc-server thing, but (afaik) they're pretty boring to set up so i prefer fine-tuning my dependencies and think twice when i modify some header file

Re:ant instead of make?
Posted: Thu Jun 22, 2006 12:21 pm
by Solar
Candy, I didn't quite get the point of your include gripe. Would you mind elaborating on the point (perhaps by PM if you think it's not that much of public interest)? I've tinkered some with make, and am quite happy with the results, including some tricky includes...
Re:ant instead of make?
Posted: Thu Jun 22, 2006 1:40 pm
by Candy
Solar wrote:
Candy, I didn't quite get the point of your include gripe. Would you mind elaborating on the point (perhaps by PM if you think it's not that much of public interest)? I've tinkered some with make, and am quite happy with the results, including some tricky includes...
Well... I've tried to make something with a generic makefile that each level includes with a bunch of defines for local specifications. I've also tried to make a makefile that includes all sublying makefiles for single-make-compile.
The first failed because:
./makefile:
<generic stuff>
a/makefile:
include ../makefile
a/b/makefile:
include ../makefile
The second include, when executed from that directory, will include a/makefile. That makefile will then, erringly imo, include itself again. You end up with an infinite loop gmake breaks out of since it's pointless.
It fails the other way around too:
./makefile:
include a/makefile
$(TARGET): a/obj.o
-----
a/makefile:
include b/makefile
$(TARGET): b/obj2.o
-----
b/makefile:
obj2.o: something
The first includes the right makefile, the second can't find the b directory.
Re:ant instead of make?
Posted: Sat Jun 24, 2006 4:35 am
by Hogan
I am using this in main Makefile:
Code: Select all
cd init/src && makedepend -o Makefile.dep -I. *.c && $(MAKE)
Makedepend produce something like this to Makefile.dep:
Code: Select all
elf.o: elf.c ../../include/definitions.h elf.h mem.h panic.h
ints.o: ints.c ../../include/definitions.h ints.h mem.h
main.o: main.c ../../include/definitions.h video.h mem.h multiboot.h mt.h \
ints.h elf.h panic.h
mem.o: mem.c mem.h ../../include/definitions.h video.h panic.h
mt.o: mt.c ../../include/definitions.h mt.h
multiboot.o: multiboot.c ../../include/definitions.h
panic.o: panic.c ../../include/definitions.h ints.h panic.h video.h
video.o: video.c video.h ../../include/definitions.h
I have included Makefile.dep at end of init/src/Makefile, so for making objects from sources i need just one generic rule.
Re:ant instead of make?
Posted: Sat Jul 01, 2006 11:23 pm
by zloba
I've switched to SCons everywhere (currently non-OSdev). Works great (edit-compile-whatever cycle). And with some custom scripting, it's doing wonders for multi-project integration and dependencies.
(spam omitted - just read the scons homepage)
Never want to write another makefile..
Re:ant instead of make?
Posted: Mon Jul 10, 2006 3:08 am
by guest
About the problem with the Makefiles Candy mentions, that problem is typically circumvented using a SRCDIR variable.
./Makefile
Code: Select all
SRCDIR = ${pwd}
all: all2
@echo '"all" ran successfully'
include $(SRCDIR)/a/Makefile
./a/Makefile
Code: Select all
all2: all3
@echo '"all2" ran successfully'
include $(SRCDIR)/a/b/Makefile
./a/b/Makefile
Code: Select all
all3:
@echo '"all3" ran successfully'
Re:ant instead of make?
Posted: Mon Jul 10, 2006 10:13 am
by Candy
I did. Up to the previous version of my OS, it contained a bunch of makefiles that would use that exact construction.
Yet, my idea was that you should be able to do a partial compile. How do you make it work with a partial compile (cd a; make; cd ..)?