Makefile.ALL
3.61 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!gmake
# Makefile for embra libraries
ifndef SIMTOOLS
SIMTOOLS = ../../..
endif
include $(SIMTOOLS)/makedefs
VPATH = ..
################################################################
# INCLUDES
################################################################
# for private vcode includes: -I $(HOME)/vcode/vcode-src
INCS = -I$(SIMTOOLS)/cpus/shared \
-I$(SIMTOOLS)/cpus/simos \
-I$(SIMTOOLS)/cpus/mipsy $(GLOBAL_INCS) \
-I$(SIMTOOLS)/common/dcg_support
# always use VCODE now ;-)
SIMOS = 1
VCODE = 1
ifdef VCODE
VC_DIR = $(SIMOS_DIR)/build-files/include/sgi
INCS += -I$(VC_DIR)
endif
################################################################
# DEFINES
################################################################
DEFS = -DSIMOS $(GLOBAL_DEFS)
ifdef SIMOSTRANSDEBUG
DEFS += -DDEBUG_TRANSLATOR
endif
ifdef VCODE
DEFS += -DVCODE=1
endif
ifdef OLDCODE
TRANSLATOR = translator.old.c
DEFS += -DOLDCODE=1
else
TRANSLATOR = translator.c
endif
#################################################################
# C and ASM FLAGS
#################################################################
ifdef SIMOSDEBUG
CFLAGS = -g
ASFLAGS = -g
endif
ifdef SIMOSTRANSDEBUG
CFLAGS = -g
ASFLAGS = -g
endif
ifdef SIMOS
CFLAGS += $(GLOBAL_CFLAGS)
ASFLAGS += $(GLOBAL_ASFLAGS)
endif
# if we want to allow optimization of large routines
# CFLAGS += -Olimit 3000
# CFLAGS += -g3
#################################################################
# Source files for various makes
#################################################################
C1SRCS = $(TRANSLATOR) decoder.c
TRANSDEBUGCSRCS = $(C1SRCS) debug_trans.c
CSRCS = driver.c qc.c qc64.c cache.c
ifdef VCODE
CSRCS += main_run.c
endif
# was: main_run.s callout.s
SSRCS =
SIMOSCSRCS = $(CSRCS) $(C1SRCS) mem_control.c clock.c \
stats.c debug.c directory.c simos_interface.c r4k_cp0.c
SIMOSSSRCS = $(SSRCS) directory_asm.s
SOLOCSRCS = $(CSRCS) mem_tlb_solo.c mem_driver.c solo_nops.c
SOLOSSRCS = $(SSRCS) solo_switch.s
ifdef SIMOSTRANSDEBUG
C_TARGETS = $(TRANSDEBUGCSRCS:.c=.o)
else
C_TARGETS = $(SIMOSCSRCS:.c=.o)
ASM_TARGETS = $(SIMOSSSRCS:.s=.o)
endif
ifdef SIMOSTRANSDEBUG
TARGETS = $(TRANSDEBUGOBJS)
ASFLAGS = $(SIMOSDEBUGSFLAGS)
CFLAGS = $(SIMOSTRANSDEBUGCFLAGS)
else
ifdef SIMOS
TARGET = embralib.a
VC_TARGETS = $(LIBDIR)/vcode.lib.a $(VC_DIR)/vcode.h
TARGETS = $(C_TARGETS) $(ASM_TARGETS)
endif
ifdef SIMOSDEBUG
TARGET = embradebuglib
TARGETS = $(C_TARGETS) $(ASM_TARGETS)
endif
endif
AS_OPTS = $(ASFLAGS) $(DEFS) $(INCS)
CC_OPTS = $(CFLAGS) $(DEFS) $(INCS)
.PHONY: warn deps
default: warn
ifdef SIMOS
@$(MAKE) -f ../Makefile.ALL SIMOS=1 deps
@$(MAKE) -f ../Makefile.ALL SIMOS=1 INCLUDE_DEPS=1 $(TARGET)
else
@echo "Embra currently is only set up to be made into SIMOS"
endif
$(TARGET): $(TARGETS)
@echo "-> Updating $(TARGET)"
echo $(AR) cru $(TARGET) $(TARGETS)
$(AR) cru $(TARGET) $(TARGETS)
debugtrans: warn $(TRANSDEBUGOBJS)
$(CC) -o ../debug_trans $(TARGETS) ../../shared/SOLO/shared.a -lmld
solocpu: warn $(SOLOOBJS)
$(AR) cru libsoloMshade.a $(SOLOOBJS)
warn:
@echo ""
@echo "Making EMBRA"
@echo "************"
@echo " DEFS : `$(FORMAT) $(DEFS)`"
@echo " CFLAGS : `$(FORMAT) $(CFLAGS)`"
@echo " ASFLAGS : `$(FORMAT) $(ASFLAGS)`"
@echo ""
clean::
echo "ha ha!"
$(C_TARGETS): %.o: %.c
@echo "Compiling $(<F)"
$(CC) $(CC_OPTS) -c $<
$(ASM_TARGETS): %.o: %.s
echo "Assembling $(<F)"
$(AS) $(AS_OPTS) -c $< -o $@
deps: ${TARGETS:.o=.d}
%.e: %.c
$(CC) -E $(CC_OPTS) $< > ../$@
%.d: %.c
@$(CC) -M $(CC_OPTS) $< > $@
%.d: %.s
@$(AS) -M $(AS_OPTS) $< > $@
ifdef INCLUDE_DEPS
include ${TARGETS:.o=.d}
endif