cavatools: initialize repository
[cavatools.git] / pipesim / Makefile
1 # Path where things should be installed
2 R = $(HOME)
3 B = build
4
5 _dummy := $(shell mkdir -p $B)
6
7 # Object files for libcava.a
8 aobj := perfctr.o cache.o
9 aobj := $(addprefix $B/,$(aobj))
10
11 # Object files for caveat not in libcava.a
12 cobj := pipesim.o fast_pipe.o trace_pipe.o count_pipe.o trace_count_pipe.o
13 cobj := $(addprefix $B/,$(cobj))
14
15 # Include files for libcava.a
16 incf := perfctr.h cache.h lru_fsm_1way.h lru_fsm_2way.h lru_fsm_3way.h lru_fsm_4way.h
17
18 # Libraries
19 libs := -lrt -lpthread -lm
20
21 # Compiler flags
22 CFLAGS := -I$R/include/cava -g -Ofast
23 #CFLAGS := -I$R/include/cava -g -O0
24
25
26 # Dependent headers
27 hdrs := opcodes.h insn.h shmfifo.h caveat.h
28
29 # Text substitutions
30 hdrs := $(addprefix $R/include/cava/,$(hdrs))
31
32
33 # Make targets
34
35 all:
36
37 install: $B/pipesim $R/lib/libcava.a $(incf)
38 -cp $B/pipesim $R/bin/pipesim
39 -cp $(incf) $R/include/cava
40
41 .PHONY: clean
42
43 $R/lib/libcava.a: $(aobj)
44 ar rcs $@ $^
45
46
47 clean:
48 rm -f lru_fsm_?way.h *.o *~ ./#*#
49 rm -rf build
50
51
52 # Pipeline simulator and library
53
54 $B/pipesim: $(cobj) $R/lib/libcava.a
55 $(CC) $(CFLAGS) -o $@ $^ $(libs)
56
57
58 # Dependencies
59
60 $B/pipesim.o $B/fast_pipe.o $B/trace_pipe.o $B/count_pipe.o $B/trace_count_pipe.o: pipesim.h cache.h perfctr.h $(hdrs) $(incf)
61 $B/fast_pipe.o $B/trace_pipe.o $B/count_pipe.o $B/trace_count_pipe.o: mainloop.h
62 $B/perfctr.o: perfctr.h
63
64 lru_fsm_1way.h: make_cache
65 ./make_cache 1
66
67 lru_fsm_2way.h: make_cache
68 ./make_cache 2
69
70 lru_fsm_3way.h: make_cache
71 ./make_cache 3
72
73 lru_fsm_4way.h: make_cache
74 ./make_cache 4
75
76 $B/%.o : %.c
77 $(CC) $(CFLAGS) -o $@ -c $<