Makefile: trim redundant whitespaces
[cavatools.git] / caveat / Makefile
1 # Path where things should be installed
2 R = $(HOME)
3 B = build
4
5 _dummy := $(shell mkdir -p $B)
6 _dummy := $(shell mkdir -p $R/include/cava)
7
8 # Object files for libcava.a
9 aobj := elf_loader.o insn.o shmfifo.o
10 aobj := $(addprefix $B/,$(aobj))
11
12 # Object files for caveat not in libcava.a
13 cobj := main.o core.o fast_sim.o slow_sim.o ecall.o
14 cobj := $(addprefix $B/,$(cobj))
15
16 # Include files for libcava.a
17 incf := opcodes.h insn.h caveat.h shmfifo.h
18
19 # Libraries
20 libs := $R/lib/softfloat.a -lrt -lpthread -lm
21
22 # Compiler flags
23 CFLAGS := -I../include -I$R/include -I$R/include/softfloat -g -O3
24 LDFLAGS := -Wl,-Ttext=70000000
25
26
27 #$(info $$aobj is [${aobj}])
28 #$(info $$cobj is [${cobj}])
29
30
31 # Make targets
32
33 all: $R/lib/libcava.a $B/caveat
34
35 install: all
36 -cp $B/caveat $R/bin/caveat
37 -cp $(incf) $R/include/cava
38
39 .PHONY: clean
40 clean:
41 rm -f decode_insn.h disasm_insn.h execute_insn.h ecall_nums.h opcodes.h opcodes_attr.h *.o *~ ./#*#
42 rm -rf build
43
44
45 # Emulator and library
46
47 $B/caveat : $(cobj) $R/lib/libcava.a
48 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(libs)
49
50 $R/lib/libcava.a : $(aobj)
51 ar rcs $@ $^
52
53 # Dependencies
54
55 $(aobj): $(incf)
56 $(cobj): $(incf)
57
58 $B/slow_sim.o $B/fast_sim.o: sim_body.h execute_insn.h caveat_fp.h core.h
59 $B/ecall.o: core.h ecall_nums.h
60 $B/insn.o: decode_insn.h disasm_insn.h
61 $B/trace.o: fifo.h
62
63 $B/fast_sim.o: fast_sim.c
64 $(CC) $(CFLAGS) -Ofast -o $@ -c $<
65
66 $B/core.o: core.c core.h
67 $(CC) $(CFLAGS) -o $@ -c $<
68
69 $B/elf_loader.o : elf_loader.c
70 $(CC) $(CFLAGS) -o $@ -c $<
71
72 $B/ecall.o : ecall.c
73 $(CC) $(CFLAGS) -o $@ -c $<
74
75 $B/%.o : %.c
76 $(CC) $(CFLAGS) -o $@ -c $<
77
78 $B/%.o : %.cc
79 $(CC) $(CFLAGS) -o $@ -c $<
80
81
82 opcodes.h opcodes_attr.h decode_insn.h execute_insn.h disasm_insn.h constants.c: crunch_isa.py Instructions.def
83 python3 crunch_isa.py
84
85 ecall_nums.h: make_ecall_tbl.py
86 python3 make_ecall_tbl.py