forked from extremscorner/libogc2
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·58 lines (48 loc) · 1.17 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
src=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
if [[ "$(readlink -f "$PWD")" == "$src" ]]; then
printf '%s\n' 'This script must be run out of tree!'
exit 1
fi
tmp=$(mktemp -t Makefile.XXXXXXXXXX)
trap 'rm -f "$tmp"' EXIT
function write() {
printf '%s\n' "$*" >> "$tmp"
}
write '# Automatically generated file'
platforms=()
libs=()
for arg in "$@"; do
val="${arg#*=}"
case $arg in
--prefix=*)
write export INSTALL_PREFIX := "$val"
;;
--incdir=*)
write export INCDEST := "$val"
;;
--libdir=*)
write export LIBDEST := "$val"
;;
--opt-level=*)
write export OPTLEVEL := "$val"
;;
--with-platform=*)
platforms+=("$val")
;;
--with-lib=*)
libs+=("$val")
;;
*)
printf '%s\n' "$arg: Invalid argument"
exit 1
esac
done
if (( ${#platforms[@]} )); then
write export PLATFORMS := "${platforms[@]}"
fi
if (( ${#libs[@]} )); then
write export LIBRARIES := "${libs[@]}"
fi
write "include $src/Makefile"
cp "$tmp" Makefile