From 9d47486aac9cd1a4422b78ee273b7a27bf7b733a Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 8 Sep 2026 12:00:49 +0200 Subject: refactor: flatten src and migrate to meson --- README.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 53e0579..c3e942e 100644 --- a/README.md +++ b/README.md @@ -37,18 +37,23 @@ The program still directly controls the registers used for the system calls. Not The full language reference, shit like directives, declarations, statements, expressions, registers and extensions, is explained in [docs/language.md](docs/language.md). ## Building -The build is driven by [premake5](https://premake.github.io/). Generate the makefiles and build the compiler: +The build is driven by [Meson](https://mesonbuild.com/). Configure a build directory and compile the compiler: ```bash -premake5 gmake -make config=debug +meson setup build +meson compile -C build ``` -This produces the `hdass` binary at `bin/-/hdass` (for example `bin/debug-macosx/hdass` or `bin/debug-linux/hdass`). The available configurations are `debug`, `release` and `dist`. To run the unit tests: +This produces the `hdass` binary at `build/hdass`. The default build turns on the address and undefined-behaviour sanitizers; for an optimised build without them, configure a separate directory: ```bash -make config=debug -./bin/-/tests +meson setup build-release --buildtype=release -Db_sanitize=none +meson compile -C build-release ``` +To run the unit tests: +```bash +meson test -C build +``` +If [cppcheck](https://cppcheck.sourceforge.io/) is installed, `ninja -C build cppcheck` runs static analysis over the sources. -hdass emits x86-64 assembly, so to actually assemble and run its output you need an x86-64 Linux toolchain. The bundled Docker environment provides a consistent one on any host, including Apple Silicon, where the amd64 image runs under emulation. The image is a Debian base with `nasm`, `ld` (binutils), a C toolchain and `premake5` preinstalled. +hdass emits x86-64 assembly, so to actually assemble and run its output you need an x86-64 Linux toolchain. The bundled Docker environment provides a consistent one on any host, including Apple Silicon, where the amd64 image runs under emulation. The image is a Debian base with `nasm`, `ld` (binutils), a C toolchain and Meson/Ninja preinstalled. Start the container (this builds the image the first time): ```bash @@ -62,8 +67,8 @@ docker compose exec hdass bash From inside the container you can build the compiler and take a program all the way to a running executable: ```bash -premake5 gmake && make config=debug -./bin/debug-linux/hdass examples/hello_world.hdass -o hello.asm +meson setup build-linux && meson compile -C build-linux +./build-linux/hdass examples/hello_world.hdass -o hello.asm nasm -f elf64 hello.asm -o hello.o ld -e main hello.o -o hello ./hello @@ -71,7 +76,7 @@ ld -e main hello.o -o hello To transpile, assemble, link and run every program in [examples/](examples/) and check its output, use the end-to-end test script (also from inside the container): ```bash -make config=debug && ./scripts/test_examples.sh +meson setup build-linux && meson compile -C build-linux && ./scripts/test_examples.sh ``` Or, from the host, run the whole suite (unit tests plus the example tests) in one shot, bringing the container up if needed: -- cgit v1.3