{"id":24625987,"url":"https://github.com/jpeach/mj","last_synced_at":"2025-08-18T15:08:26.770Z","repository":{"id":173510084,"uuid":"650864905","full_name":"jpeach/mj","owner":"jpeach","description":"Generate JSON compilation databases using Clang","archived":false,"fork":false,"pushed_at":"2023-09-25T23:54:34.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-19T23:43:56.816Z","etag":null,"topics":["build-tool","clang","compilation-database"],"latest_commit_sha":null,"homepage":"","language":"Go","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/jpeach.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}},"created_at":"2023-06-08T01:30:24.000Z","updated_at":"2024-10-30T08:54:15.000Z","dependencies_parsed_at":"2023-07-26T05:25:39.564Z","dependency_job_id":null,"html_url":"https://github.com/jpeach/mj","commit_stats":null,"previous_names":["jpeach/mj"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jpeach/mj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpeach%2Fmj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpeach%2Fmj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpeach%2Fmj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpeach%2Fmj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpeach","download_url":"https://codeload.github.com/jpeach/mj/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpeach%2Fmj/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271012341,"owners_count":24684533,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["build-tool","clang","compilation-database"],"created_at":"2025-01-25T04:47:19.738Z","updated_at":"2025-08-18T15:08:26.744Z","avatar_url":"https://github.com/jpeach.png","language":"Go","readme":"# mj: generate JSON compilation databases using Clang\n\nmj is a simple tool that runs a Clang commandline and injects the [`-MJ`](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mj-arg)\noption to make it easier to generate a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html).\nThe clang `-MJ` option emits a compilation database fragment for the\nsingle file that is being compiled.\nOnce the full project build is complete, you can run `mj --collect`\nto gather the fragments into a single `compile_commands.json` file.\n\n## Installation\n\nYou can install `mj` using the `go install` command:\n\n```bash\n$ go install github.com/jpeach/mj@latest\n```\n\n## Usage\n\n```\nusage: mj OPTIONS|COMPILATION...\n\nmj injects Clang compiler options to generate a compilation database.\nIf no options are provided, the arguments to mj should be a full Clang\ncommandline. mj will inject the '-MJ' option and run the Clang command.\n\nOptions:\n  --clean    This option recursively removes all the \".mj\" directories\n             generated during a compilation.\n  --collate  This option finds all the compilation database fragments\n             generated by Clang, and collates them into a single file\n             named \"compile_commands.json\".\n  --help, --usage\n             Show this help message.\n```\n\n## Example\n\nSay you have a build that accepts the `CC` and `CXX` environment\nvariables, but does not explicitly support building a JSON compilation\ndatabase.\nYou can build your project normally, but substitute `mj` as a compiler wrapper.\nThe compilation process will emit JSON fragments as files with the\nextension `.db.json` in a `.mj` directory next to your object files.\nWhen the build is complete, `mj` can collate these into a single JSON\ncompilation database.\n\n```bash\n$ make CC=\"mj clang\" CXX=\"mj clang++\"\n...\n$ find . -name *.db.json | wc -l\n495\n$ mj --collate\n$ ls -hl compile_commands.json\n-rw-r--r-- 1 jpeach staff 1.3M Jun  8 11:47 compile_commands.json\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpeach%2Fmj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpeach%2Fmj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpeach%2Fmj/lists"}