The file <#7109#>Makefile<#7109#>
in the LINK_BASE directory is useful
not only as the root makefile of the system, but also as a makefile
for stand-alone user applications which use LINK's libraries.
The programmer may link his or her C/C++ code with the LINK libraries
to produce a C++ program, or to produce a new version of the whole
system with new features.
<#7112#>
Figure 2.2:
Makefile macros intended to be modified by the LINK library
programmer.
#figure7112# |
<#7112#>
In order to use the makefile to compile your Link applications,
you must add your source files to the USER_SOURCE list in the
Makefile (see Figure~#fig:make-demo#7116>, making sure to end each line
except the last one with a backslack. There is a demonstration
application in $LINK_BASE/standalone, which the Makefile
is set up to build. To build and run this example application,
Copy all of the files in that directory and the LINK Makefile to an
an empty directory. Then you can type
<#7117#>
make demoNoGUI
<#7117#>
to build the first demo. The result is a program called <#7119#>demo<#7119#>
which computes a simple function using LINK objects.
The function computed by the demo program can also be included into
the LINK interface so that users may experiment with it interactively.
To build a version that includes the GUI, reverse the comments in
USER_SOURCE and EXECUTABLE so that demo.cpp and linkUserInit.cpp
are compiled. A new version of the system which includes new
commands is then built with the command:
<#7120#>
make -D STK_GUI=yes demo
<#7120#>
NOTE: The LINK Makefile links your program with all of the
Link libraries (layouts, generators, algorithms, graph, and basic).
If executable size is a problem for you, edit the LINK_LIBS macro
in the makefile so that only the appropriate libraries are included.
Note also that since <#7208#>LINK~<#7208#>uses manual template instantiation
with g++,
new types of objects (e.g. Set<#7224#>;SPMlt;<#7224#>NewObject<#7226#>;SPMgt;<#7226#>) need special treatment.
<#7209#>LINK~<#7209#>employs some mechanisms which automatically generate template
instantiations.~ The programs which accomplish this are
<#7123#>instantiate<#7123#> and
<#7125#>genMethods<#7125#>, located in the directory
$LINK_BASE/autowrap. These programs are currently undocumented,
but dozens of examples of their usage to generate template
instantiations and STk wrappings for various Collection and
Container objects such as sets and lists are found in the
<#7127#>GENERATION_COMMANDS.*<#7127#> files located in the directories
<#7128#>linkTemplates<#7128#>, <#7129#>STkTemplates<#7129#>, and <#7130#>autogenSTkMethods<#7130#>
under the <#7134#>src/basic<#7134#>, <#7135#>src/graph<#7135#>, and <#7136#>src/userobj<#7136#>
directories.
When the requirements for instantiation new templates exceed the
capabilities of <#7137#>instantiate<#7137#> and <#7138#>genMethods<#7138#>,
manually-generated template instantiations are put into the
files <#7139#>basicTemplate.cpp<#7139#>, <#7140#>graphTemplate.cpp<#7140#>, and
<#7141#>userobjTemplate.cpp<#7141#>. Note that $LINK_BASE/bin
contains some useful utilities for quick editing and searching
in the <#7210#>LINK~<#7210#>file hierarchy.