commit d06c4f189c99f40d36fcbac816e76a43981fb8ad from: Benjamin Stürz date: Fri Nov 15 22:09:27 2024 UTC make: implement := and ::= commit - f189f149ec12a46aba134fffd4f6a2037936f775 commit + d06c4f189c99f40d36fcbac816e76a43981fb8ad blob - 131859ab5564ca406a2ea6c5b7f86e4426cf6f54 blob + 0e4dff0c64187d6ec7dfd3fc044412fe5a8401a1 --- make/TODO.md +++ make/TODO.md @@ -26,12 +26,7 @@ CFLAGS = -ansi CFLAGS += -Wall ``` -## `:=`: Immediate Assignment (easy) -```make -MACRO := value -``` - # Doc comments for help page ```make ## build the code base @@ -152,3 +147,4 @@ This must be defined at the top of the file. ## Write a tutorial on how to correctly use this make ## Write a specification ## Create a freestanding version, written in Rust, so that other projects can use this make +# `.include xxx, DIR, Makefile` blob - 3494a1ee27a939370511b000898abcb8ef4b5f1d blob + 85cd67900fe13f3370fd526c22746bd89bc84121 --- make/make.c +++ make/make.c @@ -799,6 +799,11 @@ char *path; m->value = strdup (trim (t + 1)); } m->lazy = 1; + } else if (t[-1] == ':') { + // handle both `:=` and `::=` + t[t[-2] == ':' ? -2 : -1] = '\0'; + m->lazy = 0; + m->value = strdup (trim (expand (sc, trim (t + 1), NULL, NULL))); } else { m->lazy = 1; m->value = strdup (trim (t + 1));