2 |
bj |
1 |
|
12 |
jab |
2 |
GEL README, Andreas Bærentzen, March 05
|
2 |
bj |
3 |
|
12 |
jab |
4 |
This README describes the GEL project. GEL stands for Geometry and Linear
|
|
|
5 |
Algebra which are the constituents we will mostly put into this library.
|
|
|
6 |
|
|
|
7 |
This is a complex source tree which is intended for use both under a
|
114 |
jab |
8 |
variety of unix platforms and under windows. This README is mostly for
|
|
|
9 |
unix users. Windows users should also consult README_MSVC
|
12 |
jab |
10 |
|
2 |
bj |
11 |
======================================================================
|
|
|
12 |
|
|
|
13 |
----------------------------------------------------------------------
|
|
|
14 |
1. INTRODUCTION
|
|
|
15 |
----------------------------------------------------------------------
|
|
|
16 |
|
|
|
17 |
In the following, I discuss the structure of the source code and how to
|
|
|
18 |
add new directories to the framework.
|
|
|
19 |
|
|
|
20 |
The idea is that this framework should be a) simple to use and b) let
|
|
|
21 |
people easily compile the same source code under various unix platforms.
|
|
|
22 |
A seperate configuration is kept for each combination of OS, architecture,
|
|
|
23 |
and compiler. It is possible to specify targets release or debug.
|
|
|
24 |
|
|
|
25 |
Source files are compiled in build directories, and separate build
|
|
|
26 |
directories are kept for each unique combination of
|
|
|
27 |
|
|
|
28 |
os architecture compiler target
|
|
|
29 |
|
|
|
30 |
such as
|
|
|
31 |
|
|
|
32 |
Linux_i686_g++3_debug
|
|
|
33 |
|
|
|
34 |
this makes it easier to work in a heterogenous environment or to
|
|
|
35 |
experiment with seperate compilers or just to switch between debug mode
|
|
|
36 |
and optimized.
|
|
|
37 |
|
|
|
38 |
To see how to use the framework, you may skip to section 5.
|
|
|
39 |
|
|
|
40 |
----------------------------------------------------------------------
|
|
|
41 |
2. DIRECTORY STRUCTURE
|
|
|
42 |
----------------------------------------------------------------------
|
|
|
43 |
|
|
|
44 |
The directories under the root of the source tree (where you find this
|
|
|
45 |
README) are
|
|
|
46 |
|
12 |
jab |
47 |
src - Source code for GEL libraries
|
|
|
48 |
apps - Source code for applications
|
114 |
jab |
49 |
apps - Source code for test programs
|
2 |
bj |
50 |
doc - Documentation
|
|
|
51 |
bin - Executables
|
|
|
52 |
lib - Libraries
|
|
|
53 |
makefiles - As the name suggests, makefiles
|
|
|
54 |
|
12 |
jab |
55 |
src contains a number of subdirectories each of which represents a
|
|
|
56 |
link library. apps also contains subdirectories, however each of these
|
2 |
bj |
57 |
is supposed to contain source code for an executable.
|
|
|
58 |
|
|
|
59 |
----------------------------------------------------------------------
|
|
|
60 |
3. FILE NAMES
|
|
|
61 |
----------------------------------------------------------------------
|
|
|
62 |
|
|
|
63 |
source files are *.c or *.cpp depending on whether it is C or C++
|
|
|
64 |
header files are named *.h
|
|
|
65 |
|
|
|
66 |
----------------------------------------------------------------------
|
|
|
67 |
4. MAKEFILES
|
|
|
68 |
----------------------------------------------------------------------
|
|
|
69 |
|
|
|
70 |
Some defintions:
|
|
|
71 |
----------------
|
|
|
72 |
|
|
|
73 |
The PLATFORM is a string concatenation of the os cpu and compiler, e.g.
|
|
|
74 |
|
|
|
75 |
Linux_i686_g++
|
|
|
76 |
|
58 |
jab |
77 |
The TARGET is either `debug' or `release'. By default it is debug. It is
|
|
|
78 |
recommended that you do _not_ hardwire your own default into the makefiles
|
|
|
79 |
as I did for many years. It seems better to define the variable when running
|
|
|
80 |
make, using "make TARGET=release" or by setting the target variable in the
|
|
|
81 |
environment.
|
2 |
bj |
82 |
|
|
|
83 |
|
|
|
84 |
Make'ing from the source root
|
|
|
85 |
-----------------------------
|
|
|
86 |
|
|
|
87 |
Just typing
|
|
|
88 |
> make
|
|
|
89 |
|
|
|
90 |
from the root of the source tree will cause first every library and
|
|
|
91 |
then every application to be remade. However, there are several
|
|
|
92 |
targets.
|
|
|
93 |
|
58 |
jab |
94 |
make all - equivalent to "make lib app"
|
|
|
95 |
|
2 |
bj |
96 |
make lib - make all libraries
|
|
|
97 |
|
|
|
98 |
make app - make all applications
|
|
|
99 |
|
|
|
100 |
make clean - clean all library directories and app directories.
|
|
|
101 |
this removes only files pertaining to the current
|
|
|
102 |
platform and target (release/debug). This also
|
|
|
103 |
removes generated libraries.
|
|
|
104 |
|
|
|
105 |
make distclean - cleans and completely removes all build directories.
|
|
|
106 |
|
|
|
107 |
make platform - copies a template to OS_CPU_COMPILER.mk in the
|
58 |
jab |
108 |
makefiles directory. Use this only if you know what you
|
|
|
109 |
are doing.
|
2 |
bj |
110 |
|
58 |
jab |
111 |
make install - Copies header files and libraries to the appropriate place
|
|
|
112 |
which is /usr/local by default. The libraries which are
|
|
|
113 |
copied are either the debug or release versions depending
|
|
|
114 |
on the active target. Right now, install does not install
|
|
|
115 |
applications since many are little test programs that do
|
|
|
116 |
not belong in your path.
|
|
|
117 |
|
|
|
118 |
|
2 |
bj |
119 |
Make'ing in subdirectories
|
|
|
120 |
--------------------------
|
|
|
121 |
|
39 |
bj |
122 |
Go to a subdirectory of src, say src/somedir.
|
2 |
bj |
123 |
Here you have the following options:
|
|
|
124 |
|
58 |
jab |
125 |
make
|
2 |
bj |
126 |
make lib
|
|
|
127 |
make clean
|
|
|
128 |
|
58 |
jab |
129 |
The first two invocations are identical and will rebuild all sourcefiles and
|
|
|
130 |
put them in a library directory. The latter will remove all object and
|
|
|
131 |
dependency files (but only for the current platform
|
|
|
132 |
(e.g. Linux_i686_g++_debug) The default target is lib.
|
2 |
bj |
133 |
|
39 |
bj |
134 |
Go to a subdirectory of apps, say apps/somedir.
|
2 |
bj |
135 |
Here you have the following options:
|
|
|
136 |
|
58 |
jab |
137 |
make
|
|
|
138 |
|
|
|
139 |
or
|
|
|
140 |
|
2 |
bj |
141 |
make app
|
|
|
142 |
|
|
|
143 |
will recompile the source files in the current directory and build the
|
|
|
144 |
programs. This is the default target. When compiled, the application is
|
58 |
jab |
145 |
moved to wherever/GEL/bin
|
2 |
bj |
146 |
|
|
|
147 |
make force
|
|
|
148 |
|
|
|
149 |
does the same but tries first to recompile all libraries that the
|
|
|
150 |
applications in somedir depend on. This is the safe way to recompile,
|
|
|
151 |
but it takes a few seconds more, so if you are sure the libraries are
|
|
|
152 |
up to date, just go make.
|
|
|
153 |
|
|
|
154 |
make clean
|
|
|
155 |
|
|
|
156 |
works like above.
|
|
|
157 |
|
39 |
bj |
158 |
Makefiles in subdirectories under apps should generally be edited.
|
|
|
159 |
When create by `make makefiles' the Makefile in apps/somedir looks
|
2 |
bj |
160 |
like this
|
|
|
161 |
|
|
|
162 |
PROGRAMS = prog1 prog2
|
|
|
163 |
OWN_LIBS = Lib1 Lib2
|
|
|
164 |
LIBS = ${GLLIBS} ${XLIBS} -lm -lz -lexpat
|
|
|
165 |
|
|
|
166 |
Add something like this
|
|
|
167 |
|
|
|
168 |
PROGRAMS = prog1 prog2
|
|
|
169 |
OWN_LIBS = Lib1 Lib2
|
|
|
170 |
LIBS = ${GLLIBS} ${XLIBS} -lm -lz -lexpat
|
|
|
171 |
|
|
|
172 |
where prog1 and prog2 are programs you wish to create. These must
|
|
|
173 |
correspond to source files with the same name and suffix .cpp. In
|
|
|
174 |
other words,
|
|
|
175 |
|
|
|
176 |
prog1.cpp
|
|
|
177 |
prog2.cpp
|
|
|
178 |
|
|
|
179 |
must exist (and contain a main function)
|
|
|
180 |
|
|
|
181 |
Lib1 and Lib2 are libraries that must also be in the directory structure,
|
39 |
bj |
182 |
i.e. under src there are subdirectories
|
2 |
bj |
183 |
|
39 |
bj |
184 |
src/Lib1
|
|
|
185 |
src/Lib2
|
2 |
bj |
186 |
|
|
|
187 |
the files in these subdirectories will be compiled and put in library
|
|
|
188 |
files named libLib1.a under lib. More precisely it will be put here:
|
|
|
189 |
|
|
|
190 |
lib/PLATFORM_TARGET/
|
|
|
191 |
|
|
|
192 |
PLATFORM and TARGET are defined above. Another library directory are for
|
|
|
193 |
precompiled libraries whose source code is not a part of this tree. Put
|
|
|
194 |
such libraries here:
|
|
|
195 |
|
|
|
196 |
lib/PLATFORM/
|
|
|
197 |
|
|
|
198 |
this directory is created by
|
|
|
199 |
|
|
|
200 |
make platform from the source root.
|
|
|
201 |
|
|
|
202 |
----------------------------------------------------------------------
|
|
|
203 |
5. CONFIGURATION
|
|
|
204 |
----------------------------------------------------------------------
|
|
|
205 |
|
|
|
206 |
When you add a new project to this framework, you should go through
|
|
|
207 |
the following steps:
|
|
|
208 |
|
39 |
bj |
209 |
Add directories for libraries under src. E.g. add
|
2 |
bj |
210 |
|
39 |
bj |
211 |
mkdir src/somelib
|
2 |
bj |
212 |
|
|
|
213 |
Then add directories for applications:
|
|
|
214 |
|
39 |
bj |
215 |
mkdir apps/someapp
|
2 |
bj |
216 |
|
|
|
217 |
Copy appropriate source files to these directories and then edit
|
|
|
218 |
|
|
|
219 |
makefiles/config.mk
|
|
|
220 |
|
|
|
221 |
to tell us which compiler to use (leave blank to use default)
|
58 |
jab |
222 |
|
2 |
bj |
223 |
Finally, from the source root type
|
|
|
224 |
|
|
|
225 |
make platform
|
|
|
226 |
|
|
|
227 |
Depending on your compiler you may now have to edit the makefile called
|
|
|
228 |
|
|
|
229 |
makefiles/PLATFORM.mk
|
|
|
230 |
|
|
|
231 |
to set special compile flags. No go
|
|
|
232 |
|
|
|
233 |
make makefiles
|
|
|
234 |
|
|
|
235 |
Finally you are all set. Go
|
|
|
236 |
|
|
|
237 |
make
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
----------------------------------------------------------------------
|
|
|
241 |
6. TODO
|
|
|
242 |
----------------------------------------------------------------------
|
|
|
243 |
|
|
|
244 |
- No real testing of blended C and C++.
|
|
|
245 |
- No dependency computation for .c
|
|
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
|