3 ms·
I've used make extensively. I wish it had a little python in it. After using pathnames in awk/sed/perl I find using os.path in python gets rid of all the spec
by m463 7y ago
I've used make extensively.
I wish it had a little python in it. After using pathnames in awk/sed/perl I find using os.path in python gets rid of all the special cases due to quoting and escaping. Python has nice lists and dicts and sets too.
For OO, I wish rules were a bit like python classes.
It would be wonderful for say 10 c files compiling one way, and the 11th having a different option. Or overriding a few options everywhere for the debug build.
I also think if rules had some sort of class, maybe the nuts and bolts underneath could be changed. You could be explicit about some things that are very hard with make. For example, what if you could write your own custom "out-of-date" check. Instead of "result must be newer that dependencies", maybe you could do something with checksums or source control or something and say "ok, don't rebuild this, or here is the cached result"
- jacwah 7y ago> It would be wonderful for say 10 c files compiling one way, and the 11th having a different option. You can do this by combining implicit and explicit rules: target: $(OBJ) # default rule %.o: %.c cc -o $@ $^ # special case special.o: special.c specialc -o $@ $^
- Pete_D 7y agoAnother way, with target-specific variables (might be a GNUism): special.o: CFLAGS += -Wno-blah %.o: %.c echo $(CC) $(CFLAGS) -o $@ $<
- teddyh 7y ago> I wish it had a little python in it. GNU Make can have Scheme in it: https://www.gnu.org/software/make/manual/make.html#Guile-Integration https://www.gnu.org/software/make/manual/make.html#Guile-Int...
- kjs3 7y agoOK...I can see where you're coming from. The pathname thing doesn't bother me probably because the quoting and escaping is muscle memory after 30 years, but fair point and an easy source of sometime hard to find mistakes. The 11th file thing as pointed out below can be worked around easily, but yeah mixing implicit and explicit rules isn't 'elegant'. Dunno know if 'subclassing' the rule or whatever is the answer; maybe if there's a lot of exceptions. Interesting to think about. I think the answer to your last example is one of 1) 'Unix philosophy' the problem by invoking separate scripts/tools to set things up for what 'make' expects so you get the result you want ("if the checksum of the source file changes, 'touch' it to make sure it gets rebuilt" or something) or 2) maybe 'make' isn't the right tool, because it's definitely not always the right tool. Because that's really the key: right tool, and 'it's old' by itself is rarely the reason not to use a tool.