1 |
# Unix makefile for Basilisk II |
2 |
|
3 |
## System specific configuration |
4 |
SHELL = /bin/sh |
5 |
|
6 |
HOST_CC = @CC@ |
7 |
HOST_CXX = @CXX@ |
8 |
CC_PROG = @CC@ |
9 |
CXX_PROG = @CXX@ |
10 |
CFLAGS = @CFLAGS@ |
11 |
CXXFLAGS = @CXXFLAGS@ |
12 |
CPPFLAGS = @CPPFLAGS@ -I../include -I. @CPUINCLUDES@ -I../slirp |
13 |
DEFS = @DEFS@ @DEFINES@ -D_REENTRANT -DAQUA -DFPU_IEEE |
14 |
LDFLAGS = @LDFLAGS@ |
15 |
LIBS = @LIBS@ |
16 |
|
17 |
CFLAGS += -g |
18 |
CPPFLAGS += -I../uae_cpu |
19 |
CXXFLAGS += -g |
20 |
LN_S = ln -s |
21 |
|
22 |
## Compilers selection (XXX hackery for 10.2 cross-compilation...) |
23 |
SDK_VERSION.ppc = @PPC_SDK_VERSION@ |
24 |
SDK_VERSION = $(SDK_VERSION.$(ARCH)) |
25 |
ifeq ($(SDK_VERSION), 10.2.8) |
26 |
CC_PROG = gcc-3.3 |
27 |
CXX_PROG = g++-3.3 |
28 |
SDK_ROOT = /Developer/SDKs/MacOSX10.2.8.sdk |
29 |
CC_ROOT = -F$(SDK_ROOT)/System/Library/Frameworks |
30 |
LDFLAGS += -Wl,-syslibroot,$(SDK_ROOT) |
31 |
endif |
32 |
ifeq ($(SDK_VERSION), 10.3.9) |
33 |
CC_ROOT = -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -mmacosx-version-min=10.3 |
34 |
endif |
35 |
ifeq ($(SDK_VERSION), 10.4) |
36 |
CC_ROOT = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 |
37 |
endif |
38 |
CC = $(CC_PROG) $(CC_ROOT) -arch $(ARCH) |
39 |
CXX = $(CXX_PROG) $(CC_ROOT) -arch $(ARCH) |
40 |
|
41 |
SLIRP_CFLAGS = @SLIRP_CFLAGS@ |
42 |
SLIRP_SRCS = @SLIRP_SRCS@ |
43 |
SLIRP_OBJS = $(SLIRP_SRCS:../slirp/%.c=obj/%.o) |
44 |
|
45 |
## CPU emulation code |
46 |
WANT_JIT = @WANT_JIT@ |
47 |
WANT_JIT_DEBUG = @WANT_JIT_DEBUG@ |
48 |
USE_JIT = no |
49 |
CPUSRCS = \ |
50 |
../uae_cpu/basilisk_glue.cpp ../uae_cpu/readcpu.cpp \ |
51 |
../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/fpu/fpu_ieee.cpp |
52 |
GEN_CPUSRCS = \ |
53 |
cpustbl.cpp cpudefs.cpp \ |
54 |
cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp \ |
55 |
cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp |
56 |
ifeq ($(ARCH), i386) |
57 |
USE_JIT = $(WANT_JIT) |
58 |
DEFS += -DUNALIGNED_PROFITABLE -DREGPARAM="__attribute__((regparm(3)))" |
59 |
DEFS += -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE |
60 |
endif |
61 |
ifeq ($(ARCH), x86_64) |
62 |
USE_JIT = $(WANT_JIT) |
63 |
DEFS += -DUNALIGNED_PROFITABLE |
64 |
DEFS += -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS |
65 |
endif |
66 |
ifeq ($(USE_JIT), yes) |
67 |
DEFS += -DUSE_JIT -DUSE_JIT_FPU |
68 |
ifeq ($(WANT_JIT_DEBUG), yes) |
69 |
DEFS += -DJIT_DEBUG |
70 |
endif |
71 |
CPUSRCS += \ |
72 |
../uae_cpu/compiler/compemu_support.cpp \ |
73 |
../uae_cpu/compiler/compemu_fpp.cpp |
74 |
GEN_CPUSRCS += \ |
75 |
cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp \ |
76 |
cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp \ |
77 |
compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp \ |
78 |
compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp \ |
79 |
cpustbl_nf.cpp compstbl.cpp |
80 |
endif |
81 |
|
82 |
GEN_DIR = gen |
83 |
ifneq ($(ARCH),) |
84 |
GEN_DIR = gen.$(ARCH) |
85 |
endif |
86 |
CPUSRCS += $(foreach file, $(GEN_CPUSRCS), $(GEN_DIR)/$(file)) |
87 |
CPPFLAGS += -I$(GEN_DIR) |
88 |
|
89 |
## Source files thst replace/augment the ones from the Unix directory |
90 |
SYSSRCS = serial_unix.cpp ../dummy/scsi_dummy.cpp \ |
91 |
audio_macosx.cpp AudioBackEnd.cpp AudioDevice.cpp MacOSX_sound_if.cpp \ |
92 |
clip_macosx.cpp Controller.mm Emulator.mm EmulatorView.mm \ |
93 |
ether_unix.cpp extfs_macosx.cpp main_macosx.mm misc_macosx.mm \ |
94 |
NNThread.m prefs_macosx.cpp PrefsEditor.mm sys_darwin.cpp video_macosx.mm |
95 |
|
96 |
## Files |
97 |
SRCS = ../main.cpp ../prefs.cpp ../prefs_items.cpp \ |
98 |
sys_unix.cpp ../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp \ |
99 |
../emul_op.cpp ../macos_util.cpp ../xpram.cpp xpram_unix.cpp ../timer.cpp \ |
100 |
timer_unix.cpp ../adb.cpp ../serial.cpp ../ether.cpp \ |
101 |
../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp ../video.cpp \ |
102 |
vm_alloc.cpp sigsegv.cpp ../audio.cpp ../extfs.cpp \ |
103 |
../user_strings.cpp user_strings_unix.cpp sshpty.c strlcpy.c \ |
104 |
$(SYSSRCS) $(CPUSRCS) $(SLIRP_SRCS) |
105 |
|
106 |
## Source files from Unix source directory that we link to |
107 |
UNIXSRCS = ether_unix.cpp semaphore.h serial_unix.cpp sigsegv.cpp sigsegv.h \ |
108 |
sshpty.c sshpty.h strlcpy.c strlcpy.h sys_unix.cpp timer_unix.cpp \ |
109 |
user_strings_unix.cpp user_strings_unix.h \ |
110 |
vm_alloc.cpp vm_alloc.h xpram_unix.cpp |
111 |
|
112 |
## Documentation files |
113 |
DOCS = README.txt Credits.html ToDo.html HowTo.html Versions.html |
114 |
|
115 |
## Binaries to build |
116 |
APP = BasiliskII |
117 |
APP_APP = $(APP).app |
118 |
TARGET_ARCHES = @TARGET_ARCHES@ |
119 |
PROGS = $(foreach arch, $(TARGET_ARCHES), $(APP).$(arch)) |
120 |
|
121 |
BLESS = $(OBJ_DIR)/lowmem |
122 |
|
123 |
## Rules |
124 |
.PHONY: modules install installdirs uninstall mostlyclean clean distclean depend dep |
125 |
.SUFFIXES: |
126 |
.SUFFIXES: .c .cpp .s .o .h |
127 |
|
128 |
all: $(APP)_app |
129 |
|
130 |
README.txt: ../../README |
131 |
$(LN_S) $< $@ |
132 |
$(UNIXSRCS): %: ../Unix/% |
133 |
$(LN_S) $< $@ |
134 |
|
135 |
OBJ_DIR = obj |
136 |
ifneq ($(ARCH),) |
137 |
OBJ_DIR = obj.$(ARCH) |
138 |
endif |
139 |
$(OBJ_DIR):: |
140 |
@[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 |
141 |
|
142 |
define SRCS_LIST_TO_OBJS |
143 |
$(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SRCS), \ |
144 |
$(basename $(notdir $(file)))))) |
145 |
endef |
146 |
OBJS = $(SRCS_LIST_TO_OBJS) |
147 |
|
148 |
SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) |
149 |
VPATH := |
150 |
VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) |
151 |
|
152 |
define PROGS_template |
153 |
$(APP).$(1): links |
154 |
+$(MAKE) $(OBJ_DIR).$(1)/$(APP) ARCH=$(1) |
155 |
$(LN_S) -f $(OBJ_DIR).$(1)/$(APP) $(APP).$(1) |
156 |
endef |
157 |
|
158 |
$(APP): $(PROGS) |
159 |
lipo $(foreach arch, $(TARGET_ARCHES), -arch $(arch) $(APP).$(arch)) \ |
160 |
-create -output $@ |
161 |
|
162 |
$(foreach arch,$(TARGET_ARCHES),$(eval $(call PROGS_template,$(arch)))) |
163 |
|
164 |
links: $(UNIXSRCS) |
165 |
|
166 |
$(BLESS): $(OBJ_DIR) $(OBJ_DIR)/lowmem.o |
167 |
$(HOST_CC) -o $@ $(OBJ_DIR)/lowmem.o |
168 |
$(OBJ_DIR)/lowmem.o: ../Unix/Darwin/lowmem.c |
169 |
$(HOST_CC) -o $@ -c $< |
170 |
|
171 |
$(OBJ_DIR)/$(APP): $(OBJ_DIR) $(GEN_DIR) $(OBJS) $(BLESS) |
172 |
$(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) |
173 |
$(BLESS) $@ |
174 |
|
175 |
$(APP)_app: $(APP) $(DOCS) Info.plist $(APP).icns |
176 |
rm -rf $(APP_APP)/Contents |
177 |
mkdir -p $(APP_APP)/Contents |
178 |
cp -f ../MacOSX/Info.plist $(APP_APP)/Contents/ |
179 |
echo -n 'APPL????' > $(APP_APP)/Contents/PkgInfo |
180 |
mkdir -p $(APP_APP)/Contents/MacOS |
181 |
cp -f $(APP) $(APP_APP)/Contents/MacOS/ |
182 |
strip -x $(APP_APP)/Contents/MacOS/$(APP) |
183 |
mkdir -p $(APP_APP)/Contents/Resources |
184 |
cp -Rp English.lproj $(APP_APP)/Contents/Resources/ |
185 |
cp -f $(APP).icns $(APP_APP)/Contents/Resources/ |
186 |
cp -f $(DOCS) $(APP_APP)/Contents/Resources/ |
187 |
find $(APP_APP) -type d -name CVS | xargs rm -rf |
188 |
|
189 |
mostlyclean: |
190 |
rm -f $(PROGS) $(OBJ_DIR)/* core* *.core *~ *.bak |
191 |
rm -f $(foreach arch, $(TARGET_ARCHES), $(GEN_DIR).$(arch)/*) |
192 |
rm -f $(foreach arch, $(TARGET_ARCHES), $(OBJ_DIR).$(arch)/*) |
193 |
|
194 |
clean: mostlyclean |
195 |
rm -f $(UNIXSRCS) |
196 |
rm -f README.txt |
197 |
|
198 |
distclean: clean |
199 |
rm -rf $(foreach arch, $(TARGET_ARCHES), $(GEN_DIR).$(arch)) |
200 |
rm -rf $(foreach arch, $(TARGET_ARCHES), $(OBJ_DIR).$(arch)) |
201 |
rm -rf autom4te.cache |
202 |
rm -f Makefile |
203 |
rm -f config.cache config.log config.status config.h configure |
204 |
|
205 |
depend dep: |
206 |
makedepend $(CPPFLAGS) -Y. $(SRCS) 2>/dev/null |
207 |
|
208 |
$(OBJ_DIR)/%.o : ../slirp/%.c |
209 |
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(SLIRP_CFLAGS) -c $< -o $@ |
210 |
$(OBJ_DIR)/%.o : %.c |
211 |
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ |
212 |
$(OBJ_DIR)/%.o : %.cpp |
213 |
$(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ |
214 |
$(OBJ_DIR)/%.o : %.m |
215 |
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ |
216 |
$(OBJ_DIR)/%.o : %.mm |
217 |
$(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ |
218 |
$(OBJ_DIR)/%.o : %.s |
219 |
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ |
220 |
$(OBJ_DIR)/%.ho : %.c |
221 |
$(HOST_CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ |
222 |
$(OBJ_DIR)/%.ho : %.cpp |
223 |
$(HOST_CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ |
224 |
|
225 |
$(OBJ_DIR)/build68k: $(OBJ_DIR)/build68k.ho |
226 |
$(HOST_CC) -o $@ $(OBJ_DIR)/build68k.ho |
227 |
$(OBJ_DIR)/gencpu: $(OBJ_DIR)/gencpu.ho $(OBJ_DIR)/readcpu.ho $(OBJ_DIR)/cpudefs.ho |
228 |
$(HOST_CXX) -o $@ $(OBJ_DIR)/gencpu.ho $(OBJ_DIR)/readcpu.ho $(OBJ_DIR)/cpudefs.ho |
229 |
$(OBJ_DIR)/gencomp: $(OBJ_DIR)/gencomp.ho $(OBJ_DIR)/readcpu.ho $(OBJ_DIR)/cpudefs.ho |
230 |
$(HOST_CXX) -o $@ $(OBJ_DIR)/gencomp.ho $(OBJ_DIR)/readcpu.ho $(OBJ_DIR)/cpudefs.ho |
231 |
|
232 |
$(GEN_DIR):: |
233 |
@[ -d $(GEN_DIR) ] || mkdir $(GEN_DIR) > /dev/null 2>&1 |
234 |
|
235 |
$(GEN_DIR)/cpudefs.cpp: $(OBJ_DIR)/build68k ../uae_cpu/table68k |
236 |
$(OBJ_DIR)/build68k <../uae_cpu/table68k > $@ |
237 |
$(GEN_DIR)/cpustbl.cpp: $(GEN_DIR)/cpuemu.cpp |
238 |
$(GEN_DIR)/cpustbl_nf.cpp: $(GEN_DIR)/cpustbl.cpp |
239 |
$(GEN_DIR)/compstbl.cpp: $(GEN_DIR)/compemu.cpp |
240 |
$(GEN_DIR)/cputbl.h: $(GEN_DIR)/cpuemu.cpp |
241 |
$(GEN_DIR)/comptbl.h: $(GEN_DIR)/compemu.cpp |
242 |
|
243 |
$(GEN_DIR)/cpuemu.cpp: $(OBJ_DIR)/gencpu |
244 |
cd $(GEN_DIR) && ../$(OBJ_DIR)/gencpu |
245 |
|
246 |
$(GEN_DIR)/compemu.cpp: $(OBJ_DIR)/gencomp |
247 |
cd $(GEN_DIR) && ../$(OBJ_DIR)/gencomp |
248 |
|
249 |
$(OBJ_DIR)/cpustbl_nf.o: $(GEN_DIR)/cpustbl.cpp |
250 |
$(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -DNOFLAGS -c $< -o $@ |
251 |
|
252 |
$(OBJ_DIR)/compemu_support.o: compemu_support.cpp $(GEN_DIR)/comptbl.h |
253 |
$(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ |
254 |
|
255 |
$(OBJ_DIR)/cpuemu1.o: $(GEN_DIR)/cpuemu.cpp |
256 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_1 $(CXXFLAGS) -c $< -o $@ |
257 |
$(OBJ_DIR)/cpuemu2.o: $(GEN_DIR)/cpuemu.cpp |
258 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_2 $(CXXFLAGS) -c $< -o $@ |
259 |
$(OBJ_DIR)/cpuemu3.o: $(GEN_DIR)/cpuemu.cpp |
260 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_3 $(CXXFLAGS) -c $< -o $@ |
261 |
$(OBJ_DIR)/cpuemu4.o: $(GEN_DIR)/cpuemu.cpp |
262 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_4 $(CXXFLAGS) -c $< -o $@ |
263 |
$(OBJ_DIR)/cpuemu5.o: $(GEN_DIR)/cpuemu.cpp |
264 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_5 $(CXXFLAGS) -c $< -o $@ |
265 |
$(OBJ_DIR)/cpuemu6.o: $(GEN_DIR)/cpuemu.cpp |
266 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_6 $(CXXFLAGS) -c $< -o $@ |
267 |
$(OBJ_DIR)/cpuemu7.o: $(GEN_DIR)/cpuemu.cpp |
268 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_7 $(CXXFLAGS) -c $< -o $@ |
269 |
$(OBJ_DIR)/cpuemu8.o: $(GEN_DIR)/cpuemu.cpp |
270 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_8 $(CXXFLAGS) -c $< -o $@ |
271 |
|
272 |
$(OBJ_DIR)/cpuemu1_nf.o: $(GEN_DIR)/cpuemu.cpp |
273 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_1 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ |
274 |
$(OBJ_DIR)/cpuemu2_nf.o: $(GEN_DIR)/cpuemu.cpp |
275 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_2 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ |
276 |
$(OBJ_DIR)/cpuemu3_nf.o: $(GEN_DIR)/cpuemu.cpp |
277 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_3 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ |
278 |
$(OBJ_DIR)/cpuemu4_nf.o: $(GEN_DIR)/cpuemu.cpp |
279 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_4 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ |
280 |
$(OBJ_DIR)/cpuemu5_nf.o: $(GEN_DIR)/cpuemu.cpp |
281 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_5 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ |
282 |
$(OBJ_DIR)/cpuemu6_nf.o: $(GEN_DIR)/cpuemu.cpp |
283 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_6 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ |
284 |
$(OBJ_DIR)/cpuemu7_nf.o: $(GEN_DIR)/cpuemu.cpp |
285 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_7 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ |
286 |
$(OBJ_DIR)/cpuemu8_nf.o: $(GEN_DIR)/cpuemu.cpp |
287 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_8 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ |
288 |
|
289 |
$(OBJ_DIR)/compemu1.o: $(GEN_DIR)/compemu.cpp |
290 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_1 $(CXXFLAGS) -c $< -o $@ |
291 |
$(OBJ_DIR)/compemu2.o: $(GEN_DIR)/compemu.cpp |
292 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_2 $(CXXFLAGS) -c $< -o $@ |
293 |
$(OBJ_DIR)/compemu3.o: $(GEN_DIR)/compemu.cpp |
294 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_3 $(CXXFLAGS) -c $< -o $@ |
295 |
$(OBJ_DIR)/compemu4.o: $(GEN_DIR)/compemu.cpp |
296 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_4 $(CXXFLAGS) -c $< -o $@ |
297 |
$(OBJ_DIR)/compemu5.o: $(GEN_DIR)/compemu.cpp |
298 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_5 $(CXXFLAGS) -c $< -o $@ |
299 |
$(OBJ_DIR)/compemu6.o: $(GEN_DIR)/compemu.cpp |
300 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_6 $(CXXFLAGS) -c $< -o $@ |
301 |
$(OBJ_DIR)/compemu7.o: $(GEN_DIR)/compemu.cpp |
302 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_7 $(CXXFLAGS) -c $< -o $@ |
303 |
$(OBJ_DIR)/compemu8.o: $(GEN_DIR)/compemu.cpp |
304 |
$(CXX) $(CPPFLAGS) $(DEFS) -DPART_8 $(CXXFLAGS) -c $< -o $@ |
305 |
|
306 |
#------------------------------------------------------------------------- |
307 |
# DO NOT DELETE THIS LINE -- make depend depends on it. |