summaryrefslogtreecommitdiff
path: root/util/romcc/Makefile
blob: 51e5fa8f524eae0e7f632f65298dfd83aabae69c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
VERSION:=0.23
RELEASE_DATE:=08 May 2003
PACKAGE:=romcc


# Move the configuration defines to makefile.conf
CC=gcc
CPPFLAGS=-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(RELEASE_DATE)"'
CFLAGS=-O -g -Wall $(CPPFLAGS)

all: romcc test

romcc: romcc.c Makefile
	$(CC) $(CFLAGS) -o $@ $<

TESTS=\
	hello_world.c \
	simple_test.c \
	simple_test2.c \
	simple_test3.c \
	simple_test4.c \
	simple_test5.c \
	simple_test6.c \
	simple_test7.c \
	simple_test8.c \
	simple_test9.c \
	simple_test10.c \
	simple_test11.c \
	simple_test12.c \
	simple_test13.c \
	simple_test14.c \
	simple_test15.c \
	simple_test16.c \
	simple_test17.c \
	simple_test18.c \
	simple_test19.c \
	raminit_test.c \
	raminit_test2.c

TEST_SRCS:=$(patsubst %, tests/%, $(TESTS))
TEST_ASM:=$(patsubst %.c, tests/%.S, $(TESTS))
TEST_OBJ:=$(patsubst %.c, tests/%.o, $(TESTS))
TEST_ELF:=$(patsubst %.c, tests/%.elf, $(TESTS))

$(TEST_ASM): %.S: %.c romcc
	export ALLOC_CHECK_=2; ./romcc -O $< > $@

$(TEST_OBJ): %.o: %.S
	as $< -o $@

$(TEST_ELF): %.elf: %.o
	ld -Ttext 0x1000 $< -o $@

test: $(TEST_ELF)

echo:
	echo "TEST_SRCS=$(TEST_SRCS)"
	echo "TEST_ASM=$(TEST_ASM)"
	echo "TEST_OBJ=$(TEST_OBJ)"
	echo "TEST_ELF=$(TEST_ELF)"

clean:
	rm -f romcc core $(TEST_ASM) $(TEST_OBJ) $(TEST_ELF)