.githooks/
compiler/
kernel/
lib/
scripts/
seed/
sublime/
test/
vim/
.gitignore
333 B
.gitsigners
224 B
AGENTS.md
8.3 KiB
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
2.5 KiB
README
3.4 KiB
STYLE
3.2 KiB
std.lib
2.1 KiB
std.lib.test
1.1 KiB
Makefile
raw
| 1 | # Radiance build file. |
| 2 | |
| 3 | # Standard library manifest and sources. `std.lib` and `std.lib.test` list |
| 4 | # the same modules as the manifest for the integration checks that still |
| 5 | # describe packages with flags. |
| 6 | STD_MANIFEST := lib/std/std.manifest |
| 7 | STD_LIB := $(shell cat std.lib) |
| 8 | STD_TEST_LIB := $(STD_LIB) $(shell cat std.lib.test) |
| 9 | |
| 10 | # Compiler output. |
| 11 | BIN_DIR := bin |
| 12 | RAD_BIN := $(BIN_DIR)/radiance.rv64.dev |
| 13 | |
| 14 | # Emulator that runs every image. The integration driver starts its children |
| 15 | # on the same emulator. seed/update reads it from the environment. |
| 16 | RAD_EMULATOR ?= emulator |
| 17 | export RAD_EMULATOR |
| 18 | |
| 19 | # Command that runs hosted build tools with the memory and stack limits in |
| 20 | # `seed/emulator-args`. |
| 21 | HOSTED := $(RAD_EMULATOR) $(shell cat seed/emulator-args) -run |
| 22 | RADIANCE := $(HOSTED) $(RAD_BIN) |
| 23 | |
| 24 | default: $(RAD_BIN) |
| 25 | |
| 26 | # Compiler build |
| 27 | |
| 28 | SEED := seed/radiance.rv64 |
| 29 | COMPILER_SRC := $(wildcard compiler/radiance/*.rad) compiler/radiance/radiance.manifest |
| 30 | # The compiler package, which the seed builds with its dependencies. |
| 31 | SEED_OPTS := compiler/radiance |
| 32 | |
| 33 | $(RAD_BIN): Makefile $(SEED) $(STD_LIB) $(STD_MANIFEST) $(COMPILER_SRC) | $(BIN_DIR) |
| 34 | @echo "radiance $(SEED) => $@" |
| 35 | @$(HOSTED) $(SEED) $(SEED_OPTS) -o $@ |
| 36 | |
| 37 | # Package flags for integration checks that still describe packages on the |
| 38 | # command line. Their dependency lists are in `seed/dependencies`. Module |
| 39 | # files are in the package directory, so each module after the root is |
| 40 | # mapped to its logical path. `$(call modules,DIR,ROOT,FILES)` gives the |
| 41 | # `-mod` flags of the files FILES of the package in DIR whose root module |
| 42 | # is ROOT. |
| 43 | modules = -mod $(2) $(foreach f,$(filter-out $(2),$(filter %.rad,$(3))), \ |
| 44 | -mod $(patsubst $(1)/%.rad,%,$(f))=$(f)) $(patsubst %,-mod %,$(filter %.ras,$(3))) |
| 45 | STD := -pkg std -manifest seed/dependencies/none \ |
| 46 | $(call modules,lib/std,lib/std/std.rad,$(STD_LIB)) |
| 47 | |
| 48 | # Compiler inputs shared by the normal build and bootstrap stages. |
| 49 | compiler-options: |
| 50 | @printf '%s\n' '$(SEED_OPTS)' |
| 51 | |
| 52 | $(BIN_DIR): |
| 53 | @mkdir -p $@ |
| 54 | |
| 55 | include kernel/Makefile |
| 56 | include test/Makefile |
| 57 | |
| 58 | # Format the standard library and kernel sources in place. Set `FMT_SRC` to |
| 59 | # format other files. |
| 60 | FMT_SRC ?= $(filter %.rad,$(STD_TEST_LIB)) $(shell find kernel -name '*.rad' | sort) |
| 61 | |
| 62 | fmt: $(RAD_BIN) $(INTEGRATION) |
| 63 | @$(call integration,format,$(FMT_SRC)) |
| 64 | |
| 65 | seed: |
| 66 | seed/update |
| 67 | |
| 68 | clean-rad: |
| 69 | rm -rf bin/* |
| 70 | rm -f seed/radiance.rv64.s[0-9]* |
| 71 | |
| 72 | clean: clean-std-test clean-bin-test clean-rad |
| 73 | |
| 74 | .PHONY: default seed clean clean-rad test fmt compiler-options |
| 75 | .SUFFIXES: |
| 76 | .DELETE_ON_ERROR: |
| 77 | .SILENT: |