Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 scripts/build/test.mk  |   40 +++++++++++---
 test/arch-x86/Makefile |  142 +++++++++++++++++++++++-------------------------
 test/jit/Makefile      |  132 +++++++++++++++++++++++----------------------
 test/vm/Makefile       |   33 ++++++------
 4 files changed, 184 insertions(+), 163 deletions(-)

diff --git a/scripts/build/test.mk b/scripts/build/test.mk
index fb7a665..bba5ff5 100644
--- a/scripts/build/test.mk
+++ b/scripts/build/test.mk
@@ -13,33 +13,55 @@ else
        TESTS_C = '*.c'
 endif
 
-%.o: %.c
+TOPLEVEL_C_SRCS := $(wildcard $(patsubst %.o,../../%.c,$(TOPLEVEL_OBJS)))
+TOPLEVEL_C_OBJS := $(patsubst ../../%.c,toplevel/%.o,$(TOPLEVEL_C_SRCS))
+
+TOPLEVEL_S_SRCS := $(wildcard $(patsubst %.o,../../%.S,$(TOPLEVEL_OBJS)))
+TOPLEVEL_S_OBJS := $(patsubst ../../%.S,toplevel/%.o,$(TOPLEVEL_S_SRCS))
+
+$(TOPLEVEL_C_OBJS): toplevel/%.o: ../../%.c
+       @mkdir -p $(dir $@)
+       $(E) "  CC      " $@
+       $(Q) $(CC) $(ARCH_CFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) 
$(DEFINES) -c $< -o $@
+
+$(TOPLEVEL_S_OBJS): toplevel/%.o: ../../%.S
+       @mkdir -p $(dir $@)
+       $(E) "  AS      " $@
+       $(Q) $(CC) $(ARCH_CFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) 
$(DEFINES) -c $< -o $@
+
+TEST_C_SRCS := $(wildcard $(patsubst %.o,%.c,$(TEST_OBJS)))
+TEST_C_OBJS := $(patsubst %.c,%.o,$(TEST_C_SRCS))
+
+TEST_S_SRCS := $(wildcard $(patsubst %.o,%.S,$(TEST_OBJS)))
+TEST_S_OBJS := $(patsubst %.S,%.o,$(TEST_S_SRCS))
+
+$(TEST_C_OBJS): %.o: %.c
        $(E) "  CC      " $@
-       $(Q) $(CC) $(ARCH_CFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) 
$(DEFINES) -c $< -o `echo $@ | sed "s\/\-\g" | sed "s\[.][.]\p\g"`
+       $(Q) $(CC) $(ARCH_CFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) 
$(DEFINES) -c $< -o $@
 
-%.o: %.S
+$(TEST_S_OBJS): %.o: %.S
        $(E) "  AS      " $@
-       $(Q) $(CC) $(ARCH_CFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) 
$(DEFINES) -c $< -o `echo $@ | sed "s\/\-\g" | sed "s\[.][.]\p\g"`
+       $(Q) $(CC) $(ARCH_CFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) 
$(DEFINES) -c $< -o $@
 
 test: run
 
-$(RUNNER): $(SUITE) $(OBJS)
+ALL_OBJS := $(TOPLEVEL_C_OBJS) $(TOPLEVEL_S_OBJS) $(TEST_C_OBJS) $(TEST_S_OBJS)
+
+$(RUNNER): $(SUITE) $(ALL_OBJS)
        $(E) "  LD      " $@
-       $(Q) $(CC) $(ARCH_CFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) *.o 
$(SUITE) -o $(RUNNER) $(LIBS) $(DEFAULT_LIBS)
+       $(Q) $(CC) $(ARCH_CFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) 
$(ALL_OBJS) $(SUITE) -o $(RUNNER) $(LIBS) $(DEFAULT_LIBS)
 
 run: $(RUNNER)
        $(E) "  RUN     " $@
        $(Q) ./$(RUNNER)
 
-$(OBJS): FORCE
-
 $(SUITE): FORCE
        $(E) "  SUITE   " $@
        $(Q) sh ../../scripts/build/make-tests.sh $(TESTS_C) > $@
 
 clean: FORCE
        $(E) "  CLEAN"
-       $(Q) rm -f *.o $(RUNNER) $(SUITE)
+       $(Q) rm -f *.o $(RUNNER) $(SUITE) $(ALL_OBJS)
 
 PHONY += FORCE
 FORCE:
diff --git a/test/arch-x86/Makefile b/test/arch-x86/Makefile
index a272946..71e43af 100644
--- a/test/arch-x86/Makefile
+++ b/test/arch-x86/Makefile
@@ -8,80 +8,76 @@ MONOBURG      := ../../monoburg/monoburg
 RUNNER=x86-test-runner
 SUITE=x86-test-suite.c
 
-OBJS = \
-       ../../arch/x86/args.o \
-       ../../arch/x86/backtrace.o \
-       ../../arch/x86/emit-code.o \
-       ../../arch/x86/exception.o \
-       ../../arch/x86/insn-selector.o \
-       ../../arch/x86/registers$(ARCH_POSTFIX).o \
-       ../../arch/x86/instruction.o \
-       ../../arch/x86/stack-frame.o \
-       ../../arch/x86/thread.o \
-       ../../arch/x86/unwind$(ARCH_POSTFIX).o \
-       ../../arch/x86/use-def.o \
-       ../../cafebabe/src/cafebabe/attribute_array.o \
-       ../../cafebabe/src/cafebabe/attribute_info.o \
-       ../../cafebabe/src/cafebabe/class.o \
-       ../../cafebabe/src/cafebabe/code_attribute.o \
-       ../../cafebabe/src/cafebabe/constant_pool.o \
-       ../../cafebabe/src/cafebabe/constant_value_attribute.o \
-       ../../cafebabe/src/cafebabe/error.o \
-       ../../cafebabe/src/cafebabe/field_info.o \
-       ../../cafebabe/src/cafebabe/line_number_table_attribute.o \
-       ../../cafebabe/src/cafebabe/method_info.o \
-       ../../cafebabe/src/cafebabe/source_file_attribute.o \
-       ../../cafebabe/src/cafebabe/stream.o \
-       ../../jit/basic-block.o \
-       ../../jit/bc-offset-mapping.o \
-       ../../jit/compilation-unit.o \
-       ../../jit/cu-mapping.o \
-       ../../jit/emit.o \
-       ../../jit/emulate.o \
-       ../../jit/exception.o \
-       ../../jit/expression.o \
-       ../../jit/fixup-site.o \
-       ../../jit/interval.o \
-       ../../jit/method.o \
-       ../../jit/stack-slot.o \
-       ../../jit/statement.o \
-       ../../jit/text.o \
-       ../../jit/tree-node.o \
-       ../../jit/tree-printer.o \
-       ../../jit/vtable.o \
-       ../../lib/buffer.o \
-       ../../lib/list.o \
-       ../../lib/radix-tree.o \
-       ../../lib/string.o \
-       ../../vm/call.o \
-       ../../vm/class.o \
-       ../../vm/die.o \
-       ../../vm/field.o \
-       ../../vm/guard-page.o \
-       ../../vm/itable.o \
-       ../../vm/jni-interface.o \
-       ../../vm/method.o \
-       ../../vm/object.o \
-       ../../vm/stack.o \
-       ../../vm/stack-trace.o \
-       ../../vm/static.o \
-       ../../vm/types.o \
-       ../../vm/utf8.o \
-       ../../vm/zalloc.o \
-       ../../vm/fault-inject.o \
-       ../../vm/natives.o \
-       ../jamvm/alloc-stub.o \
-       ../jamvm/cast-stub.o \
-       ../jamvm/lock.o \
-       ../jit/trampoline-stub.o \
-       ../jit/trace-stub.o \
-       ../libharness/libharness.o \
-       ../vm/classloader-stub.o \
-       ../vm/preload-stub.o \
-       ../vm/signal-stub.o \
-       $(TESTS)
+TOPLEVEL_OBJS := \
+       arch/x86/args.o \
+       arch/x86/backtrace.o \
+       arch/x86/emit-code.o \
+       arch/x86/exception.o \
+       arch/x86/insn-selector.o \
+       arch/x86/registers$(ARCH_POSTFIX).o \
+       arch/x86/instruction.o \
+       arch/x86/stack-frame.o \
+       arch/x86/thread.o \
+       arch/x86/unwind$(ARCH_POSTFIX).o \
+       arch/x86/use-def.o \
+       cafebabe/src/cafebabe/attribute_array.o \
+       cafebabe/src/cafebabe/attribute_info.o \
+       cafebabe/src/cafebabe/class.o \
+       cafebabe/src/cafebabe/code_attribute.o \
+       cafebabe/src/cafebabe/constant_pool.o \
+       cafebabe/src/cafebabe/constant_value_attribute.o \
+       cafebabe/src/cafebabe/error.o \
+       cafebabe/src/cafebabe/field_info.o \
+       cafebabe/src/cafebabe/line_number_table_attribute.o \
+       cafebabe/src/cafebabe/method_info.o \
+       cafebabe/src/cafebabe/source_file_attribute.o \
+       cafebabe/src/cafebabe/stream.o \
+       jit/basic-block.o \
+       jit/bc-offset-mapping.o \
+       jit/compilation-unit.o \
+       jit/cu-mapping.o \
+       jit/emit.o \
+       jit/emulate.o \
+       jit/exception.o \
+       jit/expression.o \
+       jit/fixup-site.o \
+       jit/interval.o \
+       jit/method.o \
+       jit/stack-slot.o \
+       jit/statement.o \
+       jit/text.o \
+       jit/tree-node.o \
+       jit/tree-printer.o \
+       jit/vtable.o \
+       lib/buffer.o \
+       lib/list.o \
+       lib/radix-tree.o \
+       lib/string.o \
+       vm/call.o \
+       vm/class.o \
+       vm/die.o \
+       vm/field.o \
+       vm/guard-page.o \
+       vm/itable.o \
+       vm/jni-interface.o \
+       vm/method.o \
+       vm/object.o \
+       vm/stack.o \
+       vm/stack-trace.o \
+       vm/static.o \
+       vm/types.o \
+       vm/utf8.o \
+       vm/zalloc.o \
+       vm/fault-inject.o \
+       vm/natives.o \
+       test/jit/trampoline-stub.o \
+       test/jit/trace-stub.o \
+       test/libharness/libharness.o \
+       test/vm/classloader-stub.o \
+       test/vm/preload-stub.o \
+       test/vm/signal-stub.o
 
-TESTS = \
+TEST_OBJS := \
        emit-code-test$(ARCH_POSTFIX).o \
        stack-frame-test$(ARCH_POSTFIX).o \
        use-def-test$(ARCH_POSTFIX).o
diff --git a/test/jit/Makefile b/test/jit/Makefile
index b5444d0..21ca733 100644
--- a/test/jit/Makefile
+++ b/test/jit/Makefile
@@ -1,71 +1,73 @@
 RUNNER=jit-test-runner
 SUITE=jit-test-suite.c
 
-OBJS = \
-       ../../arch/$(ARCH)/backtrace.o \
-       ../../cafebabe/src/cafebabe/attribute_array.o \
-       ../../cafebabe/src/cafebabe/attribute_info.o \
-       ../../cafebabe/src/cafebabe/class.o \
-       ../../cafebabe/src/cafebabe/constant_pool.o \
-       ../../cafebabe/src/cafebabe/error.o \
-       ../../cafebabe/src/cafebabe/field_info.o \
-       ../../cafebabe/src/cafebabe/method_info.o \
-       ../../cafebabe/src/cafebabe/source_file_attribute.o \
-       ../../cafebabe/src/cafebabe/stream.o \
-       ../../jit/args.o \
-       ../../jit/arithmetic-bc.o \
-       ../../jit/basic-block.o \
-       ../../jit/bc-offset-mapping.o \
-       ../../jit/branch-bc.o \
-       ../../jit/bytecode-to-ir.o \
-       ../../jit/cfg-analyzer.o \
-       ../../jit/compilation-unit.o \
-       ../../jit/cu-mapping.o \
-       ../../jit/exception-bc.o \
-       ../../jit/exception.o \
-       ../../jit/expression.o \
-       ../../jit/interval.o \
-       ../../jit/invoke-bc.o \
-       ../../jit/linear-scan.o \
-       ../../jit/liveness.o \
-       ../../jit/load-store-bc.o \
-       ../../jit/method.o \
-       ../../jit/nop-bc.o \
-       ../../jit/object-bc.o \
-       ../../jit/ostack-bc.o \
-       ../../jit/spill-reload.o \
-       ../../jit/stack-slot.o \
-       ../../jit/statement.o \
-       ../../jit/text.o \
-       ../../jit/tree-node.o \
-       ../../jit/tree-printer.o \
-       ../../jit/typeconv-bc.o \
-       ../../jit/subroutine.o \
-       ../../jit/pc-map.o \
-       ../../jit/wide-bc.o \
-       ../../lib/bitset.o \
-       ../../lib/buffer.o \
-       ../../lib/list.o \
-       ../../lib/radix-tree.o \
-       ../../lib/string.o \
-       ../../vm/bytecode.o \
-       ../../vm/bytecodes.o \
-       ../../vm/die.o \
-       ../../vm/guard-page.o \
-       ../../vm/stack.o \
-       ../../vm/types.o \
-       ../../vm/zalloc.o \
-       ../../arch/mmix/instruction.o \
-       ../../arch/mmix/register.o \
-       ../../arch/mmix/stack-frame.o \
-       ../../arch/mmix/use-def.o \
-       ../libharness/libharness.o \
-       ../vm/class-stub.o \
-       ../vm/classloader-stub.o \
-       ../vm/object-stub.o \
-       ../vm/preload-stub.o \
-       ../vm/jni-stub.o \
-       ../jit/trace-stub.o \
+TOPLEVEL_OBJS := \
+       arch/$(ARCH)/backtrace.o \
+       cafebabe/src/cafebabe/attribute_array.o \
+       cafebabe/src/cafebabe/attribute_info.o \
+       cafebabe/src/cafebabe/class.o \
+       cafebabe/src/cafebabe/constant_pool.o \
+       cafebabe/src/cafebabe/error.o \
+       cafebabe/src/cafebabe/field_info.o \
+       cafebabe/src/cafebabe/method_info.o \
+       cafebabe/src/cafebabe/source_file_attribute.o \
+       cafebabe/src/cafebabe/stream.o \
+       jit/args.o \
+       jit/arithmetic-bc.o \
+       jit/basic-block.o \
+       jit/bc-offset-mapping.o \
+       jit/branch-bc.o \
+       jit/bytecode-to-ir.o \
+       jit/cfg-analyzer.o \
+       jit/compilation-unit.o \
+       jit/cu-mapping.o \
+       jit/exception-bc.o \
+       jit/exception.o \
+       jit/expression.o \
+       jit/interval.o \
+       jit/invoke-bc.o \
+       jit/linear-scan.o \
+       jit/liveness.o \
+       jit/load-store-bc.o \
+       jit/method.o \
+       jit/nop-bc.o \
+       jit/object-bc.o \
+       jit/ostack-bc.o \
+       jit/spill-reload.o \
+       jit/stack-slot.o \
+       jit/statement.o \
+       jit/text.o \
+       jit/tree-node.o \
+       jit/tree-printer.o \
+       jit/typeconv-bc.o \
+       jit/subroutine.o \
+       jit/pc-map.o \
+       jit/wide-bc.o \
+       lib/bitset.o \
+       lib/buffer.o \
+       lib/list.o \
+       lib/radix-tree.o \
+       lib/string.o \
+       vm/bytecode.o \
+       vm/bytecodes.o \
+       vm/die.o \
+       vm/guard-page.o \
+       vm/stack.o \
+       vm/types.o \
+       vm/zalloc.o \
+       arch/mmix/instruction.o \
+       arch/mmix/register.o \
+       arch/mmix/stack-frame.o \
+       arch/mmix/use-def.o \
+       test/libharness/libharness.o \
+       test/vm/class-stub.o \
+       test/vm/classloader-stub.o \
+       test/vm/object-stub.o \
+       test/vm/preload-stub.o \
+       test/vm/jni-stub.o \
+       test/jit/trace-stub.o
+
+TEST_OBJS := \
        args-test-utils.o \
        arithmetic-bc-test.o \
        basic-block-test.o \
diff --git a/test/vm/Makefile b/test/vm/Makefile
index 2baa1d9..d0434d5 100644
--- a/test/vm/Makefile
+++ b/test/vm/Makefile
@@ -1,22 +1,23 @@
 RUNNER=vm-test-runner
 SUITE=vm-test-suite.c
 
-OBJS =                                 \
-       ../../arch/$(ARCH)/backtrace.o  \
-       ../../lib/bitset.o              \
-       ../../lib/buffer.o              \
-       ../../lib/list.o                \
-       ../../lib/list.o                \
-       ../../lib/radix-tree.o          \
-       ../../lib/string.o              \
-       ../../vm/bytecode.o             \
-       ../../vm/bytecodes.o            \
-       ../../vm/die.o                  \
-       ../../vm/natives.o              \
-       ../../vm/stack.o                \
-       ../../vm/types.o                \
-       ../../vm/zalloc.o               \
-       ../libharness/libharness.o      \
+TOPLEVEL_OBJS :=                       \
+       arch/$(ARCH)/backtrace.o        \
+       lib/bitset.o                    \
+       lib/buffer.o                    \
+       lib/list.o                      \
+       lib/radix-tree.o                \
+       lib/string.o                    \
+       vm/bytecode.o                   \
+       vm/bytecodes.o                  \
+       vm/die.o                        \
+       vm/natives.o                    \
+       vm/stack.o                      \
+       vm/types.o                      \
+       vm/zalloc.o                     \
+       test/libharness/libharness.o
+
+TEST_OBJS :=                           \
        bitset-test.o                   \
        buffer-test.o                   \
        bytecodes-test.o                \
-- 
1.6.0.4


------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to