build.zsh/build/ofile.zsh
Luka Vandervelden f30e64e604 Automatic rules rulez! (for things like .o files)
- This update also allowed to have a somewhat cleaner
	  support for building libraries. (because the code to generate
	  the rules for the .o files is common, uh)
	- Such automatic rules are hidden from the Makefiles’ “help”
	  message, as they previously were.
	- subdirs are expected to have been broken.

I should really write a real tool to do this job. In, say, C, maybe?
2015-04-06 22:42:56 +02:00

35 lines
583 B
Bash

function ofile.build {
local dirname="$(dirname "$target")"
write -n "${target}: ${target%.o}.c"
sed '/^#include "/!d;s/^#include "//;s/"$//' "${target%.o}.c" | \
while read h; do
h="$dirname/$h"
write -n " $h"
done
write
write "\t@echo '$(CC ${target})'"
write -n "\t$Q\$(CC) \$(CFLAGS) ${cflags[$target]} -c ${target%.o}.c "
write -n " ${cflags[$target]}"
write " -o ${target}"
write
}
function ofile.install {
write "${target}.install:"
write
}
function ofile.uninstall {
write "${target}.uninstall:"
write
}
function ofile.clean {
binary.clean "$@"
}