Subversion Repositories gelsvn

Rev

Rev 39 | Rev 114 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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