Subversion Repositories gelsvn

Rev

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

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