Makefile.ALL
2.69 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!gmake
ifndef SIMTOOLS
SIMTOOLS = ../../..
endif
include $(SIMTOOLS)/makedefs
TARGET = mipsylib.a
VPATH = ..
#################################################################
# INCLUDE DIRECTORIES
#################################################################
ID1 = -I$(SIMTOOLS)/cpus/simos
ID2 = -I$(SIMTOOLS)/cpus/shared
# REMOVE THIS
ID3 = -I$(SIMTOOLS)/caches -I$(SIMTOOLS)/caches/2Level
ifdef USE_FLASHLITE
ID4 = -I$(SIMDIR) -I$(SIMTOOLS)/memsystems/flashlite
endif
ifdef SOLO
ID5 = -I$(SIMTOOLS)/cpus/solo
endif
ifeq ($(CPUSIM),mxs)
ID6 = -I$(SIMTOOLS)/cpus/mxs
endif
INCS = $(ID1) $(ID2) $(ID3) $(ID4) $(ID5) $(ID6) $(GLOBAL_INCS)
ifdef FLASHPOINT
INCS += -I$(MEMSPY_DIR) -I$(SIMDIR)
endif
#################################################################
# DEFINES
#################################################################
DEF1 = # -DNO_CACHES
#DEF2 = -DPRINT_INSTRUCTIONS
ifdef TRACING
DEF3 = -DTRACING
endif
DEF4 =
ifdef USE_FLASHLITE
DEF4 = -DUSE_FLASHLITE
endif
ifdef SOLO
DEF5 = $(SOLOCFLAGS)
endif
ifeq ($(CPUSIM),mxs)
DEF6 = -DMIPSY_MXS
endif
DEFS = $(DEF1) $(DEF2) $(DEF3) $(DEF4) $(DEF5) $(DEF6) $(GLOBAL_DEFS)
ifdef FLASHPOINT
DEFS += -DFLASHPOINT
endif
#################################################################
# C and ASM FLAGS
#################################################################
CFLAGS = $(GLOBAL_CFLAGS)
CC_OPTS = $(CFLAGS) $(INCS) $(DEFS)
ifeq ($(CPU),SGI)
CC_OPTS += -Olimit 2200
endif
ifeq ($(CPU),SGIN32)
CC_OPTS += -OPT:Olimit=4000
endif
ifeq ($(CPU),SGIM4)
CC_OPTS += -OPT:Olimit=4000
endif
#################################################################
# TARGETS
#################################################################
C_TARGETS = cpu.o debug.o fpu.o stats.o dash_prefetch.o\
cpu_interface.o smash_insts.o print_insts.o\
opcodes.o mdmx.o
ifdef TRACING
C_TARGETS += trace.o
endif
ifndef SOLO
C_TARGETS += simos_interface.o r4k_cp0.o
endif
TARGETS = $(C_TARGETS)
.PHONY: warn deps
default: warn
ifdef SOLO
@$(MAKE) -f ../Makefile.ALL SOLO=1 deps
@$(MAKE) -f ../Makefile.ALL SOLO=1 INCLUDE_DEPS=1 $(TARGET)
else
@$(MAKE) -f ../Makefile.ALL deps
@$(MAKE) -f ../Makefile.ALL INCLUDE_DEPS=1 $(TARGET)
endif
$(TARGET): $(TARGETS)
@echo "-> Updating library $(TARGET)"
$(AR) cru $(TARGET) $(TARGETS)
warn:
@echo ""
@echo "Making MIPSY"
@echo "************"
@echo " DEFS : `$(FORMAT) $(DEFS)`"
@echo " CFLAGS : `$(FORMAT) $(CFLAGS)`"
@echo " INCS: `$(FORMAT) $(INCS)`"
@echo ""
$(C_TARGETS): %.o: %.c
@echo "Compiling $(<F)"
$(CC) $(CC_OPTS) -c $<
deps: ${TARGETS:.o=.d}
%.d: %.c
@$(CC) -M $(CC_OPTS) $< > $@
ifdef INCLUDE_DEPS
include ${TARGETS:.o=.d}
endif