Difference between revisions of "Fiji/Build System"

(Calling Fiji's build system: suggest using Build.sh to bootstrap Fiji/Fiji Build)
m (Added categorization)
Line 97: Line 97:
  
 
TODO
 
TODO
 +
 +
 +
[[Category:Development]]

Revision as of 03:39, 14 April 2009

Introduction

The goal of Fiji's build system is to make it extremely simple to define the tasks that are needed for Fiji.

The system finds its targets in a file called Fakefile (Fiji's mAKE FILE). The contents of that file look like this:

all <- example.jar another-example.jar

example.jar <- example/**/*.java README LICENSE

another-example.jar <- SomeClass.java

This file defines three targets: the default target called 'all', and two targets building .jar files. The operation is defined implicitly by the name of the target.

Nomenclature

The Fakefile contains rules for targets that are defined in the following form:

target <- prerequisites

If a prerequisite is also the target of another rule, the program builds that target before building the current one.

Calling Fiji's build system

If you have a working Fiji launcher, you can call the build system like this:

./fiji --build

If your Fiji launcher does not work, or you do not have one yet, bootstrap it like this:

./Build.sh fiji

You can ask the program to build only specific targets by passing them as parameters:

./fiji --build ij.jar

Further, all variable definitions passed as parameters will override what is found in the Fakefile:

./fiji --build debug=true fake.jar

Target types

The following target types are available:

The all target
The first target in the Fakefile is always the default target. It lists all subtargets that are to be made by default.
.jar targets
If the target name ends with .jar, a .jar is made. If the last prerequisite also ends in .jar, the build system will copy that file instead of trying to compile .java files.
The system is actually quite clever when it comes to putting the compiled classes into the .jar files; it figures out in which package the class lives, and uses the corresponding path.
.class targets
Targets whose name end in .class compile a single .java file (the last prerequisite is used to define that), and copies the resulting .class file (and the other generated classes that are used by this class) to the given destination.
.cxx and '.c' targets
If the last prerequisite ends in .cxx or .c, the GNU C compiler is called to compile the prerequisites.
"SubBuild" targets
If the last prerequisite specifies a directory, the build system looks for a Fakefile or a Makefile there. According to what was found, Fiji's build system or make is called, and the target is copied over to the given destination.
Special targets
Some targets are predefined, but can be overridden in the Fakefile. These include clean, show-vars and others.

Special targets

clean
Remove all generated targets. This target is not well tested. Use with care.
show-vars
Show all defined variables
show-rules
Show all rules (with expanded variables)
check
Instead of building the targets, this target just shows which targets are not up to date and would be built.

Variables

You can define variables in the usual way:

ONE=1

Variables can be referenced in all parts of a rule. Variables can be overridden per-target:

ONE(ij.jar)=2
ij.jar <- bla$ONE.java

Predefined variables

TODO

Other features

Precompiled targets

TODO