Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 61 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ results in a binary size of 118220 bytes. Huge. The same thing compiled with lib
```
m68k-atari-mint-gcc -nostdlib $LIBCMINI/crt0.o hello.c -o hello.tos -s -L$LIBCMINI -lcmini -lgcc
```
(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)
(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.
Sometimes you will have to specify ` -lgcc -lcmini -lgcc` to avoid 'undefined reference' error messages.)

creates a binary with 11794 byts. About a tenth of the size.
creates a binary with 11794 bytes. About a tenth of the size.

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

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

## Compilation

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.

The basic command for compilation is `make`. But various compilation options can be given.
Instead of 'Y', also 'yes' can be used:

* `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.
* `COMPILE_ELF=Y` - Compile for 'elf' format instead of 'a.out'.
* `ONLY_68K=Y` - Compile only for the 68000, not the other architectures.
* `COMPILE_ELF=Y` - Compile for the 'elf' format instead of 'a.out'.
* `STDIO_WITH_LONG_LONG=Y` - Add code for `long long` to the `printf` family of functions. At the moment this fails.
* `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.

The following options are on by default. They can be switched off with `OPTION=no` or `OPTION=N`.
However, when `ONLY_68K=Y` is given, they are switched off and cannot be switched on again.

* `BUILD_CF=N` - Don't compile for the Coldfire (m5475) architecture.
* `BUILD_SOFT_FLOAT=N` - Not sure what this means. Probably don't build for software floating point.
* `BUILD_SHORT=N` - Don't include libraries for short ints (16 bit?)
* `BUILD_FAST=N` - Don't use `-mfastcall` function calls. The default for this option is whether the compiler supports `-mfastcall`.

Example `make` command:

```
VERBOSE=yes make ONLY_68K=yes STDIO_MAP_NEWLINE=Y
```

## Installation

The basic installation command is `make install`. The default install
location is `/usr`, i.e. `/usr/include` and `/usr/lib`. `make install`
should basically get the same options as used for the compilation if
some architectures were omitted, otherwise it will regenerate the
missing ones.

The installation destination can be specified with either the `PREFIX*` options or the `DESTDIR` option:
* `PREFIX=<dir>` - Install in `$PREFIX/include` and `$PREFIX/lib`, unless one or more of the following options are given:
* `PREFIX_FOR_INCLUDE=<dir>` - Directory for the include files. When multiple architectures are present,
only one copy of the include files are installed. Default is `$PREFIX/include`.
* `PREFIX_FOR_LIB=<dir>` - Directory for the library files. Default is `$PREFIX/lib`.
* `PREFIX_FOR_STARTUP=<dir>` - Directory for the startup file (`crt0.o`). Default is `$PREFIX/lib`.
* `DESTDIR=<dir` - Installs the include files in `$(DESTDIR)/usr/include` and the library and startup file in
`$(DESTDIR)/usr/lib`.

The `DESTDIR` and `PREFIX*` options cannot be used together. They can also be given as environment variables.

If the library has been built for multiple architectures, there will be
a subdirectory for each one (except the basic 68000) in the library
directory. For the `elf` version, this applies also to the startup file.

Example `make install` command corresponding to the above compile command:

```
VERBOSE=yes make ONLY_68K=yes PREFIX=/opt/libcmini install
```
The `STDIO_MAP_NEWLINE` option is only relevant at compile time, so this was left out.

## Contribution

Contributions are always welcome.
Expand Down