7 How to Build Executables

ALLPROSE was originally intended to create libraries. However, it also has a support for the creation of executables.

Since most functionality should go into the library, the main executable would then be as simple as

<<*>>=  
#include "myalps"  
myalps(arguments$CommandLine);  
@

where myalps: Array String -> () is a function that does the actual work. (Replace in the above code myalps by the name myalps of your library.) That function should be a member of the library.

The above code should be written to a file somename.as.nw in PROJECTROOT. Furthermore, as an exception to the general rule that .as files need not be listed in a Makefile, put the filename into Makefile.def.nw as a line of the following form.

EXECUTABLEFILES=somename.as

In case of several executables files just list the names as in the FILES variable, i. e.separated by spaces.

In order to compile the executable, issue the command

make EXECUTABLE=somename executablevariants

or simply

make somename

should suffice.

Convention 3 One has to have a name (somename) different from projectname (myalps) which appears in the #include statement. The Aldor compiler uses the current directory as the first search path for the include file. Therefore if somename=myalps then the file would falsely load itself.

It is, of course, also clear that one cannot have executable names that agree with the name of any first level directory like, for example src or test.