<--Last Chapter | Table of Contents | Next Chapter--> |
IDE: TIA supports make. To use make, select it in the project parameters window. |
The make command interprets a series of rules saved in a file called "Makefile". These rules describe which files are dependent on which other files. Each rule is followed by the command needed to update the files, such as the command to compile them.
For example, if you had a Ada program called dbase and it relied on the source files common.adb, scanner.adb and parser.adb, a Makefile might include the rule:
dbase: common.o scanner.o parser.o
This rule says that the dbase executable file depends on the object files for the 3 Ada source files, and to update dbase make has to link the object files with the gnatlink command.
If you are writing an Ada program with C source files, the basic strategy for using make with gnat is to make rules than ensure the C files are compiled properly, and then to finish the project using Gnatmake.
Makefiles can have comments and variables and rules that refer to parameters to the make command as opposed to files. The many options can't be covered here.
To use this make file, type "make" to build your Ada project, or "make clean" to remove any intermediate files produced by the compiler.
The ALT version of Gnat uses uses the name gnatgcc, not gcc, for the GCC compiler. |
# Sample Ada makefile
OBJS = main.o somepackage.o
# How to compile Ada files
.adb.o:
# How to link the main program
main: $(OBJS)
IDE: TIA supports cook. To use cook, select it in the project parameters window. |
cook also comes with a tool to convert Makefiles to cook Howto.cook files.
If you need to install cook, there are four basic steps
are:
When you type "cook", cook looks for a file called Howto.cook. This file, called a "cookbook", contains rules, or "recipes", for building a project.
Each rule has three parts:
main: main.adb
The target is "main". To create main, cook must examine main.adb. If main.adb is newer than main, cook creates a new main by running the Gnatmake command.
Cook comes with some predefined rules for compiling certain kinds of files. These predefined cookbooks can be attached to your Howto.cook file by using "#include". For example,
#include "c"
includes basic rules describing the relationships of C files to
each other.
To cook in parallel, run cook with the -par switch. This option indicates the number of computers cook can use, the default being 4. You can indicate fewer computers. For example, -par=2 will run cook using 2 computers.
To indicate which machines to use, assign the hosts to the parallel_hosts variable.
parallel_hosts = first_computer second_computer third_computer
Simple Howto.cook files will compile in parallel without any
modification.
To use this make file, type "cook" to build your Ada project, or "cook clean" to remove any intermediate files produced by the compiler.
The ALT version of Gnat uses uses the name gnatgcc, not gcc, for the GCC compiler. |
/* ---------------------------------------- */
OBJS = main.o somepackage.o;
/* How to compile individual Ada files */
%.o: %.adb {
/* How to compile individual C files */
%.o: %.c {
/* How to bind and link the main program */
main: [OBJS] {
/* How to clean up intermediate files */
clean: {
There are many other features in cook not covered here. More
information about cook can be found in the Cook User Manual and the
Cook Reference Manual.
Included with Linux, autoconf creates a shell script called "configure". Customized for your project, when this script is executed, it scans the features of the particular UNIX that it is running on and tailors all Makefiles accordingly. It optionally produces a C file called "config.h" which contains information about the features it found.
automake, the other half of autoconf, creates a Makefile.in using templates called "Makefile.am". Once automake is finished, all you have to do is run "configure" to make your final makefile and type "make" to build the project on any version of UNIX.
It is possible to use autoconf and automake on Ada Makefiles, but this topic is beyond the scope of this book. More information on automake and autoconf can be found using "info autoconf" and "info automake".
The following is an example of what happens when you run an autoconf configure script, as run for the FreeAmp program.
checking host system type... i686-pc-linux
PRCS, the Project Revision Control System, is a source control system designed for large projects. It is easier to use and requires less administration than CVS, especially when a large number of files is involved. For example, PRCS (almost) always performs all actions across the entire project while CVS commands act only on your current position: if you are in a subdirectory, CVS only updates the subdirectory while PRCS will back up to the root directory for the project before performing any work. PRCS also handles file permissions while CVS does not.
Like CVS, PRCS uses a directory called a repository to store project files. The repository is directory is specified in a PRCS_REPOSITIORY environment variable.
PRCS uses project files, .prj, to manage sets of files at once. Use the project file to control PRCS's behaviour, such as listing file names or extensions that you don't want to add to a project.
Basic command include
You can find out more about, and get the latest version here: http://www.xcf.berkeley.edu/~jmacd/prcs.html
<--Last Chapter | Table of Contents | Next Chapter--> |