--- SheepShaver/src/Unix/Makefile.in 2003/05/22 22:12:04 1.4 +++ SheepShaver/src/Unix/Makefile.in 2006/07/16 12:47:38 1.41 @@ -11,38 +11,79 @@ datadir = @datadir@ mandir = @mandir@ man1dir = $(mandir)/man1 +DESTDIR = + CC = @CC@ CXX = @CXX@ CFLAGS = @CFLAGS@ CXXFLAGS = @CXXFLAGS@ -CPPFLAGS = @CPPFLAGS@ -I../include -I. +CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../slirp DEFS = @DEFS@ -D_REENTRANT -DDATADIR=\"$(datadir)/$(APP)\" LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ SYSSRCS = @SYSSRCS@ +CPUSRCS = @CPUSRCS@ +MONSRCS = @MONSRCS@ +PERL = @PERL@ +USE_DYNGEN = @USE_DYNGEN@ +DYNGENSRCS = @DYNGENSRCS@ +DYNGEN_CC = @DYNGEN_CC@ +DYNGEN_CFLAGS = @DYNGEN_CFLAGS@ +DYNGEN_CXXFLAGS = @DYNGEN_CXXFLAGS@ +DYNGEN_OP_FLAGS = @DYNGEN_OP_FLAGS@ +BLESS = @BLESS@ +EXEEXT = @EXEEXT@ +KEYCODES = @KEYCODES@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s INSTALL_DATA = @INSTALL_DATA@ +SLIRP_CFLAGS = @SLIRP_CFLAGS@ +SLIRP_SRCS = @SLIRP_SRCS@ +SLIRP_OBJS = $(SLIRP_SRCS:../slirp/%.c=obj/%.o) + +STANDALONE_GUI = @STANDALONE_GUI@ +GUI_CFLAGS = @GUI_CFLAGS@ +GUI_LIBS = @GUI_LIBS@ +GUI_SRCS = ../prefs.cpp prefs_unix.cpp prefs_editor_gtk.cpp ../prefs_items.cpp \ + ../user_strings.cpp user_strings_unix.cpp xpram_unix.cpp sys_unix.cpp rpc_unix.cpp + +# Append disassembler to dyngen, if available +ifneq (:no,$(MONSRCS):$(USE_DYNGEN)) +DYNGENSRCS += $(filter %i386-dis.c,$(MONSRCS)) +endif + ## Files -SRCS = main_unix.cpp ../prefs.cpp ../prefs_items.cpp prefs_unix.cpp sys_unix.cpp \ +SRCS = ../main.cpp main_unix.cpp ../prefs.cpp ../prefs_items.cpp prefs_unix.cpp sys_unix.cpp \ ../rom_patches.cpp ../rsrc_patches.cpp ../emul_op.cpp ../name_registry.cpp \ ../macos_util.cpp ../timer.cpp timer_unix.cpp ../xpram.cpp xpram_unix.cpp \ - ../adb.cpp clip_unix.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp \ - Linux/scsi_linux.cpp ../video.cpp video_blit.cpp video_x.cpp \ - ../audio.cpp audio_oss_esd.cpp ../ether.cpp \ - Linux/ether_linux.cpp ../serial.cpp serial_unix.cpp ../extfs.cpp extfs_unix.cpp \ + ../adb.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp \ + ../gfxaccel.cpp ../video.cpp video_blit.cpp ../audio.cpp ../ether.cpp ../thunks.cpp \ + ../serial.cpp ../extfs.cpp \ about_window_unix.cpp ../user_strings.cpp user_strings_unix.cpp \ - vm_alloc.cpp sigsegv.cpp \ - sshpty.c strlcpy.c $(SYSSRCS) + vm_alloc.cpp sigsegv.cpp rpc_unix.cpp \ + sshpty.c strlcpy.c $(SYSSRCS) $(CPUSRCS) $(MONSRCS) $(SLIRP_SRCS) APP = SheepShaver +APP_EXE = $(APP)$(EXEEXT) +APP_APP = $(APP).app + +PROGS = $(APP_EXE) +ifeq ($(STANDALONE_GUI),yes) +GUI_APP = SheepShaverGUI +GUI_APP_EXE = $(GUI_APP)$(EXEEXT) +GUI_APP_APP = $(GUI_APP).app +PROGS += $(GUI_APP_EXE) +else +CXXFLAGS += $(GUI_CFLAGS) +LIBS += $(GUI_LIBS) +endif ## Rules .PHONY: modules install uninstall clean distclean depend dep .SUFFIXES: .SUFFIXES: .c .cpp .S .o .h -all: $(APP) +all: $(PROGS) OBJ_DIR = obj $(OBJ_DIR):: @@ -54,46 +95,156 @@ define SRCS_LIST_TO_OBJS endef OBJS = $(SRCS_LIST_TO_OBJS) +define GUI_SRCS_LIST_TO_OBJS + $(addprefix $(OBJ_DIR)/, $(addsuffix .go, $(foreach file, $(GUI_SRCS), \ + $(basename $(notdir $(file)))))) +endef +GUI_OBJS = $(GUI_SRCS_LIST_TO_OBJS) + +define DYNGENSRCS_LIST_TO_OBJS + $(addprefix $(OBJ_DIR)/, $(addsuffix .dgo, $(foreach file, $(DYNGENSRCS), \ + $(basename $(notdir $(file)))))) +endef +DYNGENOBJS = $(DYNGENSRCS_LIST_TO_OBJS) + SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) VPATH := VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) -$(APP): $(OBJ_DIR) $(OBJS) - $(CXX) -o $(APP) $(LDFLAGS) $(OBJS) $(LIBS) +$(APP_EXE): $(OBJ_DIR) $(OBJS) + $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) + $(BLESS) $(APP_EXE) + +$(GUI_APP_EXE): $(OBJ_DIR) $(GUI_OBJS) + $(CXX) -o $@ $(LDFLAGS) $(GUI_OBJS) $(GUI_LIBS) + +$(APP)_app: $(APP) ../MacOSX/Info.plist ../MacOSX/$(APP).icns + mkdir -p $(APP_APP)/Contents + cp -f ../MacOSX/Info.plist $(APP_APP)/Contents/ + echo -n 'APPL????' > $(APP_APP)/Contents/PkgInfo + mkdir -p $(APP_APP)/Contents/MacOS + cp -f $(APP) $(APP_APP)/Contents/MacOS/ + strip $(APP_APP)/Contents/MacOS/$(APP) + mkdir -p $(APP_APP)/Contents/Resources + cp -f ../MacOSX/SheepShaver.icns $(APP_APP)/Contents/Resources/ + +$(GUI_APP)_app: $(GUI_APP) ../MacOSX/Info.plist ../MacOSX/$(APP).icns + mkdir -p $(GUI_APP_APP)/Contents + sed -e "s/$(APP)/$(GUI_APP)/" < ../MacOSX/Info.plist > $(GUI_APP_APP)/Contents/Info.plist + echo -n 'APPL????' > $(GUI_APP_APP)/Contents/PkgInfo + mkdir -p $(GUI_APP_APP)/Contents/MacOS + cp -f $(GUI_APP) $(GUI_APP_APP)/Contents/MacOS/ + strip $(GUI_APP_APP)/Contents/MacOS/$(GUI_APP) + mkdir -p $(GUI_APP_APP)/Contents/Resources + cp -f ../MacOSX/$(APP).icns $(GUI_APP_APP)/Contents/Resources/$(GUI_APP).icns modules: - cd NetDriver; make + cd Linux/NetDriver; make -install: $(APP) installdirs - $(INSTALL_PROGRAM) $(APP) $(bindir)/$(APP) - -$(INSTALL_DATA) $(APP).1 $(man1dir)/$(APP).1 +install: $(PROGS) installdirs + $(INSTALL_PROGRAM) $(APP_EXE) $(DESTDIR)$(bindir)/$(APP_EXE) + if test -f "$(GUI_APP_EXE)"; then \ + $(INSTALL_PROGRAM) $(GUI_APP_EXE) $(DESTDIR)$(bindir)/$(GUI_APP_EXE); \ + fi + -$(INSTALL_DATA) $(APP).1 $(DESTDIR)$(man1dir)/$(APP).1 + $(INSTALL_DATA) $(KEYCODES) $(DESTDIR)$(datadir)/$(APP)/keycodes + $(INSTALL_DATA) tunconfig $(DESTDIR)$(datadir)/$(APP)/tunconfig + chmod 755 $(DESTDIR)$(datadir)/$(APP)/tunconfig installdirs: - $(SHELL) mkinstalldirs $(bindir) $(man1dir) + $(SHELL) mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) $(DESTDIR)$(datadir)/$(APP) uninstall: - rm -f $(bindir)/$(APP) - rm -f $(man1dir)/$(APP).1 + rm -f $(DESTDIR)$(bindir)/$(APP_EXE) + rm -f $(DESTDIR)$(bindir)/$(GUI_APP_EXE) + rm -f $(DESTDIR)$(man1dir)/$(APP).1 + rm -f $(DESTDIR)$(datadir)/$(APP)/keycodes + rm -f $(DESTDIR)$(datadir)/$(APP)/tunconfig + rmdir $(DESTDIR)$(datadir)/$(APP) clean: - rm -f $(APP) $(OBJ_DIR)/* core* *.core *~ *.bak + rm -f $(PROGS) $(OBJ_DIR)/* core* *.core *~ *.bak ppc-execute-impl.cpp + rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc_asm.out.s + rm -rf $(APP_APP) $(GUI_APP_APP) distclean: clean rm -rf $(OBJ_DIR) rm -f Makefile rm -f config.cache config.log config.status config.h + rm -f ../MacOSX/Info.plist depend dep: makedepend $(CPPFLAGS) -Y. $(SRCS) 2>/dev/null +$(OBJ_DIR)/%.o : ../slirp/%.c + $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(SLIRP_CFLAGS) -c $< -o $@ $(OBJ_DIR)/%.o : %.c $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ $(OBJ_DIR)/%.o : %.cpp $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ +$(OBJ_DIR)/%.o : %.mm + $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ $(OBJ_DIR)/%.o : %.S - $(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $*.s - $(AS) $(ASFLAGS) -o $@ $*.s - rm $*.s + $(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $*.out.s + $(AS) $(ASFLAGS) -o $@ $*.out.s + rm $*.out.s +$(OBJ_DIR)/%.go : %.cpp + $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(GUI_CFLAGS) -DSTANDALONE_GUI -c $< -o $@ + +# Kheperix CPU emulator +kpxsrcdir = ../kpx_cpu/src +GENEXECPL = $(kpxsrcdir)/cpu/ppc/genexec.pl +DYNGEN = dyngen$(EXEEXT) + +ifeq ($(USE_DYNGEN),yes) +DYNGENDEPS = basic-dyngen-ops.hpp ppc-dyngen-ops.hpp + +# Only GCC is supported for generating synthetic opcodes +$(DYNGEN): $(DYNGENOBJS) + $(DYNGEN_CC) -o $@ $(LDFLAGS) $(DYNGENOBJS) + +$(OBJ_DIR)/%.dgo : %.c + $(DYNGEN_CC) -xc $(CPPFLAGS) $(DEFS) $(DYNGEN_CFLAGS) -c $< -o $@ +$(OBJ_DIR)/%.dgo : %.cpp + $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) -c $< -o $@ + +$(OBJ_DIR)/basic-dyngen.o: basic-dyngen-ops.hpp +$(OBJ_DIR)/basic-dyngen-ops.o: $(kpxsrcdir)/cpu/jit/basic-dyngen-ops.cpp + $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@ +basic-dyngen-ops.hpp: $(OBJ_DIR)/basic-dyngen-ops.o $(DYNGEN) + ./$(DYNGEN) -o $@ $< + +$(OBJ_DIR)/ppc-dyngen.o: ppc-dyngen-ops.hpp +$(OBJ_DIR)/ppc-dyngen-ops.o: $(kpxsrcdir)/cpu/ppc/ppc-dyngen-ops.cpp basic-dyngen-ops.hpp + $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@ +ppc-dyngen-ops.hpp: $(OBJ_DIR)/ppc-dyngen-ops.o $(DYNGEN) + ./$(DYNGEN) -o $@ $< + +$(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 +endif + +$(OBJ_DIR)/ppc-execute.o: ppc-execute-impl.cpp +ppc-execute-impl.cpp: $(kpxsrcdir)/cpu/ppc/ppc-decode.cpp $(GENEXECPL) $(DYNGENDEPS) + $(CPP) $(CPPFLAGS) -DGENEXEC $< | $(PERL) $(GENEXECPL) > $@ + +# PowerPC CPU tester +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 +ifeq ($(USE_DYNGEN),yes) +TESTSRCS_ += cpu/jit/jit-cache.cpp cpu/jit/basic-dyngen.cpp cpu/ppc/ppc-dyngen.cpp cpu/ppc/ppc-jit.cpp +endif +TESTSRCS = $(TESTSRCS_:%.cpp=$(kpxsrcdir)/%.cpp) + +define TESTSRCS_LIST_TO_OBJS + $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(TESTSRCS), \ + $(basename $(notdir $(file)))))) +endef +TESTOBJS = $(TESTSRCS_LIST_TO_OBJS) + +$(OBJ_DIR)/test-powerpc.o: $(kpxsrcdir)/test/test-powerpc.cpp + $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -DEMU_KHEPERIX -c $< -o $@ + +test-powerpc$(EXEEXT): $(TESTOBJS) + $(CXX) -o $@ $(LDFLAGS) $(TESTOBJS) $(LIBS) #------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it.