commit 208f9d5
chld
·
2026-04-14 00:53:24 +0000 UTC
parent 2b3b447
some mechanism, didnt test
1 files changed,
+23,
-3
+23,
-3
1@@ -227,7 +227,6 @@ main(int argc, char **argv)
2 dump_ast = 0;
3 dump_dot = 0;
4 dump_graph = 0;
5- have_path = 0;
6 for (i = 1; i < argc; i++) {
7 if (strcmp(argv[i], "-a") == 0) {
8 dump_ast = 1;
9@@ -248,14 +247,35 @@ main(int argc, char **argv)
10 usage(stderr, argv[0]);
11 return 1;
12 } else {
13- path = argv[i];
14- have_path = 1;
15+ // stub fn
16 }
17 }
18 src = readfile(path);
19 if (!src) {
20+ /*
21 fprintf(stderr, "could not read %s\n", path);
22 return 1;
23+ */
24+ /* maybe the makefile is named differently?
25+ * this is a little ignorant. i wont tell you why */
26+
27+ char* mks[]={
28+ "makefile",
29+ "GNUmakefile",
30+ "gnumakefile",
31+ NULL
32+
33+ /* https://www.gnu.org/software/make/manual/html_node/Makefile-Names.html */
34+ }
35+
36+ for(size_t mk=0; mks[mk]!=NULL; ++mk)
37+ {
38+ path=mks[mk];
39+ src=readfile(path);
40+
41+ if(src) break;
42+ // error later
43+ }
44 }
45 if (parse(path, src, &ast) < 0) {
46 fprintf(stderr, "parse error in %s\n", path);