Initial commit with hacked up sm64 decomp source
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
CC='cc -g'
|
||||
CFLAGS='-Wall -fPIC'
|
||||
BIN_FILE='libsm64.so'
|
||||
LDFLAGS=''
|
||||
|
||||
c_to_obj() {
|
||||
printf 'build/'
|
||||
echo "$1" | sed 's/cp*$/o/;s:/:_:g'
|
||||
}
|
||||
|
||||
make_cmd() {
|
||||
local obj_file="$(c_to_obj "$1")"
|
||||
$CC $CFLAGS -MM -MT "$obj_file" -c "$1"
|
||||
echo -e "\t$CC $CFLAGS -o $obj_file -c $1"
|
||||
}
|
||||
|
||||
file_list() {
|
||||
find src -iname '*.c'
|
||||
}
|
||||
|
||||
print_makefile() {
|
||||
local all_objs=''
|
||||
for f in $(file_list); do
|
||||
all_objs="$all_objs $(c_to_obj $f)"
|
||||
done
|
||||
echo "$BIN_FILE: $all_objs"
|
||||
echo -e "\t$CC -shared -o $BIN_FILE $all_objs $LDFLAGS"
|
||||
|
||||
for f in $(file_list); do
|
||||
make_cmd "$f"
|
||||
done
|
||||
|
||||
echo '.PHONY: clean run'
|
||||
echo -e "clean:\n\t find . -iname '*.o' | xargs rm && rm -f ./$BIN_FILE"
|
||||
}
|
||||
|
||||
mkdir -p build
|
||||
print_makefile > Makefile
|
||||
Reference in New Issue
Block a user