{"id":18894156,"url":"https://github.com/trailofbits/macroni","last_synced_at":"2025-10-20T10:49:31.170Z","repository":{"id":163502493,"uuid":"638689095","full_name":"trailofbits/macroni","owner":"trailofbits","description":"C and C++ compiler frontend using PASTA to parse code, and VAST to represent the code as MLIR.","archived":false,"fork":false,"pushed_at":"2024-08-14T15:15:10.000Z","size":545,"stargazers_count":40,"open_issues_count":8,"forks_count":4,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-03-28T12:51:14.964Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trailofbits.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-09T22:26:40.000Z","updated_at":"2024-10-31T19:29:39.000Z","dependencies_parsed_at":"2024-01-29T17:32:11.823Z","dependency_job_id":"37811cf9-3ea5-41ac-9293-567abc530abe","html_url":"https://github.com/trailofbits/macroni","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailofbits%2Fmacroni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailofbits%2Fmacroni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailofbits%2Fmacroni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailofbits%2Fmacroni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trailofbits","download_url":"https://codeload.github.com/trailofbits/macroni/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248984400,"owners_count":21193742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T08:18:36.618Z","updated_at":"2025-10-20T10:49:26.121Z","avatar_url":"https://github.com/trailofbits.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Macroni\n\nMacroni is an MLIR dialect that adds macro expansions to VAST's tower of IRS.\n\n## Requirements\n\nThe following instructions assume you are using an Ubuntu 22.04.4 LTS operating\nsystem and are at the root of a local clone of the macroni project tree:\n\n- LLVM, MLIR, and a PASTA-specific version of Clang:\n\n  ```bash\n  wget -O external/llvm-pasta-beeda8d.tar.xz https://github.com/trail-of-forks/llvm-project/releases/download/beeda8d/llvm-pasta-beeda8d.tar.xz\n  mkdir -p external/llvm-pasta-beeda8d\n  tar -xvf external/llvm-pasta-beeda8d.tar.xz --directory external/llvm-pasta-beeda8d/\n  ```\n\n- [`PASTA`](https://github.com/trailofbits/pasta/)\n\n  ```bash\n  cd external/pasta\n  git submodule update --init\n  ```\n\n- [`VAST`](https://github.com/trailofbits/vast)\n  \n  ```bash\n  cd external/vast\n  git submodule update --init --recursive\n  ```\n\n- Ccache (not required but strongly recommended)\n\n  ```bash\n  sudo apt install ccache\n  ```\n\n- Mold (not required but strongly recommended)\n\n  ```bash\n  sudo apt install mold\n  ```\n\n- Ninja (not required but strongly recommended)\n\n  ```bash\n  sudo apt install ninja-build\n  ```\n\n## Building Macroni\n\nConfigure Macroni, e.g., assuming all requirements and recommendations have been\ninstalled:\n\n```bash\ncmake -S . -B build/ -G \"Ninja Multi-Config\" \\\n  -D Clang_DIR:PATH=\"`realpath -s external/llvm-pasta-beeda8d/lib/cmake/clang`\" \\\n  -D CMAKE_BUILD_TYPE:STRING=\"Debug\" \\\n  -D CMAKE_C_COMPILER:PATH=\"`realpath -s external/llvm-pasta-beeda8d/bin/clang`\" \\\n  -D CMAKE_CXX_COMPILER:PATH=\"`realpath -s external/llvm-pasta-beeda8d/bin/clang++`\" \\\n  -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=true \\\n  -D CMAKE_INSTALL_PREFIX:PATH=build/ \\\n  -D CMAKE_LINKER_TYPE:STRING=MOLD \\\n  -D LLVM_DIR:PATH=\"`realpath -s external/llvm-pasta-beeda8d/lib/cmake/llvm`\" \\\n  -D LLVM_ENABLE_RTTI:BOOL=true \\\n  -D LLVM_USE_LINKER:STRING=\"mold\" \\\n  -D MLIR_DIR:PATH=\"`realpath -s external/llvm-pasta-beeda8d/lib/cmake/mlir`\"\n```\n\nBuild macroni:\n\n```bash\ncmake --build build/\n```\n\n## Running Macroni\n\nOnce the `macronify` binary has been built, you can run it on a C source file.\nAssuming `macronify` has been installed and its location added to your path:\n\n```bash\nmacronify -xc some_file.c\n```\n\n## Testing\n\nTo run Macroni's tests first install LIT and FileCheck:\n\n- LIT\n  \n  ```bash\n  python3 -m pip install lit\n  ```\n\n- FileCheck\n\n  ```bash\n  wget https://apt.llvm.org/llvm.sh\n  chmod +x llvm.sh\n  sudo ./llvm.sh 17\n  sudo apt install llvm-17-tools\n  ```\n\nThen add the following definitions when configuring building Macroni:\n\n```bash\ncmake -S . -B build/ -G \"Ninja Multi-Config\" \\\n  ...# Previous definitions\n  -D MACRONI_ENABLE_TESTING:BOOL=ON \\\n  -D LLVM_EXTERNAL_LIT:STRING=\"`which -s lit`\"\n```\n\nFinally, run Macroni's tests by building the target `check-macroni`:\n\n```bash\ncmake --build build/ --target check-macroni\n```\n\n## License\n\nMacroni is licensed according to the Apache 2.0 license. Macroni links against\nand uses Clang and LLVM APIs. Clang is also licensed under Apache 2.0, with\n[LLVM](https://github.com/llvm/llvm-project/blob/main/clang/LICENSE.TXT)\nexceptions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailofbits%2Fmacroni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrailofbits%2Fmacroni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailofbits%2Fmacroni/lists"}