Makefile.ALL
2.84 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!gmake
ifndef SIMTOOLS
SIMTOOLS = ../../..
endif
CPUSIM = mxs
include $(SIMTOOLS)/makedefs
TARGET = mxslib.a
VPATH = ..
#################################################################
# INCLUDES
#################################################################
INCS = -I$(SIMTOOLS)/simos -I$(SIMTOOLS)/cpus/mipsy
INCS += -I$(SIMTOOLS)/cpus/mxs -I$(SIMTOOLS)/caches/2Level
INCS += -I$(SIMTOOLS)/caches
INCS += -I$(SIMTOOLS)/cpus/shared
INCS += -I$(SIMTOOLS)/memsystems
INCS += -I$(SIMTOOLS)/cpus/simos
INCS += $(GLOBAL_INCS)
#################################################################
# DEFINES
#################################################################
#DEF1 = -DSIMOS -DMEMSTAT -DUSEREXIT -DDATA_HANDLING -DMIPSY_MXS
DEF1 = -DSIMOS -DMEMSTAT -DUSEREXIT -DMIPSY_MXS
DEF2 = -DNEED_OPTAB -DBREAKPOINT -DDEBUG_CHECKS -DTRACE
DEFS = $(DEF1) $(DEF2) $(GLOBAL_DEFS)
################################################################
# C and ASM FLAGS
################################################################
ASFLAGS = $(GLOBAL_ASFLAGS)
CFLAGS = $(GLOBAL_CFLAGS)
CC_OPTS = $(CFLAGS) $(INCS) $(DEFS)
AS_OPTS = $(ASFLAGS) $(INCS) $(DEFS)
MXS_CSRCS = ms.c ms_fetch.c ms_compile.c \
ms_grad.c mc_opc.c ms_ldst.c ms_branch.c \
ms_wrklst.c ms_divmul.c \
ms_st_init.c ms_iprint.c ms_stats.c \
ms_simos.c
MXS_M4SRCS = ms_inst.m4
SIMOSCSRCS = simos_interface.c r4k_cp0.c cpu.c debug.c fpu.c stats.c \
cpu_interface.c print_insts.c smash_insts.c \
dash_prefetch.c
MIPSY_C_TARGETS = $(SIMOSCSRCS:.c=.o)
C_TARGETS = $(MXS_CSRCS:.c=.o)
M4_TARGETS = $(MXS_M4SRCS:.m4=.o)
TARGETS = $(sort $(ASM_TARGETS) $(MIPSY_ASM_TARGETS) $(C_TARGETS) \
$(MIPSY_C_TARGETS) $(M4_TARGETS))
.PHONY: warn deps
default: warn
@$(MAKE) -f ../Makefile.ALL SIMOS=1 deps
@$(MAKE) -f ../Makefile.ALL SIMOS=1 INCLUDE_DEPS=1 $(TARGET)
$(TARGET): $(TARGETS)
@echo "-> Updating $(TARGET)"
$(AR) cru $(TARGET) $(TARGETS)
warn:
@echo ""
@echo "Making MXS"
@echo "**********"
@echo " DEFS : `$(FORMAT) $(DEFS)`"
@echo " CFLAGS : `$(FORMAT) $(CFLAGS)`"
@echo ""
ms_stats.h: ../stats.awk ../ms.h
nawk -f ../stats.awk ../ms.h > ../ms_stats.h
$(C_TARGETS): %.o: %.c
@echo "Compiling $(<F)"
$(CC) $(CC_OPTS) -c $<
$(MIPSY_C_TARGETS): %.o: $(SIMTOOLS)/cpus/mipsy/%.c
@echo "Compiling $(<F)"
$(CC) $(CC_OPTS) -c $<
$(ASM_TARGETS): %.o: %.s
@echo "Assembling $(<F)"
$(AS) $(AS_OPTS) -c $< -o $@
$(MIPSY_ASM_TARGETS): %.o: $(SIMTOOLS)/cpus/mipsy/%.s
@echo "Assembling $(<F)"
$(AS) $(AS_OPTS) -c $< -o $@
$(M4_TARGETS): %.o: %.m4
@echo "Macro-izing $(<F)"
m4 $< > $*.c
$(CC) $(CC_OPTS) -c $*.c
ms_stats.o: ms_stats.h
deps: ms_stats.h ${C_TARGETS:.o=.d}
%.d: %.c
@echo "Finding dependencies of $(<F)"
@$(CC) -M $(CC_OPTS) $< > $@
ifdef INCLUDE_DEPS
include ${C_TARGETS:.o=.d}
endif