1 |
# Linux makefile for SheepShaver |
2 |
|
3 |
## System specific configuration |
4 |
@SET_MAKE@ |
5 |
SHELL = /bin/sh |
6 |
|
7 |
prefix = @prefix@ |
8 |
exec_prefix = @exec_prefix@ |
9 |
bindir = @bindir@ |
10 |
datadir = @datadir@ |
11 |
mandir = @mandir@ |
12 |
man1dir = $(mandir)/man1 |
13 |
|
14 |
DESTDIR = |
15 |
|
16 |
CC = @CC@ |
17 |
CXX = @CXX@ |
18 |
CFLAGS = @CFLAGS@ |
19 |
CXXFLAGS = @CXXFLAGS@ |
20 |
CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../slirp |
21 |
DEFS = @DEFS@ -D_REENTRANT -DDATADIR=\"$(datadir)/$(APP)\" |
22 |
LDFLAGS = @LDFLAGS@ |
23 |
LIBS = @LIBS@ |
24 |
SYSSRCS = @SYSSRCS@ |
25 |
CPUSRCS = @CPUSRCS@ |
26 |
MONSRCS = @MONSRCS@ |
27 |
PERL = @PERL@ |
28 |
USE_DYNGEN = @USE_DYNGEN@ |
29 |
DYNGENSRCS = @DYNGENSRCS@ |
30 |
DYNGEN_CC = @DYNGEN_CC@ |
31 |
DYNGEN_CFLAGS = @DYNGEN_CFLAGS@ |
32 |
DYNGEN_CXXFLAGS = @DYNGEN_CXXFLAGS@ |
33 |
DYNGEN_OP_FLAGS = @DYNGEN_OP_FLAGS@ |
34 |
BLESS = @BLESS@ |
35 |
EXEEXT = @EXEEXT@ |
36 |
KEYCODES = @KEYCODES@ |
37 |
INSTALL = @INSTALL@ |
38 |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s |
39 |
INSTALL_DATA = @INSTALL_DATA@ |
40 |
|
41 |
SLIRP_CFLAGS = @SLIRP_CFLAGS@ |
42 |
SLIRP_SRCS = @SLIRP_SRCS@ |
43 |
SLIRP_OBJS = $(SLIRP_SRCS:../slirp/%.c=obj/%.o) |
44 |
|
45 |
STANDALONE_GUI = @STANDALONE_GUI@ |
46 |
GUI_CFLAGS = @GUI_CFLAGS@ |
47 |
GUI_LIBS = @GUI_LIBS@ |
48 |
GUI_SRCS = ../prefs.cpp prefs_unix.cpp prefs_editor_gtk.cpp ../prefs_items.cpp \ |
49 |
../user_strings.cpp user_strings_unix.cpp xpram_unix.cpp sys_unix.cpp rpc_unix.cpp |
50 |
|
51 |
# Append disassembler to dyngen, if available |
52 |
ifneq (:no,$(MONSRCS):$(USE_DYNGEN)) |
53 |
DYNGENSRCS += $(filter %i386-dis.c,$(MONSRCS)) |
54 |
endif |
55 |
|
56 |
## Files |
57 |
SRCS = ../main.cpp main_unix.cpp ../prefs.cpp ../prefs_items.cpp prefs_unix.cpp sys_unix.cpp \ |
58 |
../rom_patches.cpp ../rsrc_patches.cpp ../emul_op.cpp ../name_registry.cpp \ |
59 |
../macos_util.cpp ../timer.cpp timer_unix.cpp ../xpram.cpp xpram_unix.cpp \ |
60 |
../adb.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp \ |
61 |
../gfxaccel.cpp ../video.cpp video_blit.cpp ../audio.cpp ../ether.cpp ../thunks.cpp \ |
62 |
../serial.cpp ../extfs.cpp \ |
63 |
about_window_unix.cpp ../user_strings.cpp user_strings_unix.cpp \ |
64 |
vm_alloc.cpp sigsegv.cpp rpc_unix.cpp \ |
65 |
sshpty.c strlcpy.c $(SYSSRCS) $(CPUSRCS) $(MONSRCS) $(SLIRP_SRCS) |
66 |
APP = SheepShaver |
67 |
APP_EXE = $(APP)$(EXEEXT) |
68 |
APP_APP = $(APP).app |
69 |
|
70 |
PROGS = $(APP_EXE) |
71 |
ifeq ($(STANDALONE_GUI),yes) |
72 |
GUI_APP = SheepShaverGUI |
73 |
GUI_APP_EXE = $(GUI_APP)$(EXEEXT) |
74 |
GUI_APP_APP = $(GUI_APP).app |
75 |
PROGS += $(GUI_APP_EXE) |
76 |
else |
77 |
CXXFLAGS += $(GUI_CFLAGS) |
78 |
LIBS += $(GUI_LIBS) |
79 |
endif |
80 |
|
81 |
## Rules |
82 |
.PHONY: modules install uninstall clean distclean depend dep |
83 |
.SUFFIXES: |
84 |
.SUFFIXES: .c .cpp .S .o .h |
85 |
|
86 |
all: $(PROGS) |
87 |
|
88 |
OBJ_DIR = obj |
89 |
$(OBJ_DIR):: |
90 |
@[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 |
91 |
|
92 |
define SRCS_LIST_TO_OBJS |
93 |
$(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SRCS), \ |
94 |
$(basename $(notdir $(file)))))) |
95 |
endef |
96 |
OBJS = $(SRCS_LIST_TO_OBJS) |
97 |
|
98 |
define GUI_SRCS_LIST_TO_OBJS |
99 |
$(addprefix $(OBJ_DIR)/, $(addsuffix .go, $(foreach file, $(GUI_SRCS), \ |
100 |
$(basename $(notdir $(file)))))) |
101 |
endef |
102 |
GUI_OBJS = $(GUI_SRCS_LIST_TO_OBJS) |
103 |
|
104 |
define DYNGENSRCS_LIST_TO_OBJS |
105 |
$(addprefix $(OBJ_DIR)/, $(addsuffix .dgo, $(foreach file, $(DYNGENSRCS), \ |
106 |
$(basename $(notdir $(file)))))) |
107 |
endef |
108 |
DYNGENOBJS = $(DYNGENSRCS_LIST_TO_OBJS) |
109 |
|
110 |
SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) |
111 |
VPATH := |
112 |
VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) |
113 |
|
114 |
$(APP_EXE): $(OBJ_DIR) $(OBJS) |
115 |
$(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) |
116 |
$(BLESS) $(APP_EXE) |
117 |
|
118 |
$(GUI_APP_EXE): $(OBJ_DIR) $(GUI_OBJS) |
119 |
$(CXX) -o $@ $(LDFLAGS) $(GUI_OBJS) $(GUI_LIBS) |
120 |
|
121 |
$(APP)_app: $(APP) ../MacOSX/Info.plist ../MacOSX/$(APP).icns |
122 |
mkdir -p $(APP_APP)/Contents |
123 |
cp -f ../MacOSX/Info.plist $(APP_APP)/Contents/ |
124 |
echo -n 'APPL????' > $(APP_APP)/Contents/PkgInfo |
125 |
mkdir -p $(APP_APP)/Contents/MacOS |
126 |
cp -f $(APP) $(APP_APP)/Contents/MacOS/ |
127 |
strip $(APP_APP)/Contents/MacOS/$(APP) |
128 |
mkdir -p $(APP_APP)/Contents/Resources |
129 |
cp -f ../MacOSX/SheepShaver.icns $(APP_APP)/Contents/Resources/ |
130 |
|
131 |
$(GUI_APP)_app: $(GUI_APP) ../MacOSX/Info.plist ../MacOSX/$(APP).icns |
132 |
mkdir -p $(GUI_APP_APP)/Contents |
133 |
sed -e "s/$(APP)/$(GUI_APP)/" < ../MacOSX/Info.plist > $(GUI_APP_APP)/Contents/Info.plist |
134 |
echo -n 'APPL????' > $(GUI_APP_APP)/Contents/PkgInfo |
135 |
mkdir -p $(GUI_APP_APP)/Contents/MacOS |
136 |
cp -f $(GUI_APP) $(GUI_APP_APP)/Contents/MacOS/ |
137 |
strip $(GUI_APP_APP)/Contents/MacOS/$(GUI_APP) |
138 |
mkdir -p $(GUI_APP_APP)/Contents/Resources |
139 |
cp -f ../MacOSX/$(APP).icns $(GUI_APP_APP)/Contents/Resources/$(GUI_APP).icns |
140 |
|
141 |
modules: |
142 |
cd Linux/NetDriver; make |
143 |
|
144 |
install: $(PROGS) installdirs |
145 |
$(INSTALL_PROGRAM) $(APP_EXE) $(DESTDIR)$(bindir)/$(APP_EXE) |
146 |
if test -f "$(GUI_APP_EXE)"; then \ |
147 |
$(INSTALL_PROGRAM) $(GUI_APP_EXE) $(DESTDIR)$(bindir)/$(GUI_APP_EXE); \ |
148 |
fi |
149 |
-$(INSTALL_DATA) $(APP).1 $(DESTDIR)$(man1dir)/$(APP).1 |
150 |
$(INSTALL_DATA) $(KEYCODES) $(DESTDIR)$(datadir)/$(APP)/keycodes |
151 |
$(INSTALL_DATA) tunconfig $(DESTDIR)$(datadir)/$(APP)/tunconfig |
152 |
chmod 755 $(DESTDIR)$(datadir)/$(APP)/tunconfig |
153 |
|
154 |
installdirs: |
155 |
$(SHELL) mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) $(DESTDIR)$(datadir)/$(APP) |
156 |
|
157 |
uninstall: |
158 |
rm -f $(DESTDIR)$(bindir)/$(APP_EXE) |
159 |
rm -f $(DESTDIR)$(bindir)/$(GUI_APP_EXE) |
160 |
rm -f $(DESTDIR)$(man1dir)/$(APP).1 |
161 |
rm -f $(DESTDIR)$(datadir)/$(APP)/keycodes |
162 |
rm -f $(DESTDIR)$(datadir)/$(APP)/tunconfig |
163 |
rmdir $(DESTDIR)$(datadir)/$(APP) |
164 |
|
165 |
clean: |
166 |
rm -f $(PROGS) $(OBJ_DIR)/* core* *.core *~ *.bak ppc-execute-impl.cpp |
167 |
rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc_asm.out.s |
168 |
rm -rf $(APP_APP) $(GUI_APP_APP) |
169 |
|
170 |
distclean: clean |
171 |
rm -rf $(OBJ_DIR) |
172 |
rm -f Makefile |
173 |
rm -f config.cache config.log config.status config.h |
174 |
rm -f ../MacOSX/Info.plist |
175 |
|
176 |
depend dep: |
177 |
makedepend $(CPPFLAGS) -Y. $(SRCS) 2>/dev/null |
178 |
|
179 |
$(OBJ_DIR)/%.o : ../slirp/%.c |
180 |
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(SLIRP_CFLAGS) -c $< -o $@ |
181 |
$(OBJ_DIR)/%.o : %.c |
182 |
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ |
183 |
$(OBJ_DIR)/%.o : %.cpp |
184 |
$(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ |
185 |
$(OBJ_DIR)/%.o : %.mm |
186 |
$(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ |
187 |
$(OBJ_DIR)/%.o : %.S |
188 |
$(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $*.out.s |
189 |
$(AS) $(ASFLAGS) -o $@ $*.out.s |
190 |
rm $*.out.s |
191 |
$(OBJ_DIR)/%.go : %.cpp |
192 |
$(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(GUI_CFLAGS) -DSTANDALONE_GUI -c $< -o $@ |
193 |
|
194 |
# Kheperix CPU emulator |
195 |
kpxsrcdir = ../kpx_cpu/src |
196 |
GENEXECPL = $(kpxsrcdir)/cpu/ppc/genexec.pl |
197 |
DYNGEN = dyngen$(EXEEXT) |
198 |
|
199 |
ifeq ($(USE_DYNGEN),yes) |
200 |
DYNGENDEPS = basic-dyngen-ops.hpp ppc-dyngen-ops.hpp |
201 |
|
202 |
# Only GCC is supported for generating synthetic opcodes |
203 |
$(DYNGEN): $(DYNGENOBJS) |
204 |
$(DYNGEN_CC) -o $@ $(LDFLAGS) $(DYNGENOBJS) |
205 |
|
206 |
$(OBJ_DIR)/%.dgo : %.c |
207 |
$(DYNGEN_CC) -xc $(CPPFLAGS) $(DEFS) $(DYNGEN_CFLAGS) -c $< -o $@ |
208 |
$(OBJ_DIR)/%.dgo : %.cpp |
209 |
$(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) -c $< -o $@ |
210 |
|
211 |
$(OBJ_DIR)/basic-dyngen.o: basic-dyngen-ops.hpp |
212 |
$(OBJ_DIR)/basic-dyngen-ops.o: $(kpxsrcdir)/cpu/jit/basic-dyngen-ops.cpp |
213 |
$(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@ |
214 |
basic-dyngen-ops.hpp: $(OBJ_DIR)/basic-dyngen-ops.o $(DYNGEN) |
215 |
./$(DYNGEN) -o $@ $< |
216 |
|
217 |
$(OBJ_DIR)/ppc-dyngen.o: ppc-dyngen-ops.hpp |
218 |
$(OBJ_DIR)/ppc-dyngen-ops.o: $(kpxsrcdir)/cpu/ppc/ppc-dyngen-ops.cpp basic-dyngen-ops.hpp |
219 |
$(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@ |
220 |
ppc-dyngen-ops.hpp: $(OBJ_DIR)/ppc-dyngen-ops.o $(DYNGEN) |
221 |
./$(DYNGEN) -o $@ $< |
222 |
|
223 |
$(OBJ_DIR)/sheepshaver_glue.o $(OBJ_DIR)/ppc-cpu.o $(OBJ_DIR)/ppc-decode.o $(OBJ_DIR)/ppc-translate.o: basic-dyngen-ops.hpp ppc-dyngen-ops.hpp |
224 |
endif |
225 |
|
226 |
$(OBJ_DIR)/ppc-execute.o: ppc-execute-impl.cpp |
227 |
ppc-execute-impl.cpp: $(kpxsrcdir)/cpu/ppc/ppc-decode.cpp $(GENEXECPL) $(DYNGENDEPS) |
228 |
$(CPP) $(CPPFLAGS) -DGENEXEC $< | $(PERL) $(GENEXECPL) > $@ |
229 |
|
230 |
# PowerPC CPU tester |
231 |
TESTSRCS_ = mathlib/ieeefp.cpp mathlib/mathlib.cpp cpu/ppc/ppc-cpu.cpp cpu/ppc/ppc-decode.cpp cpu/ppc/ppc-execute.cpp cpu/ppc/ppc-translate.cpp test/test-powerpc.cpp $(MONSRCS) vm_alloc.cpp utils/utils-cpuinfo.cpp |
232 |
ifeq ($(USE_DYNGEN),yes) |
233 |
TESTSRCS_ += cpu/jit/jit-cache.cpp cpu/jit/basic-dyngen.cpp cpu/ppc/ppc-dyngen.cpp cpu/ppc/ppc-jit.cpp |
234 |
endif |
235 |
TESTSRCS = $(TESTSRCS_:%.cpp=$(kpxsrcdir)/%.cpp) |
236 |
|
237 |
define TESTSRCS_LIST_TO_OBJS |
238 |
$(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(TESTSRCS), \ |
239 |
$(basename $(notdir $(file)))))) |
240 |
endef |
241 |
TESTOBJS = $(TESTSRCS_LIST_TO_OBJS) |
242 |
|
243 |
$(OBJ_DIR)/test-powerpc.o: $(kpxsrcdir)/test/test-powerpc.cpp |
244 |
$(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -DEMU_KHEPERIX -c $< -o $@ |
245 |
|
246 |
test-powerpc$(EXEEXT): $(TESTOBJS) |
247 |
$(CXX) -o $@ $(LDFLAGS) $(TESTOBJS) $(LIBS) |
248 |
|
249 |
#------------------------------------------------------------------------- |
250 |
# DO NOT DELETE THIS LINE -- make depend depends on it. |