From: Stefan Lang Date: 2005-07-16T09:42:35+09:00 Subject: Re: rake question --Boundary-00=_jhF2CSKE7a36NCB Content-Type: Multipart/Mixed; boundary="Boundary-00=_jhF2CSKE7a36NCB" --Boundary-00=_jhF2CSKE7a36NCB Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Friday 15 July 2005 22:24, Joe Van Dyk wrote: [...] > > What I'm trying to do is become a better software developer. So, I've > > got a couple C and C++ books. I want to do the examples in them. So > > I'll have directories like > > / > > /c/ > > /c/problem_1_1/ > > /c/problem_1_2/ > > /c/problem_1_2/main.c > > /c/problem_1_2/foo.c > > /c/problem_1_2/foo.h > > /c/problem_1_2/test_foo.c > > /c++/ > > > > > > And so on. I want a Rake file that will go into the directory > > structure, compile all the code, compile all the test code, and run > > the tests. Then I want it to create syntax-highlighted webpages that > > shows for each example the code and the output and the tests, and then > > posts them to a website where I can get comments on them. > > > > Perhaps I'll have separate build directories (so I can build and test > > the code on Windows, Linux, FreeBSD, and OS X).. > > > > So, I'm looking for help for that. > > And I haven't looked at Rant much, would it be better for my purposes? > Rake and Rant are both general purpose build utilities, right? Yes, but Rant can automatically determine the dependencies between C/C++ sources files (by extracting #include statements) and it has some support for multiple directories (i.e. more than one Rantfile). Actually a good example. I came up with the following solution for Rant: % ls c c++ Rantfile rule.rf % ls c problem_1_1 template.rf % ls c++ problem_1_1 template.rf The main Rantfile in the root directory copies the c/template.rf Rantfile into all c/problem_* directories and the c++/template.rf into all c++/problem_* directories. If you run rant in the root directory, it will compile all tests and run them. To compile only, run rant with "build" as only argument. During work on one of the exercises you can change into the c(++)/problem* directory and run rant to only compile/run the current exercise. The example is in the attachment. The only problem is, that the last Rant release contains a bug with regards to the Rule/subdirectory combination. If you want, I can send you my development version offlist. -- Stefan --Boundary-00=_jhF2CSKE7a36NCB Content-Type: application/x-tgz; name="c_cpp_exercises.tgz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="c_cpp_exercises.tgz" H4s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