It's about one tool which is over 40 years old: MAKE. Designed by
Stuart Feldman in 1976.
+Make is a great tool! It's easy to get started, intuitive,
+and wildly successful. If I critize make it's not because I
+think it's a bad tool, just that we could do even better if
+we addressed some shortcomings.
+
+
TACTIC PROBLEM:
- - Only one tactic.
- - Others are possible,
+
+Only one tactic for solving dependencies.
+
+"If the target file doesn't exist, or if it's older than
+one of the dependencies, then run this recipe."
+
+If you think for a little while you'll see that other
+tactics are possible:
+
eg: URL, newer than any file (not all files),
Koji build, comparing checksums, test with skip
+
+
PHONY FILE PROBLEM:
- - "all" is not like a file
+
+"test" is not a file.
+
+If "test" happens to be created, your tests will stop running
+silently.
+
+Experienced users know they can use the .PHONY directive to
+avoid this.
+
+Make doesn't check that when you run a rule that it actually
+creates the file that it says it creates.
+The new tool called goals does check this.
+
+It also points to a fundamental issue: the target
+is overloaded to mean either a file or a rule name.
+
+
SINGLE PARAMETER PROBLEM:
- - %.o: %c only allows a single parameter
+
+Make recipes can be parameterized, provided you only need
+a single parameter.
+
+If a single parameter is useful, it's not outlandish to
+imagine that having two parameters could be useful, or
+even more.
+
+
+
SHELL PROBLEM:
- - How do you quote a file with spaces?
- https://stackoverflow.com/questions/15004278/allow-space-in-target-of-gcc-makefile
- For a tool whose main job is running shell commands
- it has quite a lot of problems with shell commands:
+
+How do you quote a file with spaces?
+https://stackoverflow.com/questions/15004278/allow-space-in-target-of-gcc-makefile
+
+For a tool whose main job is running shell commands
+it has quite a lot of sharp edges when running shell commands.
+
dest/target: deps
cd dest
var=1
echo $var > target
- - Invisible whitespace is meaningful
+
- Individual commands are passed to separate shells
+
- $ has meaning to both shell and make
+ - Invisible whitespace is meaningful
+
Let's talk about shell scripting first, because that's easiest to fix:
target: foo.o bar.o "target": "foo.o", "bar.o" {
- $CC $CFLAGS $< -o $@ %CC %CFLAGS %< -o %@
+ ${CC} ${CFLAGS} $< -o $@ %CC %CFLAGS %< -o %@
}
The new tool uses a real LALR(1) parser. Filenames have to be
let tests = wrap ("*test", wildcard ("test-*.sh"))
goal check () = : tests
- goal test (script) = *test(name) : { ./%name }
+ goal run (script) = *test(script) : { ./%script }
-Another tactic we use is called *built-in-koji, which I
+Another tactic we use is called *koji-built, which I
use for mass rebuilding Fedora packages in dependency order.
-I won't go into the full definition of *built-in-koji since
+I won't go into the full definition of *koji-built since
interfacing with Koji is quite complicated, but you can
write a mass rebuild tool in goals fairly easily:
-[SHOW OUTLINE FROM fedora-ocaml-rebuild/Goalfile]
+ [ DISCUSSION OF FEDORA-OCAML-REBUILD IN SLIDES ]
+
We saw a couple of standard functions in the test example -
| File (name + ".o") -> compile name
| ...
- - But our pattern matcher is very naive, could it be more complex?
- What would that mean?
-SCREENSHOT OF ZINC PAPER
-
-
- Goal "functions" may be called by name or by pattern,
which is unusual. Is there another programming language
which does this?
(Prolog actually)
+ - But our pattern matcher is very naive, could it be more complex?
+ What would that mean?
+
+ SCREENSHOT OF ZINC PAPER
+
+
- Dependencies have implicit & operator, could we use | and ! operators?
What would that mean? Build targets in several different ways?
Fallback if a tool isn't available?
build ("foo", false)
- Anonymous functions
+ Any code section is potentially a closure
let hello = { echo "hello" }