diff options
| author | hachem <im@hachem.wtf> | 2026-09-08 12:00:49 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-08 12:00:49 +0200 |
| commit | 9d47486aac9cd1a4422b78ee273b7a27bf7b733a (patch) | |
| tree | a015067fe963f3a24e8f37a8b9cd581540b3bb8c /README.md | |
| parent | 21be45a904a0afc767214298721bd2bbce19a054 (diff) | |
refactor: flatten src and migrate to meson
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -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/<config>-<system>/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/<config>-<system>/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: |
