| 1 | |
| 2 | = SoCLib's compilation helper = |
| 3 | |
| 4 | == Why ? == |
| 5 | |
| 6 | === We use a lot of tricky things things === |
| 7 | |
| 8 | * Different SystemC backends (SystemC-OSCI, SystemCASS, SoCView) |
| 9 | each of them is a different implementation of the same LRM, and |
| 10 | yields incompatible objects |
| 11 | * Templated classes, with separate implementation. |
| 12 | In order to reduce compilation time when a file changes, splitting |
| 13 | implementation from header is the right thing to do. Unfortunatelly |
| 14 | it involves manually instaciating source code for each used |
| 15 | template. |
| 16 | * Different build modes (debugging, profiling release, others ??) |
| 17 | * Compiled objects reuse: as we may build lots of SoCs with minor |
| 18 | modifications, reusing compiled objects from one build to the other |
| 19 | seems interesting (considering templated C++ build time) |
| 20 | |
| 21 | === Reuse of current tools ?? === |
| 22 | |
| 23 | This could be seen as reimplementing make, or even SCons, and this is |
| 24 | not totally false. This is all about flexibility, and user-input |
| 25 | readibility. |
| 26 | |
| 27 | This very tool has been implemented as a `make` wrapper before, |
| 28 | generated Makefiles were unreadable (all templates parameters in the |
| 29 | middle, ...), and it did not work so well. It had been developped in a |
| 30 | week, debugged in two weeks. |
| 31 | |
| 32 | Soclib-cc has been totally developped in 16 hours. |
| 33 | |
| 34 | = Configuration = |
| 35 | |
| 36 | In order to compile SoCLib objects, we need: |
| 37 | * a working SystemC installation |
| 38 | * a working GNU-Bfd installation (used for loading binaries into the platform) |
| 39 | * a working GNU-C++ compiler |
| 40 | |
| 41 | Soclib-cc processes three files in order: |
| 42 | 1. ''soclib-dir]''`/etc/soclib.conf` |
| 43 | 1. `~/.soclib/global.conf` |
| 44 | 1. `./soclib.conf` |
| 45 | |
| 46 | These files contain multiple concurrent configurations for building |
| 47 | SoCLib. One of them will be chosen (explicitely) as the default |
| 48 | one. Others may be used on demand (through command-line or local |
| 49 | configuration file) |
| 50 | * File ![1] is installation-global. It should be modified by the |
| 51 | administrator for a network-wide configuration. |
| 52 | * File ![2] is useful for a developper's own configuration. This |
| 53 | allows to use a local development branch of a local SystemC, ... |
| 54 | * File ![3] is directory-local, this allows to choose different |
| 55 | flavours of previously declared configurations |
| 56 | |
| 57 | |
| 58 | == Usage == |
| 59 | |
| 60 | Soclib-cc may be used two ways: |
| 61 | * As a compiler wrapper. It will just be a CXX wrapper, handling |
| 62 | compilation or linkage on demand. This can be useful for external |
| 63 | Makefile integration. |
| 64 | * As a complete platform compiler. From an ad-hoc platform definition |
| 65 | (wrappers can be written to accept other formats), the complete |
| 66 | simulator will be compiled. |
| 67 | |
| 68 | Try running `soclib-cc -h`. |
| 69 | |
| 70 | === As a compiler === |
| 71 | |
| 72 | The usual way: |
| 73 | |
| 74 | {{{ |
| 75 | $ soclib-cc -c -o obj.o file.cc |
| 76 | $ soclib-cc -o sim obj.o ... |
| 77 | }}} |
| 78 | |
| 79 | === As a platform compiler === |
| 80 | |
| 81 | {{{ |
| 82 | $ soclib-cc -p platform_def |
| 83 | }}} |
| 84 | |
| 85 | == Global flags == |
| 86 | |
| 87 | -v:: |
| 88 | Print command lines |
| 89 | -q:: |
| 90 | Dont say anything |
| 91 | -m MODE:: |
| 92 | Change compilation mode (release, debug, prof) |
| 93 | This changes in an homogenous way the building |
| 94 | |
| 95 | |
| 96 | == Object repository == |
| 97 | |
| 98 | As objects can be reused between builds, or even between platforms, we |
| 99 | may want to place objects in a global repository. |
| 100 | |
| 101 | Default repository is in current directory, in 'repos/'. If you want, |
| 102 | you can specify an absolute path in configuration, enabling a global |
| 103 | object repository (per user, per host, per network...). |