Commit 8356b2b726
Unsigned
Layout: unified · split
README.md added +8
| @@ -0,0 +1,8 @@ | ||
| 1 | # imake | |
| 2 | ||
| 3 | a compiling frontend. alternative for GNU make. | |
| 4 | ||
| 5 | # installing (as root) | |
| 6 | ```chmod +x imake && mv imake /usr/local/bin``` | |
| 7 | ||
| 8 | *make sure you have your compiler (i.e. gcc) linked as cc (in /usr/bin).* | |
imake added +32
| @@ -0,0 +1,32 @@ | ||
| 1 | #!/bin/bash | |
| 2 | # Ilkay Alakay <ilkay@astronix.org>. Licensed under The Unlicense | |
| 3 | ||
| 4 | DIR="$(pwd)" | |
| 5 | IMAKEFILE="$DIR/IMakefile" | |
| 6 | ||
| 7 | if [[ ! -f "$IMAKEFILE" ]]; then | |
| 8 | echo "imake: IMakefile not found in $DIR" >&2 | |
| 9 | exit 1 | |
| 10 | fi | |
| 11 | ||
| 12 | while IFS= read -r line || [[ -n "$line" ]]; do | |
| 13 | [[ -z "$line" ]] && continue | |
| 14 | ||
| 15 | printf '%s:\n' "$line" | |
| 16 | ||
| 17 | output=$(bash -c "$line" 2>&1) | |
| 18 | status=$? | |
| 19 | ||
| 20 | if [[ -n "$output" ]]; then | |
| 21 | while IFS= read -r output_line || [[ -n "$output_line" ]]; do | |
| 22 | printf ' %s\n' "$output_line" | |
| 23 | done <<< "$output" | |
| 24 | else | |
| 25 | printf ' \n' | |
| 26 | fi | |
| 27 | ||
| 28 | if [[ $status -ne 0 ]]; then | |
| 29 | printf ' Command failed with exit code %d\n' "$status" | |
| 30 | exit "$status" | |
| 31 | fi | |
| 32 | done < "$IMAKEFILE" | |