{"id":13545142,"url":"https://github.com/nickdiego/compiledb","last_synced_at":"2025-05-13T20:12:05.154Z","repository":{"id":39717361,"uuid":"98937514","full_name":"nickdiego/compiledb","owner":"nickdiego","description":"Tool for generating Clang's JSON Compilation Database files for make-based build systems.","archived":false,"fork":false,"pushed_at":"2025-03-23T10:17:22.000Z","size":188,"stargazers_count":1466,"open_issues_count":54,"forks_count":127,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-04-28T10:57:54.267Z","etag":null,"topics":["c","clang","compilation-database","cpp","gnu-make","makefile"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickdiego.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":"2017-07-31T23:08:21.000Z","updated_at":"2025-04-27T13:39:08.000Z","dependencies_parsed_at":"2024-06-18T17:05:47.668Z","dependency_job_id":"b56b732c-82e9-4d9b-a942-f888542a9472","html_url":"https://github.com/nickdiego/compiledb","commit_stats":{"total_commits":150,"total_committers":21,"mean_commits":7.142857142857143,"dds":0.3866666666666667,"last_synced_commit":"b615d526019c7b809882090ea7eaff85423f2b13"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickdiego%2Fcompiledb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickdiego%2Fcompiledb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickdiego%2Fcompiledb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickdiego%2Fcompiledb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickdiego","download_url":"https://codeload.github.com/nickdiego/compiledb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020615,"owners_count":22000755,"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":["c","clang","compilation-database","cpp","gnu-make","makefile"],"created_at":"2024-08-01T11:00:58.173Z","updated_at":"2025-05-13T20:12:05.106Z","avatar_url":"https://github.com/nickdiego.png","language":"Python","readme":"# Compilation Database Generator\n\n[![CircleCI branch](https://img.shields.io/circleci/project/github/nickdiego/compiledb/master.svg)](https://circleci.com/gh/nickdiego/compiledb)\n[![PyPI](https://img.shields.io/pypi/v/compiledb.svg)](https://pypi.org/project/compiledb/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/compiledb.svg)](https://pypi.org/project/compiledb)\n[![GitHub](https://img.shields.io/github/license/nickdiego/compiledb.svg)](https://github.com/nickdiego/compiledb/blob/master/LICENSE)\n\nTool for generating [Clang's JSON Compilation Database][compdb] file for GNU\n`make`-based build systems.\n\nIt's aimed mainly at non-cmake (cmake already generates compilation database)\nlarge codebases. Inspired by projects like [YCM-Generator][ycm-gen] and [Bear][bear],\nbut faster (mainly with large projects), since in most cases it **doesn't need a clean\nbuild** (as the mentioned tools do) to generate the compilation database file, to\nachieve this it uses the make options such as `-n`/`--dry-run` and `-k`/`--keep-going`\nto extract the compile commands. Also, it's more **cross-compiling friendly** than\nYCM-generator's fake-toolchanin approach.\n\n## Installation\n\n```\n# pip install compiledb\n```\n- Supports Python \u003e= 3.3\n- For bash completion support, add the content of `sh-completion/compiledb.bash` file\n  to your `.bashrc` file, for example.\n\n## Usage\n\n`compiledb` provides a `make` python wrapper script which, besides to execute the make\nbuild command, updates the JSON compilation database file corresponding to that build,\nresulting in a command-line interface similar to [Bear][bear].\n\nTo generate `compile_commands.json` file using compiledb's \"make wrapper\" script,\nexecuting Makefile target `all`:\n```bash\n$ compiledb make\n```\n\n`compiledb` forwards all the options/arguments passed after `make` subcommand to GNU Make,\nso one can, for example, generate `compile_commands.json` using `core/main.mk`\nas main makefile (`-f` flag), starting the build from `build` directory (`-C` flag):\n```bash\n$ compiledb make -f core/main.mk -C build\n```\n\nBy default, `compiledb make` generates the compilation database and runs the actual build\ncommand requested (acting as a make wrapper), the build step can be skipped using the `-n`\nor `--no-build` options.\n```bash\n$ compiledb -n make\n```\n\n`compiledb` base command has been designed so that it can be used to parse compile commands\nfrom arbitrary text files (or stdin), assuming it has a build log (ideally generated using\n`make -Bnwk` command), and generates the corresponding JSON Compilation database.\n\nFor example, to generate the compilation database from `build-log.txt` file, use the following\ncommand.\n```bash\n$ compiledb --parse build-log.txt\n```\n\nor its equivalent:\n```bash\n$ compiledb \u003c build-log.txt\n```\n\nOr even, to pipe make's output and print the compilation database to the standard output:\n```bash\n$ make -Bnwk | compiledb -o-\n```\n\nBy default `compiledb` generates a JSON compilation database in the \"arguments\" list\n[format](https://clang.llvm.org/docs/JSONCompilationDatabase.html). The \"command\" string\nformat is also supported through the use of the `--command-style` flag:\n```bash\n$ compiledb --command-style make\n```\n\n## Testing / Contributing\n\nI've implemented this tool because I needed to index some [AOSP][aosp]'s modules for navigating\nand studying purposes (after having no satisfatory results with current tools available by the\ntime such as [YCM-Generator][ycm] and [Bear][bear]). So I've reworked YCM-Generator, which resulted\nin the initial version of [compiledb/parser.py](compiledb/parser.py) and used successfully to generate\n`compile_commands.json` for some AOSP modules in ~1min running in a [Docker][docker] container and then\ncould use it with some great tools, such as:\n\n- [Vim][vim] + [YouCompleteMe][ycm] + [rtags][rtags] + [chromatica.nvim][chrom]\n- [Neovim][neovim] + [LanguageClient-neovim][lsp] + [cquery][cquery] + [deoplete][deoplete]\n- [Neovim][neovim] + [ALE][ale] + [ccls][ccls]\n\nNotice:\n- _Windows: tested on Windows 10 with cmd, wsl(Ubuntu), mingw32_\n- _Linux: tested only on Arch Linux and Ubuntu 18 so far_\n- _Mac: tested on macOS 10.13 and 10.14_\n\nPatches are always welcome :)\n\n## License\nGNU GPLv3\n\n## Related Project\n[compiledb-go]: compiledb go version\n\n[compdb]: https://clang.llvm.org/docs/JSONCompilationDatabase.html\n[ycm]: https://github.com/Valloric/YouCompleteMe\n[rtags]: https://github.com/Andersbakken/rtags\n[chrom]: https://github.com/arakashic/chromatica.nvim\n[ycm-gen]: https://github.com/rdnetto/YCM-Generator\n[bear]: https://github.com/rizsotto/Bear\n[aosp]: https://source.android.com/\n[docker]: https://www.docker.com/\n[vim]: https://www.vim.org/\n[neovim]: https://neovim.io/\n[lsp]: https://github.com/autozimu/LanguageClient-neovim\n[cquery]: https://github.com/cquery-project/cquery\n[deoplete]: https://github.com/Shougo/deoplete.nvim\n[ccls]: https://github.com/MaskRay/ccls\n[ale]: https://github.com/w0rp/ale\n[compiledb-go]: https://github.com/fcying/compiledb-go\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickdiego%2Fcompiledb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickdiego%2Fcompiledb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickdiego%2Fcompiledb/lists"}