make using MD5 instead of timestamps
remodel is a dependency management program. Dependencies are specified in a file with the following syntax:
target1 [ , target2 ... ] <- source1 [ , source2 ... [ : "command" ] ]
remodel, by default looks for (r|R)emodelfile. remodel can be made to use arbit filenames using -f switch. remodel, execute in parallel as many dependencies as it can. The amount of parallelism can be controlled using -j command line switch. remodel should be executed in the directory in which all dependencies are assumed to reside in rules file.
Usage: remodel [ options ] [ target ] ...
Options:
-j To specify the number of jobs to execute in parallel.
-f To specify a file other than (r|R)emodelfile.
-B To force rebuild of dependencies.
-help To display help menu.
--help to display help menu.
=============================
remodel is written in ocaml. The dependencies required to build remodel are
- ocaml v4.00.1
- ocamlgraph
opam can be used to manage compiler versions and library dependencies.
Binary name : remodel.native
Build Instructions :-
Execute the following commands in the project root directory
- ocaml setup.ml -configure
- ocaml setup.ml -build
Optional
- ocaml setup.ml -install
===========================
Tests are located under test directory. They can be run using remodel.native built in the previous step. The details are as follows :
Use command "remodel.native [ -f <remodelfile name> ] <arg>" to run a test
remodelfile name | arg | test description |
---|---|---|
nodefaultremodel | - | DEFAULT target missing |
nodefaultremodel | c | Rule missing to make a dependency |
compile/ | - | builds example baz program |
multiple_targets/ | - | builds multiple target |
cycle/* | -/a | Cyclic dependency detection |
vanilla/ | - | alternate actions, quick playground |
=========================================
remodel parses the input file to form a dependency graph. Unless any particular target is specified on command line, remodel looks for a DEFAULT target in rules file to build.
remodel maintains a record of md5 digest of files in file index.rmd located in a hidden directory .remodel. Using entries in this record, remodel is able to determine if a file has changed from its previous build. Before triggering any command, current digest of file is computed and is matched with digest entry of the file. Target is rebuilt if the digests do not match.
Upon changing any command to build the target, remodel does not rebuilds the target on the next run. The developer, if required, can force remodel to rebuild target using
remodel.native -B target
index.rmd is a plain text file that contains dependency file path and its md5 digest. Only dependency files that exist in rules file are present in index.rmd. remodel checks for existence of .remodel/index.rmd on every run. If it is not found then remodel creates one, builds the target specified and updates index.rmd with new digest. As dependency files are changed, their md5 is updated in this file.
Over time as project evolves, some files may be renamed. This renaming may lead to garbage entries in index.rmd. remodel takes care of this and prunes non-existent entries after a successfull build.
remodel determines which rules can be executed independent of each other and executes them in parallel. The degree of parallelism can optionally be controlled using "-j" command line switch. remodel assigns a logical time to every dependency and executes dependency with same logical timestamp in parallel.
In a directory, remodel maintains exclusiveness by taking a lock on index.rmd file so that another remodel process cannot clobber the project directory.