nkeynes@185: # host compiler and flags nkeynes@185: HOSTCC = gcc nkeynes@185: HOSTCFLAGS = -O2 nkeynes@185: SH4CC = sh-elf-gcc nkeynes@185: SH4INC = -Iinclude nkeynes@185: SH4CFLAGS = $(SH4INC) -D_arch_dreamcast -D_arch_sub_pristine \ nkeynes@185: -O2 -fno-builtin -fno-strict-aliasing -ml -m4-single-only \ nkeynes@185: -fno-optimize-sibling-calls nkeynes@185: SH4LD = sh-elf-ld nkeynes@185: SH4LDFLAGS = -fno-builtin -fno-strict-aliasing -ml -m4-single-only \ nkeynes@185: -Wl,-Tdc.x -nostartfiles -nostdlib -Llib nkeynes@185: SH4LIBS = -Wl,--start-group -lc -lgcc -lm -Wl,--end-group nkeynes@185: SH4OBJCOPY = sh-elf-objcopy -O binary nkeynes@185: ARMCC = arm-elf-gcc nkeynes@185: ARMCFLAGS = -O2 nkeynes@185: ARMLD = arm-elf-ld nkeynes@185: ARMOBJCOPY = arm-elf-objcopy nkeynes@185: nkeynes@185: BFDLIB = -L/usr/local/sh-elf-bfd/lib -lbfd -liberty nkeynes@185: BFDINCLUDE = /usr/local/sh-elf-bfd/include nkeynes@185: RUNTEST = ../src/lxdream -c ./lxdream.rc -h -q -p nkeynes@185: nkeynes@185: nkeynes@185: # cygwin nkeynes@185: # these must point to your sh-elf bfd, not the system one nkeynes@185: #BFDLIB = -L/usr/local/lib -lbfd -liberty -lintl nkeynes@185: #BFDINCLUDE = /usr/local/include nkeynes@185: nkeynes@185: #SHARED_OBJECTS = crt0.so dcload-syscall.so dcload-syscalls.so memcpy.so lib.so nkeynes@185: SHARED_OBJECTS = nkeynes@185: nkeynes@185: %.ao: %.c nkeynes@185: $(ARMCC) $(ARMCFLAGS) -o $@ -c $< nkeynes@185: nkeynes@185: %.ao: %.s nkeynes@185: $(ARMCC) $(ARMCFLAGS) -o $@ -c $< nkeynes@185: nkeynes@185: %.so: %.c nkeynes@185: $(SH4CC) $(SH4CFLAGS) -o $@ -c $< nkeynes@185: nkeynes@185: %.so: %.ac nkeynes@185: $(SH4CC) $(SH4CFLAGS) -o $@ -c $< nkeynes@185: nkeynes@185: %.so: %.s nkeynes@185: $(SH4CC) $(SH4CFLAGS) -o $@ -c $< nkeynes@185: nkeynes@185: %.so: %.S nkeynes@185: $(SH4CC) $(SH4CFLAGS) -o $@ -c $< nkeynes@185: nkeynes@185: %.o: %.c nkeynes@185: $(HOSTCC) $(HOSTCFLAGS) -o $@ -c $< nkeynes@185: nkeynes@185: %.arm: %.ao arm_crt0.ao nkeynes@185: $(ARMCC) -Wl,-Ttext,0x00000000 -nostartfiles -nostdlib -e reset -o $@ arm_crt0.ao $< -lgcc nkeynes@185: nkeynes@185: nkeynes@185: %.bin: %.arm nkeynes@185: $(ARMOBJCOPY) -O binary $< $@ nkeynes@185: nkeynes@185: %.aso: %.bin bin2c nkeynes@185: ./bin2c $< $<.c nkeynes@185: $(SH4CC) $(SH4CFLAGS) -o $@ -c $<.c nkeynes@185: nkeynes@185: all: build-tests nkeynes@185: nkeynes@185: test: build-tests nkeynes@185: $(RUNTEST) testmath nkeynes@185: $(RUNTEST) testide -d ../disc/test.nrg nkeynes@190: $(RUNTEST) testta < testta.data < testta2.data < testta3.data < testta4.data < testta5.data nkeynes@190: $(RUNTEST) testregs nkeynes@185: nkeynes@278: build-tests: testsh4 testmath testide testta testregs testrend testdisp testspu nkeynes@185: nkeynes@230: testsh4: crt0.so sh4/testsh4.so timer.so interrupt.so \ nkeynes@228: sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \ nkeynes@231: sh4/bf.so sh4/bt.so sh4/cmp.so \ nkeynes@357: sh4/float.so sh4/ftrc.so \ nkeynes@233: sh4/excslot.so sh4/undef.so nkeynes@225: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@230: $(SH4OBJCOPY) testsh4 testsh4.bin nkeynes@225: nkeynes@263: testide: crt0.so testide.so ide.so lib.so testdata.so nkeynes@185: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@230: $(SH4OBJCOPY) testide testide.bin nkeynes@185: nkeynes@185: testmath: crt0.so $(SHARED_OBJECTS) testmath.so math.so nkeynes@185: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@185: nkeynes@344: testregs: crt0.so $(SHARED_OBJECTS) testregs.so ide.so nkeynes@190: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@190: $(SH4OBJCOPY) testregs testregs.bin nkeynes@190: nkeynes@185: testta: crt0.so $(SHARED_OBJECTS) testta.so pvr.so dmac.so asic.so lib.so testdata.so nkeynes@185: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@185: $(SH4OBJCOPY) testta testta.bin nkeynes@185: nkeynes@213: testrend: crt0.so $(SHARED_OBJECTS) testrend.so pvr.so dmac.so asic.so lib.so testdata.so nkeynes@213: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@213: $(SH4OBJCOPY) testrend testrend.bin nkeynes@213: nkeynes@344: testblend: crt0.so $(SHARED_OBJECTS) testblend.so pvr.so dmac.so asic.so lib.so testdata.so nkeynes@344: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@344: $(SH4OBJCOPY) testblend testblend.bin nkeynes@344: nkeynes@263: testdisp: crt0.so $(SHARED_OBJECTS) testdisp.so pvr.so asic.so lib.so testdata.so timer.so nkeynes@263: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@263: $(SH4OBJCOPY) testdisp testdisp.bin nkeynes@263: nkeynes@278: testyuv: crt0.so $(SHARED_OBJECTS) testyuv.so pvr.so asic.so lib.so testdata.so timer.so dmac.so nkeynes@278: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@278: $(SH4OBJCOPY) testyuv testyuv.bin nkeynes@278: nkeynes@278: testspu: crt0.so $(SHARED_OBJECTS) testspu.so asic.so lib.so testdata.so timer.so dmac.so nkeynes@278: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@278: $(SH4OBJCOPY) testspu testspu.bin nkeynes@278: nkeynes@344: testg2: crt0.so $(SHARED_OBJECTS) testg2.so asic.so lib.so testdata.so timer.so dmac.so nkeynes@344: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@344: $(SH4OBJCOPY) testg2 testg2.bin nkeynes@344: nkeynes@185: readdata: crt0.so readdata.so nkeynes@185: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@185: nkeynes@297: rend: crt0.so rendload.so asic.so lib.so timer.so pvr.so nkeynes@297: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@297: $(SH4OBJCOPY) rend rend.bin nkeynes@297: nkeynes@344: testFF10: crt0.so testFF10.so lib.so nkeynes@344: $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS) nkeynes@344: $(SH4OBJCOPY) testFF10 testFF10.bin nkeynes@344: nkeynes@185: .PHONY : clean nkeynes@185: clean: nkeynes@185: rm -f *.o *.so *.ao *.ac *.bin mapleid ide readmem dumpasic nkeynes@185: