Skip to content

Commit dd7b276

Browse files
pietvoth-otto
authored andcommitted
README.md: update with information about compilation and installation
1 parent 4d1b0af commit dd7b276

1 file changed

Lines changed: 61 additions & 2 deletions

File tree

README.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ results in a binary size of 118220 bytes. Huge. The same thing compiled with lib
3939
```
4040
m68k-atari-mint-gcc -nostdlib $LIBCMINI/crt0.o hello.c -o hello.tos -s -L$LIBCMINI -lcmini -lgcc
4141
```
42-
(note that - since we compile with -nostdlib - you have to add the gcc runtime support library libgcc.a to your command line for the processors that need it)
42+
(note that - since we compile with -nostdlib - you have to add the gcc runtime support library libgcc.a to your command line for the processors that need it.
43+
Sometimes you will have to specify ` -lgcc -lcmini -lgcc` to avoid 'undefined reference' error messages.)
4344

44-
creates a binary with 11794 byts. About a tenth of the size.
45+
creates a binary with 11794 bytes. About a tenth of the size.
4546

4647
Remember that gcc does not automatically look up multi-lib versions of
4748
libraries in directories specified by -L. If you want to do the same as
@@ -81,6 +82,64 @@ avoid library calls for most integer operations.
8182

8283
With -mfastcall libcmini itself is 3% smaller binary, and the tests/bench test executes 20% faster.
8384

85+
## Compilation
86+
87+
The library can be compiled in standard ('a.out') or `elf' format. In the first case the m68k-atari-mint toolchain is used; in the latter case the m68k-atari-mintelf toolchain. Make sure the proper toolchain is in your PATH before compiling.
88+
89+
The basic command for compilation is `make`. But various compilation options can be given.
90+
Instead of 'Y', also 'yes' can be used:
91+
92+
* `VERBOSE=Y` - Print all commands that are used to compile the library. This option can also be given as an environment variable. All other options must be given as arguments to the `make` command.
93+
* `COMPILE_ELF=Y` - Compile for 'elf' format instead of 'a.out'.
94+
* `ONLY_68K=Y` - Compile only for the 68000, not the other architectures.
95+
* `COMPILE_ELF=Y` - Compile for the 'elf' format instead of 'a.out'.
96+
* `STDIO_WITH_LONG_LONG=Y` - Add code for `long long` to the `printf` family of functions. At the moment this fails.
97+
* `STDIO_MAP_NEWLINE=Y` - Add code to convert NL to CR NL on output to text files, and CR NL to NL on input. This was standard practice on TOS but not on Mint.
98+
99+
The following options are on by default. They can be switched off with `OPTION=no` or `OPTION=N`.
100+
However, when `ONLY_68K=Y` is given, they are switched off and cannot be switched on again.
101+
102+
* `BUILD_CF=N` - Don't compile for the Coldfire (m5475) architecture.
103+
* `BUILD_SOFT_FLOAT=N` - Not sure what this means. Probably don't build for software floating point.
104+
* `BUILD_SHORT=N` - Don't include libraries for short ints (16 bit?)
105+
* `BUILD_FAST=N` - Don't use `-mfastcall` function calls. The default for this option is whether the compiler supports `-mfastcall`.
106+
107+
Example `make` command:
108+
109+
```
110+
VERBOSE=yes make ONLY_68K=yes STDIO_MAP_NEWLINE=Y
111+
```
112+
113+
## Installation
114+
115+
The basic installation command is `make install`. The default install
116+
location is `/usr`, i.e. `/usr/include` and `/usr/lib`. `make install`
117+
should basically get the same options as used for the compilation if
118+
some architectures were omitted, otherwise it will regenerate the
119+
missing ones.
120+
121+
The installation destination can be specified with either the `PREFIX*` options or the `DESTDIR` option:
122+
* `PREFIX=<dir>` - Install in `$PREFIX/include` and `$PREFIX/lib`, unless one or more of the following options are given:
123+
* `PREFIX_FOR_INCLUDE=<dir>` - Directory for the include files. When multiple architectures are present,
124+
only one copy of the include files are installed. Default is `$PREFIX/include`.
125+
* `PREFIX_FOR_LIB=<dir>` - Directory for the library files. Default is `$PREFIX/lib`.
126+
* `PREFIX_FOR_STARTUP=<dir>` - Directory for the startup file (`crt0.o`). Default is `$PREFIX/lib`.
127+
* `DESTDIR=<dir` - Installs the include files in `$(DESTDIR)/usr/include` and the library and startup file in
128+
`$(DESTDIR)/usr/lib`.
129+
130+
The `DESTDIR` and `PREFIX*` options cannot be used together. They can also be given as environment variables.
131+
132+
If the library has been built for multiple architectures, there will be
133+
a subdirectory for each one (except the basic 68000) in the library
134+
directory. For the `elf` version, this applies also to the startup file.
135+
136+
Example `make install` command corresponding to the above compile command:
137+
138+
```
139+
VERBOSE=yes make ONLY_68K=yes PREFIX=/opt/libcmini install
140+
```
141+
The `STDIO_MAP_NEWLINE` option is only relevant at compile time, so this was left out.
142+
84143
## Contribution
85144

86145
Contributions are always welcome.

0 commit comments

Comments
 (0)