+# This is only for Brian to use... don't mess with it
+rebuild-constants: $(tasks)/build_newlib
+ @mkdir -p `dirname $@`
+ ( \
+ cat \
+ src/org/ibex/nestedvm/syscalls.h \
+ $(usr)/mips-unknown-elf/include/sys/{errno.h,unistd.h,syslimits.h}; \
+ $(MIPS_CC) -E -dM $(usr)/mips-unknown-elf/include/sys/fcntl.h | awk '$$2 ~ /^[OF]_/ { print; }'; \
+ ) | ( \
+ echo "// THIS FILE IS AUTOGENERATED! DO NOT EDIT!"; \
+ echo "// run \"make rebuild-constants\" if it needs to be updated"; \
+ echo ""; \
+ echo "package org.ibex.nestedvm;"; \
+ echo "public interface UsermodeConstants {"; \
+ tr '\t' ' ' | sed -n ' \
+ s/ */ /g; \
+ s/ *# *define \([A-Z_][A-Za-z0-9_]*\) \([0-9][0-9x]*\)/ public static final int \1 = \2;/p'; \
+ echo "}"; \
+ ) > src/org/ibex/nestedvm/UsermodeConstants.java
+