build-system.md (1480B)
1 2 # Build System Notes 3 4 Define projects in `project/NAME.lib.mk` (for libraries) or `project/NAME.app.mk` (for executables) 5 6 ## Common Module Parameters 7 8 `MOD_NAME`: Name of the project. Must be unique. 9 Libraries must be named such that `libNAME/inc` is their include directory and their generated library will be `out/libNAME.a` 10 11 `MOD_SRC`: List of source files (`.c` or `.S`). Paths must be relative to the top of the project. 12 13 `MOD_LIB`: List of libraries the module depends on. Bare library name, for example `c` for `libc`, etc. 14 15 ## Application Parameters 16 17 `MOD_LDSCRIPT`: alternate linker script 18 19 `MOD_EXT`: specify a binary file to include. It will be 4-byte-aligned and sandwiched between `__extra_start` and `__extra_end` symbols. 20 21 `MOD_QEMU_FB`: If defined, this when `make run.NAME` is invoked to run this module under Qemu, the framebuffer will be enabled. 22 23 ## Application Build Outputs 24 25 `out/NAME/...`: Intermediate files (`.o`, `.d`, etc) 26 27 `out/NAME.elf`: ELF binary with full symbols, debug info, etc 28 29 `out/NAME.bin`: Raw binary file for loading directly into memory 30 31 `out/NAME.lst`: Disassembly listing (handy for debugging) 32 33 ## Library Build Outputs 34 35 `out/libNAME/...`: Intermediate files 36 37 `out/libNAME.a`: Static library 38 39 ## Sample Project 40 41 ```make 42 # project/mandelbrot-fb.app.mk 43 44 MOD_NAME := mandelbrot-fb 45 MOD_SRC := hw/src/start.S misc/mandelbrot-fb.c 46 MOD_SRC += hw/src/debug-printf.c hw/src/debug-io.c 47 MOD_LIB := c 48 MOD_QEMU_FB := yes 49 50 include make/app.mk 51 ```