- #
+#
# 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
#####
-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:
-
-PATH := $(mips2java_root)/upstream/install/bin:$(PATH)
+usr = $(mips2java_root)/upstream/install
+PATH := $(usr)/bin:$(PATH)
export PATH
#
endif
$(tasks)/%:
- $(MAKE) -C upstream tasks/$* MIPS_LDFLAGS="$(MIPS_LDFLAGS)" MIPS_CFLAGS="$(flags) $(mips_optflags)"
+ $(MAKE) -C upstream tasks/$* usr="$(usr)" MIPS_LDFLAGS="$(MIPS_LDFLAGS)" MIPS_CFLAGS="$(flags) $(mips_optflags)"
upstream_clean_%:
- $(MAKE) -C upstream clean_$*
+ $(MAKE) -C upstream clean_$* usr="$(usr)"
-errno_h = upstream/install/mips-unknown-elf/include/sys/errno.h
+errno_h = $(usr)/mips-unknown-elf/include/sys/errno.h
$(errno_h): $(tasks)/build_newlib
-unistd_h = upstream/install/mips-unknown-elf/include/sys/unistd.h
+unistd_h = $(usr)/mips-unknown-elf/include/sys/unistd.h
$(unistd_h): $(tasks)/build_newlib
#
$(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 $@`
# MIPS Compiler generated class compilation
ifdef DO_JAVASOURCE
-build/%.java: build/%.mips build/org/xwt/mips/JavaSourceCompiler.class
+build/%.java: build/%.mips build/org/xwt/mips/JavaSourceCompiler.class
$(JAVA) -cp $(classpath) org.xwt.mips.Compiler -outformat javasource $(compiler_flags) $($(notdir $*)_COMPILERFLAGS) $(subst /,.,$*) $< > build/$*.java
build/%.class: build/%.java build/org/xwt/mips/Runtime.class
#
env.sh: Makefile $(tasks)/full_toolchain build/org/xwt/mips/Compiler.class
@rm -f "$@~"
- @echo 'PATH="$(mips2java_root)/build:$(mips2java_root)/upstream/install/bin:$$PATH"; export PATH' >> $@~
+ @echo 'PATH="$(mips2java_root)/build:$(usr)/bin:$$PATH"; export PATH' >> $@~
@echo 'CC=mips-unknown-elf-gcc; export CC' >> $@~
@echo 'CXX=mips-unknown-elf-g++; export CXX' >> $@~
@echo 'AS=mips-unknown-elf-as; export AS' >> $@~
- @echo 'LD=mips-unknown-elf-ar; export LD' >> $@~
+ @echo 'AR=mips-unknown-elf-ar; export AR' >> $@~
+ @echo 'LD=mips-unknown-elf-ld; export LD' >> $@~
@echo 'RANLIB=mips-unknown-elf-ranlib; export RANLIB' >> $@~
@echo 'CFLAGS="$(mips_optflags)"; export CFLAGS' >> $@~
@echo 'CXXFLAGS="$(mips_optflags)"; export CXXFLAGS' >> $@~
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