{"id":16661243,"url":"https://github.com/snowleopard/mk-miner","last_synced_at":"2025-09-13T07:43:58.879Z","repository":{"id":25005546,"uuid":"28424578","full_name":"snowleopard/mk-miner","owner":"snowleopard","description":"Makefile miner","archived":false,"fork":false,"pushed_at":"2014-12-25T14:37:04.000Z","size":492,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T21:17:09.431Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snowleopard.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}},"created_at":"2014-12-23T23:28:21.000Z","updated_at":"2019-12-05T06:33:44.000Z","dependencies_parsed_at":"2022-08-20T21:10:27.197Z","dependency_job_id":null,"html_url":"https://github.com/snowleopard/mk-miner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/snowleopard/mk-miner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowleopard%2Fmk-miner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowleopard%2Fmk-miner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowleopard%2Fmk-miner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowleopard%2Fmk-miner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snowleopard","download_url":"https://codeload.github.com/snowleopard/mk-miner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowleopard%2Fmk-miner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274935969,"owners_count":25376834,"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-09-13T02:00:10.085Z","response_time":70,"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":[],"created_at":"2024-10-12T10:34:18.170Z","updated_at":"2025-09-13T07:43:58.837Z","avatar_url":"https://github.com/snowleopard.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Makefile miner\n==============\n\nThis utility scans a source tree for makefiles and attempts to extract all occurrences of a variable assignment and modification, as well as surrounding `if`/`else`/`endif` statements, and presents the results as annotated Haskell-like code. If you are very lucky the results are directly useable in a build system like [Shake](https://github.com/ndmitchell/shake/blob/master/README.md); otherwise you will at least have everything related to a variable collected in one place giving you a chance to make sense of what is going on. I've written the utility for [migrating GHC's build system to Shake](https://github.com/snowleopard/shaking-up-ghc).\n\nFor example, if variable `CFLAGS` is assigned in file `Makefile`:\n```\nCFLAGS = -O2 -Wall\n```\nand then modified in file `rules/compiler/flags.mk`:\n```\nCFLAGS += -std=c++11\nifeq \"($Mode)\" \"paranoid\"\nCFLAGS += -Werror\nelse\nCFLAGS += -Wno-unused-variable\nendif\n```\nthen the miner will produce the following `results/CFLAGS.hs` file:\n```Haskell\nCFLAGS = [ \"-std=c++11 \" |  ] -- rules/compiler/flags.mk\n    ++ [ \"-Werror \" | \"($Mode)\" == \"paranoid\" ] -- rules/compiler/flags.mk\n    ++ [ \"-Wno-unused-variable \" | not $ \"($Mode)\" == \"paranoid\" ] -- rules/compiler/flags.mk\n    ++ [ \"-O2 -Wall \" |  ] -- Makefile\n```\n\nInstructions\n------------\nThe intended location for the miner is inside the build subdirectory of the source tree, therefore by default it looks for makefiles starting from `../..`.  To change this, set the `sourceTree` parameter as appropriate in `mkminer.hs`:\n```Haskell\nsourceTree = \"..\" \u003c/\u003e \"..\"\n```\n\nThe variables to process are specified in the `todo.txt` file, one per line. To change this, set the `todo` parameter as appropriate in `mkminer.hs`:\n```Haskell\ntodo = \"todo.txt\"\n```\n\nTo start the miner, run the `mine.bat` script.\n\nThe results will go into the `results` directory:\n* `results/vars` subdirectory contains one file per variable, e.g., `CFLAGS.var`. File `X.var` contains all lines extracted from makefiles, which are relevant to variable `X` (including all surrounding `if`/`else`/`endif` statements).\n* `results` contains one file per variable, e.g., `CFLAGS.hs`. File `X.hs` contains a Haskell expression for variable `X`.\n* `results/allmk.txt` is a concatenation of all found makefiles.\n* `results/makefiles.txt` lists all found makefiles.\n* `results/summary.txt` contains a (pretty useless) summary.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowleopard%2Fmk-miner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowleopard%2Fmk-miner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowleopard%2Fmk-miner/lists"}