|
- #!/bin/bash
- # Usage: create a file foo.c, make foo a symlink to this script
- # When foo is executed, this script silently compiles foo.c into .make-and-exec-binaries/foo and execs that with the arguments provided.
- # The compilation goes through make, so later invocations directly exec the binary with little delay.
- # To customise the compilation, you can set a CFLAGS env var before running foo.
- set -e
- name="$(basename "$0")"
- cd "$(dirname "$0")"
- make --file .make-and-exec-Makefile --silent ".make-and-exec-binaries/${name}"
- exec "./.make-and-exec-binaries/${name}" "$@"
|