fix Adam's UsermodeConstants breakage
[nestedvm.git] / Makefile
index 9e5f04a..4f4e63b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,10 @@
- # 
+# 
 # What to build
 #
 
 # Java sources that are part of the compiler/interpreter
 java_sources = $(wildcard src/org/xwt/mips/*.java) $(wildcard src/org/xwt/mips/util/*.java)
 
-# Java sources that are part of the compiler/interpreter that are
-# generated from other sources
-java_gen_sources = $(patsubst %,build/org/xwt/mips/%.java, UsermodeConstants)
-
 # C sources that are part of the compiler/interpreter
 mips_sources = crt0.c support_aux.c
 mips_asm_sources = support.s
@@ -59,14 +55,9 @@ EXE_EXT =
 
 #####
 
-java_classes = \
-       $(java_sources:src/%.java=build/%.class) \
-       $(java_gen_sources:%.java=%.class)
-
+java_classes = $(java_sources:src/%.java=build/%.class)
 mips_objects = $(mips_sources:%.c=build/org/xwt/mips/%.o) $(mips_asm_sources:%.s=build/org/xwt/mips/%.o)
 
-.SECONDARY:
-
 usr = $(mips2java_root)/upstream/install
 PATH := $(usr)/bin:$(PATH)
 export PATH
@@ -103,23 +94,13 @@ build/org/xwt/mips/util/.Dummy.class:
 $(java_classes): build/org/xwt/mips/util/.Dummy.class
 endif
 
-$(java_classes): $(java_sources) $(java_gen_sources) $(bcel_jar)
-       $(JAVAC) -classpath $(classpath) -d build $(java_sources) $(java_gen_sources)
+$(java_classes): $(java_sources) $(bcel_jar)
+       $(JAVAC) -classpath $(classpath) -d build $(java_sources)
 
-build/org/xwt/mips/UsermodeConstants.java: src/org/xwt/mips/syscalls.h $(errno_h) $(unistd_h)
-       @mkdir -p `dirname $@`
-       cat $^ | ( \
-               echo "package org.xwt.mips;"; \
-               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 "}"; \
-       ) > $@
-       
 $(bcel_jar): upstream/tasks/extract_bcel
        @true
 
+# GCJ Stuff
 # FIXME: We're cramming more than we need into the binary here
 build/mips2java$(EXE_EXT): $(java_sources) $(java_gen_sources)
        @mkdir -p `dirname $@`
@@ -205,8 +186,21 @@ runtime.jar: $(runtime_classes:%=build/org/xwt/mips/%.class)
 unixruntime.jar: $(unixruntime_classes:%=build/org/xwt/mips/%.class)
        cd build && jar cf ../$@ $(unixruntime_classes:%=org/xwt/mips/%*.class)
 
-
-
+# This is only for Brian to use... don't mess with it
+rebuild-constants: src/org/xwt/mips/syscalls.h $(errno_h) $(unistd_h)
+       @mkdir -p `dirname $@`
+       cat $^ | ( \
+               echo "// THIS FILE IS AUTOGENERATED! DO NOT EDIT!"; \
+               echo "// run \"make rebuild-constants\" if it needs to be updated"; \
+               echo ""; \
+               echo "package org.xwt.mips;"; \
+               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/xwt/mips/UsermodeConstants.java
+       
 #
 # Tests
 # These are simply here for convenience. They aren't required