140d6ee94SAlex Bennée# 240d6ee94SAlex Bennée# x86 system tests 340d6ee94SAlex Bennée# 440d6ee94SAlex Bennée# This currently builds only for i386. The common C code is built 540d6ee94SAlex Bennée# with standard compiler flags however so we can support both by 640d6ee94SAlex Bennée# adding additional boot files for x86_64. 740d6ee94SAlex Bennée# 840d6ee94SAlex Bennée 940d6ee94SAlex BennéeI386_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/i386/system 1040d6ee94SAlex BennéeX64_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/x86_64/system 1140d6ee94SAlex Bennée# Set search path for all sources 1240d6ee94SAlex BennéeVPATH+=$(I386_SYSTEM_SRC) 1340d6ee94SAlex Bennée 1440d6ee94SAlex Bennée# These objects provide the basic boot code and helper functions for all tests 1540d6ee94SAlex BennéeCRT_OBJS=boot.o 1640d6ee94SAlex Bennée 1740d6ee94SAlex BennéeX86_TEST_SRCS=$(wildcard $(I386_SYSTEM_SRC)/*.c) 1840d6ee94SAlex BennéeX86_TESTS = $(patsubst $(I386_SYSTEM_SRC)/%.c, %, $(X86_TEST_SRCS)) 1940d6ee94SAlex Bennée 2040d6ee94SAlex Bennéeifeq ($(TARGET_X86_64), y) 2140d6ee94SAlex BennéeCRT_PATH=$(X64_SYSTEM_SRC) 2240d6ee94SAlex BennéeLINK_SCRIPT=$(X64_SYSTEM_SRC)/kernel.ld 2340d6ee94SAlex BennéeLDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_x86_64 2440d6ee94SAlex Bennéeelse 2540d6ee94SAlex BennéeCRT_PATH=$(I386_SYSTEM_SRC) 2640d6ee94SAlex BennéeCFLAGS+=-m32 2740d6ee94SAlex BennéeLINK_SCRIPT=$(I386_SYSTEM_SRC)/kernel.ld 2840d6ee94SAlex BennéeLDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_i386 2940d6ee94SAlex Bennée# FIXME: move to common once x86_64 is bootstrapped 30*49d755d0SAlex BennéeTESTS+=$(X86_TESTS) $(MULTIARCH_TESTS) 3140d6ee94SAlex Bennéeendif 3240d6ee94SAlex BennéeCFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) 3340d6ee94SAlex BennéeLDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc 3440d6ee94SAlex Bennée 3540d6ee94SAlex Bennée# building head blobs 3640d6ee94SAlex Bennée.PRECIOUS: $(CRT_OBJS) 3740d6ee94SAlex Bennée 3840d6ee94SAlex Bennée%.o: $(CRT_PATH)/%.S 3940d6ee94SAlex Bennée $(CC) $(CFLAGS) -c $< -o $@ 4040d6ee94SAlex Bennée 4140d6ee94SAlex Bennée# Build and link the tests 4240d6ee94SAlex Bennée%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) 4340d6ee94SAlex Bennée $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) 4440d6ee94SAlex Bennée 4540d6ee94SAlex Bennée# Running 4640d6ee94SAlex BennéeQEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel 47