-
Notifications
You must be signed in to change notification settings - Fork 4
/
Common.mk
200 lines (161 loc) · 6.3 KB
/
Common.mk
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
188
189
190
191
192
193
194
195
196
197
198
199
200
###############################################################################
#
# Common.mk
#
# author: Henryk Richter <[email protected]>
#
# note: when switching between different hc99ardware targets, don`t forget
# "make clean" in between
#
# tools required:
# GNU Make, either VBCC or GCC for AmigaOS/68k, VASM
# recent sana2.h , e.g. from RoadShow SDK
#
# porting:
# you might need to adapt the paths (prefix for Compiler/Includes)
# Some installations have ADE: instead of GG: on Amigaos
# Recent work on AmigaOS cross toolchains suggest /opt/m68k-amigaos/sys-include
# instead of the traditional os-include
#
###############################################################################
# debug = 1 will include string debugging for terminal/sushi/sashimi
debug = 0
# compiler_vcc = 1 will trigger VBCC, else GCC
compiler_vcc = 1
###############################################################################
# prefix for system includes (ASM)
# native AmigaOS compilation: set PREFX=GG: or PREFX=ADE:, depending on toolchain
###############################################################################
PREFX = $(VBCC)/targets/m68k-amigaos
#PREFX = gg:
SYSINC ?= "-I$(PREFX)/include -I$(PREFX)/include2"
SYSLIB ?= "-L$(PREFX)/lib"
###############################################################################
#
# compiler executables (choice of gcc or vbcc)
#
###############################################################################
ifeq ($(compiler_vcc),1)
# VBCC (use explicit vlink line for LINK= if complaints about R_PC happen)
CCX = vc +aos68k $(SYSINC)
LINK = vlink -bamigahunk -x -s -mrel -Cvbcc -Bstatic -nostdlib -lamiga $(SYSLIB) #-Rshort
#LINKEXE = vlink -bamigahunk -x -s -mrel -Cvbcc -Bstatic
LINKEXE = vc +aos68k
#LINK = $(CCX) -nostdlib
CFLAGS = -O2 -+ -sc -cpu=$(CPU)
CFLAGS2 = -Os -+ -sc -c99 -cpu=$(CPU2)
else
# GCC
CCX = m68k-amigaos-gcc
LINK = $(CCX) -nostartfiles -s
LINKEXE = $(CCX) -s -noixemul
CFLAGS = -O3 -s -m$(CPU) -Wall -noixemul -mregparm=4 -fomit-frame-pointer -msoft-float -noixemul
CFLAGS2 = -O3 -s -m$(CPU2) -Wall -noixemul -mregparm=4 -fomit-frame-pointer -msoft-float -noixemul
endif
VASM = vasmm68k_mot
VASMFORMAT = -m$(CPU) -Fhunk -nowarn=2064 -quiet $(SYSINC)
VASMFORMAT2 = -m$(CPU2) -Fhunk -nowarn=2064 -quiet $(SYSINC)
# unused here
#HOST = $(shell uname)
###############################################################################
#
# paths to the local includes
#
###############################################################################
IPATH =
###############################################################################
#
# compile-level feature definitions
#
###############################################################################
ifeq ($(compiler_vcc),1)
# skip quotes with VCC, the AmigaOS native version doesn't like them
#DEFINES += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
#DEFINES += -DDEVICEDATE=$(DEVICEDATE)
#DEFINES += -DDEVICEEXTRA=$(DEVICEEXTRA)
DEFINES += -DDEVICENAME="$(DEVICEID)"
DEFINES += -DHAVE_VERSION_H=1
#DEFINES += -DNEWSTYLE
#ASMDEFS += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
#ASMDEFS += -DDEVICEDATE=$(DEVICEDATE) -DDEVICENAME=$(DEVICEID)
#DEFINES2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
#DEFINES2 += -DDEVICEDATE=$(DEVICEDATE)
#DEFINES2 += -DDEVICEEXTRA=$(DEVICEEXTRA)
DEFINES2 += -DDEVICENAME="$(DEVICEID2)"
DEFINES2 += -DHAVE_VERSION_H=1
#DEFINES2 += -DNEWSTYLE
#ASMDEFS2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
else
#DEFINES += -D"DEVICEVERSION=$(DEVICEVERSION)" -D"DEVICEREVISION=$(DEVICEREVISION)"
#DEFINES += -D"DEVICEDATE=$(DEVICEDATE)"
#DEFINES += -D"DEVICEEXTRA=$(DEVICEEXTRA)"
DEFINES += -D"DEVICENAME="$(DEVICEID)""
DEFINES += -DHAVE_VERSION_H=1
DEFINES += -DNEWSTYLE
#ASMDEFS += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
#ASMDEFS += -DDEVICEDATE=$(DEVICEDATE) -DDEVICENAME=$(DEVICEID)
#DEFINES2 += -D"DEVICEVERSION=$(DEVICEVERSION)" -D"DEVICEREVISION=$(DEVICEREVISION)"
#DEFINES2 += -D"DEVICEDATE=$(DEVICEDATE)" -D"DEVICENAME="$(DEVICEID2)""
#DEFINES2 += -D"DEVICEEXTRA=$(DEVICEEXTRA)"
DEFINES2 += -D"DEVICENAME="$(DEVICEID2)""
DEFINES2 += -DHAVE_VERSION_H=1
DEFINES2 += -DNEWSTYLE
#ASMDEFS2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
endif
###############################################################################
#
# debug
#
###############################################################################
ifeq ($(debug),1)
CFLAGS += -DDEBUG -g
CFLAGS2 += -DDEBUG -g
LINKLIBS = -L$(PREFX)/lib -ldebug
endif
###############################################################################
#
# compiler flags and optimization levels
#
###############################################################################
CFLAGS += -I. -I$(SUBDIR)
CFLAGS2 += -I. -I$(SUBDIR)
LDFLAGS =
###############################################################################
#
# objects to build
#
###############################################################################
# ASM based alternative to deviceheader.o would be romtag.o
OBJECTS = deviceheader.o deviceinit.o device.o scsiwifi.o
OBJECTS += $(ASMOBJECTS)
# used for secondary build
OBJECTS2 = $(patsubst %.o,%.2o,$(OBJECTS))
###############################################################################
#
# rules and commands
#
###############################################################################
all: $(DEVICEID) $(DEVICEID2) $(TESTTOOL) $(TESTTOOL2)
clean:
rm -f $(OBJECTS) $(OBJECTS2)
rm -f $(DEVICEID) $(DEVICEID2) $(EXTRACLEAN)
# not for cross compile :-)
install: $(DEVICEID) $(DEVICEID2)
copy $(DEVICEID) $(DEVICEID2) DEVS:
#sdnet: $(DEVICEID)
#expnet: $(DEVICEID2)
$(DEVICEID) : $(OBJECTS)
$(LINK) $(LDFLAGS) -o $@ $(OBJECTS) $(LINKLIBS) $(LINKOPTS)
# separate ruleset for each subdirectory, ./src overrides all other paths for priority
# of platform-optimized routines
%.o : %.c
$(CCX) -c $(CFLAGS) $(DEFINES) $(IPATH) -o $@ $<
%.o : %.asm
${VASM} $(VASMFORMAT) $(ASMDEFS) -I "D:\DaynaChain\amiga-sdk-master\sdkinclude" -o $@ $<
# secondary ruleset (used for expnet, will be ignored if DEVICEID2 is empty)
$(DEVICEID2) : $(OBJECTS2)
$(LINK) $(LDFLAGS) -o $@ $(OBJECTS2) $(LINKLIBS)
%.2o : %.c
$(CCX) -c $(CFLAGS2) $(DEFINES2) $(IPATH) $< -o $@
%.2o : %.asm
${VASM} $(VASMFORMAT2) $(ASMDEFS2) -o $@ $<