diff --git a/make/launchEmulator b/make/launchEmulator
index 99b07da..49f7ff5 100755
--- a/make/launchEmulator
+++ b/make/launchEmulator
@@ -18,6 +18,12 @@ fi
cd make
-$EMULATORPATH
+# This magic ensure that clicking stop in Xcode results in the emulator terminating.
+
+$EMULATORPATH &
+PID=$!
+
+trap 'kill $PID' SIGTERM SIGINT SIGHUP EXIT
+wait
exit 0
diff --git a/make/tail.mk b/make/tail.mk
index 08a453a..bdd7395 100644
--- a/make/tail.mk
+++ b/make/tail.mk
@@ -7,11 +7,13 @@ export PATH := $(PATH):$(ORCA_BIN)
CWD=$(shell pwd)
DISKIMAGE=$(PGM).2mg
-ALLTARGET=execute
+ALLTARGET=$(DISKIMAGE)
+EXECTARGET=executeGUI
DISKIMAGEDEST=.
ifeq ($(TARGETTYPE),shell)
FILETYPE=exe
+ EXECTARGET=executeShell
ALLTARGET=$(PGM)
else ifeq ($(TARGETTYPE),desktop)
FILETYPE=s16
@@ -68,7 +70,7 @@ ALL_DEPS=$(C_DEPS) $(ASM_DEPS) $(REZ_DEPS)
EXECCMD=
-.PHONY: all execute clean
+.PHONY: all execute executeShell executeGUI clean
.PRECIOUS: $(ASM_MACROS)
@@ -123,11 +125,13 @@ endif
$(DISKIMAGE): $(PGM)
make/createDiskImage "$(DISKIMAGE)" "$(PGM)" "$(DISKIMAGEDEST)"
-execute: $(DISKIMAGE)
- make/launchEmulator
+execute: $(EXECTARGET)
+
+executeGUI: $(DISKIMAGE)
+ make/launchEmulator -doit
executeShell: $(PGM)
- $(ORCA) $(PGM)
+ $(ORCA) ./$(PGM)
%.a: %.c
$(COMPILE) $< $(CFLAGS) --noroot
diff --git a/pkg/Templates/Apple IIgs/Classic Desk Accessory in C.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Classic Desk Accessory in C.xctemplate/TemplateInfo.plist
index d003469..e47722c 100644
--- a/pkg/Templates/Apple IIgs/Classic Desk Accessory in C.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Classic Desk Accessory in C.xctemplate/TemplateInfo.plist
@@ -16,6 +16,7 @@
make/orca-rez
make/system601.2mg
make/tail.mk
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
Definitions
@@ -99,6 +100,15 @@
Path
Makefile
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Group
+
+ Supporting Files
+
+ Path
+ ___PACKAGENAME___.xcscheme
+
Kind
Xcode.Xcode3.ProjectTemplateUnitKind
diff --git a/pkg/Templates/Apple IIgs/Control Panel in C.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Control Panel in C.xctemplate/TemplateInfo.plist
index 93ed5b2..4d1815e 100644
--- a/pkg/Templates/Apple IIgs/Control Panel in C.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Control Panel in C.xctemplate/TemplateInfo.plist
@@ -18,6 +18,7 @@
make/orca-rez
make/system601.2mg
make/tail.mk
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
Definitions
@@ -111,6 +112,15 @@
Path
Makefile
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Group
+
+ Supporting Files
+
+ Path
+ ___PACKAGENAME___.xcscheme
+
Kind
Xcode.Xcode3.ProjectTemplateUnitKind
diff --git a/pkg/Templates/Apple IIgs/Desktop Application in C.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Desktop Application in C.xctemplate/TemplateInfo.plist
index ec05d42..bc5009c 100644
--- a/pkg/Templates/Apple IIgs/Desktop Application in C.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Desktop Application in C.xctemplate/TemplateInfo.plist
@@ -18,6 +18,7 @@
make/orca-rez
make/system601.2mg
make/tail.mk
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
Definitions
@@ -110,6 +111,15 @@
Path
Makefile
+
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Group
+
+ Supporting Files
+
+ Path
+ ___PACKAGENAME___.xcscheme
Kind
diff --git a/pkg/Templates/Apple IIgs/New Desk Accessory in C.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/New Desk Accessory in C.xctemplate/TemplateInfo.plist
index 2ad6869..54f3b18 100644
--- a/pkg/Templates/Apple IIgs/New Desk Accessory in C.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/New Desk Accessory in C.xctemplate/TemplateInfo.plist
@@ -18,6 +18,7 @@
make/orca-rez
make/system601.2mg
make/tail.mk
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
Definitions
@@ -111,6 +112,15 @@
Path
Makefile
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Group
+
+ Supporting Files
+
+ Path
+ ___PACKAGENAME___.xcscheme
+
Kind
Xcode.Xcode3.ProjectTemplateUnitKind
diff --git a/pkg/Templates/Apple IIgs/Shell Command in Assembly.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Shell Command in Assembly.xctemplate/TemplateInfo.plist
index 96cb810..cceadcc 100644
--- a/pkg/Templates/Apple IIgs/Shell Command in Assembly.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Shell Command in Assembly.xctemplate/TemplateInfo.plist
@@ -12,6 +12,7 @@
make/orca-macgen
make/orca-rez
make/tail.mk
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
Definitions
@@ -67,6 +68,15 @@
Path
Makefile
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Group
+
+ Supporting Files
+
+ Path
+ ___PACKAGENAME___.xcscheme
+
Kind
Xcode.Xcode3.ProjectTemplateUnitKind
diff --git a/pkg/Templates/Apple IIgs/Shell Command in C.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Shell Command in C.xctemplate/TemplateInfo.plist
index 4ef589b..90eeccc 100644
--- a/pkg/Templates/Apple IIgs/Shell Command in C.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Shell Command in C.xctemplate/TemplateInfo.plist
@@ -12,6 +12,7 @@
make/orca-macgen
make/orca-rez
make/tail.mk
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
Definitions
@@ -67,6 +68,15 @@
Path
Makefile
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Group
+
+ Supporting Files
+
+ Path
+ ___PACKAGENAME___.xcscheme
+
Kind
Xcode.Xcode3.ProjectTemplateUnitKind