The build system now gets dependencies "righter" than before.

It separates the checking of three stages:

1a. Has the Felix compiler been changed?
1b. Is the cached syntax automaton valid?
1c. Is the cached pre-compiled standard library valid?

If not, wipe the cache.

2. Is the C++ generated by Felix up to date?

If not, run the Felix compiler.
The test is done by checking file of dependent files
in the cache (an *.dep file). This file is generated by
the Felix compiler along with the C++.

3. Is the binary target up to date?

If not, run the C++ compiler. This includes linkage.
This check is done by comparing the *.dep file
with the binary, as well as any additional C++
and object files.

Now run the binary if required.

TODO.

There are two branches.

TODO1. The checks at the moment do not take account
of "command line switches" or the environment other than
the file system. Changing switches, eg optimisation level,
or, changing some environment variable, may require
a rebuild. In particular changing the toolchain (C++ compiler)
may require a rebuild. None of this is checked at the moment,
so if you do this you have to pass the --force switch (or just
delete the cache with flx --clean).

I propose to leave this for the moment.

TODO2. Felix can build C++ programs right now,
using a stub Felix program. (I will fix this so you don't
need any Felix at all, so "flx" will be usable as a C++
build system).

Currently Felix just checks the time stamps on any C++
files given in the command line against the object
files that would be generated. So it may fail to compile
the C++ code if a dependent #include file has changed.

I am going to fix this next, because at the moment building
the RTL takes forever, even when it is up to date.
The build tool compiles the RTL directly, not using flx.

So I plan to modify the toolchains so C++ compiles do
dependency checking, and skip compilation if the sources
are up to date. The method is the same as what flx uses:
we write a dependency file, and we use that to calculate
the source time stamp and compare with the target object file.
The dependency file is basename.d.

A stub function has already been included in the toolchain
interface for testing this. This function just does

        gcc -M -c filename.c

i.e. uses the compiler to list the dependencies. This is cool.
The result will be put in an *.d file, parsed, then used
for the usual checking.

More precisely, and this is a bit tricky, the technology requires
using the existing *.d file if it is uptodate.  The reason is, nasty.
If you change the environment, the dependencies can change.
For example a -I include path switch.

If you use the old dependency file, you're checking the wrong
source files. But if you use the new one, you're checking
the new files but they weren't the ones used to build the
object file!  So what you do is check the time stamp of the
dependency file.

To make this work, we have to generate a temporary dependency
file and compare the *contents* of that file with the old one.
If nothing has changed, leave the old file alone. Otherwise
copy the temporary dependency file, which fixes the dependencies
and invalidates the object file by making the timestamp on the
dependency file newer than the object file.

Felix doesn't do this with Felix, because flxg compiler
is only invoked (writing the new dependency file) if the
sources are out of date. There's no separate way to generate
the dependencies other than run flxg at the moment.

So the checks will be in the toolchains, and once that works
then we can compile C++ with automatic dependency checking.

Good bye to Make.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to