MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / sh_make_default

Function sh_make_default

src/pipeline/pass_shell.c:1893–1909  ·  view source on GitHub ↗

The makefile make reads in directory `dir` (GNUmakefile, makefile, * Makefile, the first there is), for the one candidate of `dir` that has * one; NULL otherwise. */

Source from the content-addressed store, hash-verified

1891 * Makefile, the first there is), for the one candidate of `dir` that has
1892 * one; NULL otherwise. */
1893static const char *sh_make_default(sh_t *s, const char *dir) {
1894 const char *c[PAIR_LEN] = {NULL, NULL};
1895 int n = sh_candidates(s, dir, c);
1896 const char *hit = NULL;
1897 int found = 0;
1898 for (int i = 0; i < n; i++) {
1899 for (int k = 0; SH_MAKEFILES[k]; k++) {
1900 const char *p = sh_join(s->a, c[i], SH_MAKEFILES[k]);
1901 if (p && sh_repo_file_id(s, p) > 0) {
1902 found++;
1903 hit = p;
1904 break;
1905 }
1906 }
1907 }
1908 return found == SKIP_ONE ? hit : NULL;
1909}
1910
1911/* make [-C DIR] [-f FILE] [VAR=V] TARGET...: each TARGET SPAWNS the rule of
1912 * that name the makefile reads -- the first -f, else the directory's (-C is

Callers 1

sh_makeFunction · 0.85

Calls 3

sh_candidatesFunction · 0.85
sh_joinFunction · 0.85
sh_repo_file_idFunction · 0.85

Tested by

no test coverage detected