Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env sh
- set -e
- if [ "$1" = "-v" ]; then
- shift
- case "$1" in
- 10) CPPFLAGS+=" -DZ64_VERSION=Z64_OOT10";;
- 11) CPPFLAGS+=" -DZ64_VERSION=Z64_OOT11";;
- 12) CPPFLAGS+=" -DZ64_VERSION=Z64_OOT12";;
- esac
- shift
- else
- CPPFLAGS+=" -DZ64_VERSION=Z64_OOT10"
- fi
- if [ -z "$1" ]; then
- echo "usage: \`$0 [-v 10|11|12] <expression>\`"
- exit
- fi
- CPPFLAGS+=" -I/opt/n64/mips64/n64-sysroot/usr/include"
- tmpfile="$(mktemp)"
- gcc $CPPFLAGS -x c - -o "$tmpfile" <<EOF
- #include <stdio.h>
- #include <stdint.h>
- #include <inttypes.h>
- #include "src/gz/z64.h"
- int main()
- {
- printf("%08" PRIx32 "\n", (uint32_t)(uintptr_t)&($1));
- return 0;
- }
- EOF
- chmod a+x "$tmpfile"
- "$tmpfile"
- rm -f "$tmpfile"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement