Search
lxdream.org :: lxdream/test/Makefile
lxdream 0.9.1
released Jun 29
Download Now
filename test/Makefile
changeset 249:1708bec547df
prev233:f8333b94f503
next263:6f641270b2aa
author nkeynes
date Tue Dec 19 11:54:47 2006 +0000 (13 years ago)
permissions -rw-r--r--
last change Add lib.so to the testide build
file annotate diff log raw
nkeynes@185
     1
# host compiler and flags
nkeynes@185
     2
HOSTCC		= gcc
nkeynes@185
     3
HOSTCFLAGS	= -O2
nkeynes@185
     4
SH4CC		= sh-elf-gcc
nkeynes@185
     5
SH4INC          = -Iinclude
nkeynes@185
     6
SH4CFLAGS	= $(SH4INC) -D_arch_dreamcast -D_arch_sub_pristine \
nkeynes@185
     7
                  -O2 -fno-builtin -fno-strict-aliasing -ml -m4-single-only \
nkeynes@185
     8
                  -fno-optimize-sibling-calls
nkeynes@185
     9
SH4LD		= sh-elf-ld
nkeynes@185
    10
SH4LDFLAGS      = -fno-builtin -fno-strict-aliasing  -ml -m4-single-only \
nkeynes@185
    11
                  -Wl,-Tdc.x -nostartfiles -nostdlib -Llib
nkeynes@185
    12
SH4LIBS         = -Wl,--start-group -lc -lgcc -lm -Wl,--end-group
nkeynes@185
    13
SH4OBJCOPY      = sh-elf-objcopy -O binary
nkeynes@185
    14
ARMCC		= arm-elf-gcc
nkeynes@185
    15
ARMCFLAGS	= -O2
nkeynes@185
    16
ARMLD		= arm-elf-ld
nkeynes@185
    17
ARMOBJCOPY	= arm-elf-objcopy
nkeynes@185
    18
nkeynes@185
    19
BFDLIB		= -L/usr/local/sh-elf-bfd/lib -lbfd -liberty
nkeynes@185
    20
BFDINCLUDE	= /usr/local/sh-elf-bfd/include
nkeynes@185
    21
RUNTEST		= ../src/lxdream -c ./lxdream.rc -h -q -p
nkeynes@185
    22
nkeynes@185
    23
nkeynes@185
    24
# cygwin
nkeynes@185
    25
# these must point to your sh-elf bfd, not the system one
nkeynes@185
    26
#BFDLIB		= -L/usr/local/lib -lbfd -liberty -lintl
nkeynes@185
    27
#BFDINCLUDE	= /usr/local/include
nkeynes@185
    28
nkeynes@185
    29
#SHARED_OBJECTS	= crt0.so dcload-syscall.so dcload-syscalls.so memcpy.so lib.so
nkeynes@185
    30
SHARED_OBJECTS	=
nkeynes@185
    31
nkeynes@185
    32
%.ao: %.c
nkeynes@185
    33
	$(ARMCC) $(ARMCFLAGS) -o $@ -c $< 
nkeynes@185
    34
nkeynes@185
    35
%.ao: %.s
nkeynes@185
    36
	$(ARMCC) $(ARMCFLAGS) -o $@ -c $< 
nkeynes@185
    37
nkeynes@185
    38
%.so: %.c
nkeynes@185
    39
	$(SH4CC) $(SH4CFLAGS) -o $@ -c $< 
nkeynes@185
    40
nkeynes@185
    41
%.so: %.ac
nkeynes@185
    42
	$(SH4CC) $(SH4CFLAGS) -o $@ -c $< 
nkeynes@185
    43
nkeynes@185
    44
%.so: %.s
nkeynes@185
    45
	$(SH4CC) $(SH4CFLAGS) -o $@ -c $< 
nkeynes@185
    46
nkeynes@185
    47
%.so: %.S
nkeynes@185
    48
	$(SH4CC) $(SH4CFLAGS) -o $@ -c $< 
nkeynes@185
    49
nkeynes@185
    50
%.o: %.c
nkeynes@185
    51
	$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
nkeynes@185
    52
nkeynes@185
    53
%.arm: %.ao arm_crt0.ao
nkeynes@185
    54
	$(ARMCC) -Wl,-Ttext,0x00000000 -nostartfiles -nostdlib -e reset -o $@ arm_crt0.ao $< -lgcc
nkeynes@185
    55
nkeynes@185
    56
nkeynes@185
    57
%.bin: %.arm
nkeynes@185
    58
	$(ARMOBJCOPY) -O binary $< $@
nkeynes@185
    59
nkeynes@185
    60
%.aso: %.bin bin2c
nkeynes@185
    61
	./bin2c $< $<.c
nkeynes@185
    62
	$(SH4CC) $(SH4CFLAGS) -o $@ -c $<.c
nkeynes@185
    63
nkeynes@185
    64
all: build-tests
nkeynes@185
    65
nkeynes@185
    66
test: build-tests
nkeynes@185
    67
	$(RUNTEST) testmath
nkeynes@185
    68
	$(RUNTEST) testide -d ../disc/test.nrg
nkeynes@190
    69
	$(RUNTEST) testta < testta.data < testta2.data < testta3.data < testta4.data < testta5.data
nkeynes@190
    70
	$(RUNTEST) testregs
nkeynes@185
    71
nkeynes@230
    72
build-tests: testsh4 testmath testide testta testregs testrend
nkeynes@185
    73
nkeynes@230
    74
testsh4: crt0.so sh4/testsh4.so timer.so interrupt.so \
nkeynes@228
    75
	 sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \
nkeynes@231
    76
	 sh4/bf.so sh4/bt.so sh4/cmp.so \
nkeynes@233
    77
	 sh4/excslot.so sh4/undef.so
nkeynes@225
    78
	$(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
nkeynes@230
    79
	$(SH4OBJCOPY) testsh4 testsh4.bin
nkeynes@225
    80
nkeynes@249
    81
testide: crt0.so testide.so ide.so lib.so
nkeynes@185
    82
	$(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
nkeynes@230
    83
	$(SH4OBJCOPY) testide testide.bin
nkeynes@185
    84
nkeynes@185
    85
testmath: crt0.so $(SHARED_OBJECTS) testmath.so math.so
nkeynes@185
    86
	$(SH4CC) $(SH4LDFLAGS) $^  -o $@ $(SH4LIBS)
nkeynes@185
    87
nkeynes@190
    88
testregs: crt0.so $(SHARED_OBJECTS) testregs.so
nkeynes@190
    89
	$(SH4CC) $(SH4LDFLAGS) $^  -o $@ $(SH4LIBS)
nkeynes@190
    90
	$(SH4OBJCOPY) testregs testregs.bin
nkeynes@190
    91
nkeynes@185
    92
testta: crt0.so $(SHARED_OBJECTS) testta.so pvr.so dmac.so asic.so lib.so testdata.so
nkeynes@185
    93
	$(SH4CC) $(SH4LDFLAGS) $^  -o $@ $(SH4LIBS)
nkeynes@185
    94
	$(SH4OBJCOPY) testta testta.bin
nkeynes@185
    95
nkeynes@213
    96
testrend: crt0.so $(SHARED_OBJECTS) testrend.so pvr.so dmac.so asic.so lib.so testdata.so
nkeynes@213
    97
	$(SH4CC) $(SH4LDFLAGS) $^  -o $@ $(SH4LIBS)
nkeynes@213
    98
	$(SH4OBJCOPY) testrend testrend.bin
nkeynes@213
    99
nkeynes@185
   100
readdata: crt0.so readdata.so
nkeynes@185
   101
	$(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
nkeynes@185
   102
nkeynes@185
   103
.PHONY : clean
nkeynes@185
   104
clean:
nkeynes@185
   105
	rm -f *.o *.so *.ao *.ac *.bin mapleid ide readmem dumpasic
nkeynes@185
   106
.