diff --git a/Makefile b/Makefile
index 2ca5f3f..4656e07 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,9 @@ COPYDIRS=
# Add any rules you want to execute before any compiles or assembly
# commands are called here, if any. You can generate .c, .s or .h
# files for example. You can generate data files. Whatever you
-# might need.
+# might need. You should generate these files in the $(GENDIR)
+# directory or within a subdirectory under $(GENDIR) which you create
+# yourself.
#
# All of your commands associated with a rule _must_ start with a tab
# character. Xcode makes it a bit tough to type a tab character by
diff --git a/make/head.mk b/make/head.mk
index 628bb1a..20a1aca 100644
--- a/make/head.mk
+++ b/make/head.mk
@@ -13,8 +13,9 @@ TARGETTYPE=shell
ASSEMBLER=orcam
MERLIN_DIR=/usr/local
-MERLIN_BIN=$(MERLIN_DIR)/bin/Merlin32
-MERLIN_LIB=$(MERLIN_DIR)/lib/Merlin
+export MERLIN_BIN=$(MERLIN_DIR)/bin/Merlin32
+export MERLIN_LIB=$(MERLIN_DIR)/lib/Merlin
+MERLIN_ASM=make/merlin-asm
SRCDIRS=.
diff --git a/make/merlin-asm b/make/merlin-asm
new file mode 100755
index 0000000..9bed373
--- /dev/null
+++ b/make/merlin-asm
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+ERROUTPUT=/tmp/merlin-err.$$
+
+LINKSCRIPT="$1"
+shift
+
+OUTFILE="$1"
+shift
+
+TARGETOUTPUT="$1"
+shift
+
+cleanup()
+{
+ rm -r error_output.txt
+ rm -f _FileInformation.txt
+ rm -f _Output.txt
+ rm -f "$ERROUTPUT"
+}
+
+"$MERLIN_BIN" -V "$MERLIN_LIB" "$LINKSCRIPT" 2>&1 | tee "$ERROUTPUT"
+if [ ! -f "$OUTFILE" ]
+then
+ cat error_output.txt
+ tr "'" '"' < "$ERROUTPUT" |
+ grep '\[Error\]' |
+ sed 's!^.*\[Error\] \(.*file "\([^"]*\.s\)".*line \([1-9][0-9]*\).*\)$!'`pwd`'/\2:\3:0: error: \1!' |
+ sed 's!^.*\[Error\] \(.*line \([1-9][0-9]*\).*file "\([^"]*\.s\)".*\)$!'`pwd`'/\3:\2:0: error: \1!'
+ cleanup
+ exit 1
+fi
+
+mv "$OUTFILE" "$TARGETOUTPUT"
+
+cleanup
+
+exit 0
diff --git a/make/orca-cc b/make/orca-cc
index 8c1a549..0f6b429 100755
--- a/make/orca-cc
+++ b/make/orca-cc
@@ -49,7 +49,7 @@ awk '
/^ *\^/ {
sub(/^ *\^/, "", $0)
- printf("%s/%s:%d:0:%s\n", PWD, FILE, LINENO, $0)
+ printf("%s/%s:%d:0: error: %s\n", PWD, FILE, LINENO, $0)
}
' "PWD=`pwd`" "FILE=$FILENAME" $STDOUTPUT
diff --git a/make/orca-rez b/make/orca-rez
index 553d06f..d5204e4 100755
--- a/make/orca-rez
+++ b/make/orca-rez
@@ -36,7 +36,7 @@ awk '
sub(/;/,"",$4)
LINENO=$4
sub(/^File [^ ]*; Line [0-9][0-9]*/, "", $0)
- printf("%s/%s:%d:0:%s\n", PWD, FILE, LINENO, $0)
+ printf("%s/%s:%d:0: error: %s\n", PWD, FILE, LINENO, $0)
}
' "PWD=`pwd`" "FILE=$FILENAME" $ERROUTPUT >&2
diff --git a/make/tail.mk b/make/tail.mk
index 5f03635..565bacf 100644
--- a/make/tail.mk
+++ b/make/tail.mk
@@ -133,8 +133,7 @@ endif
$(TARGETDIR)/$(PGM): $(BUILD_OBJS) $(ASM_SRCS)
$(RM) $(TARGETDIR)/$(PGM)
- $(MERLIN_BIN) -V $(MERLIN_LIB) linkscript.s
- $(MV) $(PGM) $(TARGETDIR)/$(PGM)
+ $(MERLIN_ASM) linkscript.s $(PGM) $(TARGETDIR)/$(PGM)
ifneq ($(REZ_OBJS),)
$(CP) $(REZ_OBJS)/..namedfork/rsrc $(TARGETDIR)/$(PGM)/..namedfork/rsrc
endif
@@ -160,8 +159,7 @@ $(BINTARGET): $(BUILD_OBJS)
# resource compile will read the $(PGM).bin binary and load it into the
# resources # also.
$(BINTARGET): $(BUILD_OBJS) $(ASM_SRCS)
- $(MERLIN_BIN) -V $(MERLIN_LIB) linkscript.s
- $(MV) $(PGM) $(BINTARGET)
+ $(MERLIN_ASM) linkscript.s $(PGM) $(BINTARGET)
endif
diff --git a/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/TemplateInfo.plist
index f052a1f..5db2a67 100644
--- a/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/TemplateInfo.plist
@@ -11,8 +11,7 @@
make/createDiskImage
make/head.mk
make/launchEmulator
- make/orca-asm
- make/orca-cc
+ make/merlin-asm
make/orca-rez
make/system601.2mg
make/tail.mk
@@ -58,19 +57,12 @@
Path
make/launchEmulator
- make/orca-asm
+ make/merlin-asm
Group
make
Path
- make/orca-asm
-
- make/orca-cc
-
- Group
- make
- Path
- make/orca-cc
+ make/merlin-asm
make/orca-rez
diff --git a/pkg/Templates/Apple IIgs/Merlin Control Panel.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Merlin Control Panel.xctemplate/TemplateInfo.plist
index cb30819..b58c84d 100644
--- a/pkg/Templates/Apple IIgs/Merlin Control Panel.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Merlin Control Panel.xctemplate/TemplateInfo.plist
@@ -12,8 +12,7 @@
make/createDiskImage
make/head.mk
make/launchEmulator
- make/orca-asm
- make/orca-cc
+ make/merlin-asm
make/orca-rez
make/system601.2mg
make/tail.mk
@@ -64,19 +63,12 @@
Path
make/launchEmulator
- make/orca-asm
+ make/merlin-asm
Group
make
Path
- make/orca-asm
-
- make/orca-cc
-
- Group
- make
- Path
- make/orca-cc
+ make/merlin-asm
make/orca-rez
diff --git a/pkg/Templates/Apple IIgs/Merlin Control Panel.xctemplate/main.s b/pkg/Templates/Apple IIgs/Merlin Control Panel.xctemplate/main.s
index 34fded3..efd4963 100644
--- a/pkg/Templates/Apple IIgs/Merlin Control Panel.xctemplate/main.s
+++ b/pkg/Templates/Apple IIgs/Merlin Control Panel.xctemplate/main.s
@@ -6,7 +6,6 @@
* Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
*
-
]XCODESTART ; Keep this at the start and put your code after this
mx %00
@@ -245,3 +244,4 @@ notClear
doneEdit
rtl
+]XCODEEND ; Keep this at the end and put your code above this
diff --git a/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/TemplateInfo.plist
index f11fef3..5313c01 100644
--- a/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/TemplateInfo.plist
@@ -12,8 +12,7 @@
make/createDiskImage
make/head.mk
make/launchEmulator
- make/orca-asm
- make/orca-cc
+ make/merlin-asm
make/orca-rez
make/system601.2mg
make/tail.mk
@@ -64,19 +63,12 @@
Path
make/launchEmulator
- make/orca-asm
+ make/merlin-asm
Group
make
Path
- make/orca-asm
-
- make/orca-cc
-
- Group
- make
- Path
- make/orca-cc
+ make/merlin-asm
make/orca-rez
diff --git a/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.s b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.s
index f7f68f4..1284035 100644
--- a/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.s
+++ b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.s
@@ -278,3 +278,4 @@ wmLastClickPt_horiz dw 0
* Used by doQuit
quitDCB dw 0
+]XCODEEND ; Keep this at the end and put your code above this
diff --git a/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/TemplateInfo.plist
index 31d2b07..b5b1fe2 100644
--- a/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/TemplateInfo.plist
+++ b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/TemplateInfo.plist
@@ -12,8 +12,7 @@
make/createDiskImage
make/head.mk
make/launchEmulator
- make/orca-asm
- make/orca-cc
+ make/merlin-asm
make/orca-rez
make/system601.2mg
make/tail.mk
@@ -64,19 +63,12 @@
Path
make/launchEmulator
- make/orca-asm
+ make/merlin-asm
Group
make
Path
- make/orca-asm
-
- make/orca-cc
-
- Group
- make
- Path
- make/orca-cc
+ make/merlin-asm
make/orca-rez
diff --git a/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.s b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.s
index 5cafe67..baf5400 100644
--- a/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.s
+++ b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.s
@@ -342,3 +342,4 @@ wmTaskData4 adrl 0
wmLastClickPt_vert dw 0
wmLastClickPt_horiz dw 0
+]XCODEEND ; Keep this at the end and put your code above this
diff --git a/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateIcon.png b/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateIcon.png
new file mode 100644
index 0000000..4786b7e
Binary files /dev/null and b/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateIcon.png differ
diff --git a/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateIcon@2x.png b/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateIcon@2x.png
new file mode 100644
index 0000000..21d5bd1
Binary files /dev/null and b/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateIcon@2x.png differ
diff --git a/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateInfo.plist b/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateInfo.plist
new file mode 100644
index 0000000..590728d
--- /dev/null
+++ b/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/TemplateInfo.plist
@@ -0,0 +1,20 @@
+
+
+
+
+ AllowedTypes
+
+ com.rand-family.xcode.merlin
+
+ DefaultCompletionName
+ File
+ Description
+ A Merlin assembly source file.
+ Kind
+ Xcode.IDEKit.TextSubstitutionFileTemplateKind
+ MainTemplateFile
+ ___FILEBASENAME___.s
+ Summary
+ A Merlin assembly source file
+
+
diff --git a/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/___FILEBASENAME___.s b/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/___FILEBASENAME___.s
new file mode 100755
index 0000000..1253eab
--- /dev/null
+++ b/pkg/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate/___FILEBASENAME___.s
@@ -0,0 +1,16 @@
+*
+* ___FILENAME___
+* ___PROJECTNAME___
+*
+* Created by ___FULLUSERNAME___ on ___DATE___.
+* ___COPYRIGHT___
+*
+
+]XCODESTART ; Keep this at the start and put your code after this
+
+* Put your code here. We need these markers to convince Xcode to indent
+* properly. If you delete them or put your code outside the markers, your
+* build will work but the Xcode editor will be annoying.
+
+]XCODEEND ; Keep this at the end and put your code above this
+
diff --git a/pkg/createPackage b/pkg/createPackage
index 359bbc9..ae47b2b 100755
--- a/pkg/createPackage
+++ b/pkg/createPackage
@@ -34,14 +34,19 @@ do
SUPPORTS_RES_MODE=`echo $PROJECT | awk -F: '{print $4}'`
SUPPORTS_MESSAGE_CENTER=`echo $PROJECT | awk -F: '{print $5}'`
+ cp -R make "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/"
+
if [ $SHELL_TYPE = merlin ]
then
sed "
/^# TARGETTYPE=${PROJECT_TYPE}/s/^# //" Makefile.merlin > "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/Makefile"
+ rm -f "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/make/orca-asm"
+ rm -f "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/make/orca-cc"
else
sed "
/^# TARGETTYPE=${PROJECT_TYPE}/s/^# //
/^# export ORCA=.*\/${SHELL_TYPE}$/s/^# //" Makefile > "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/Makefile"
+ rm -f "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/make/merlin-asm"
fi
if [ "$SUPPORTS_RES_MODE" -eq 1 ]
@@ -54,7 +59,6 @@ do
sed -i "" 's/^# MESSAGE_CENTER=.*$/MESSAGE_CENTER=___VARIABLE_MESSAGECENTER___/' "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/Makefile"
fi
- cp -R make "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/"
done < $PROJECTS
rm -f $PROJECTS
diff --git a/pkg/scripts/preinstall b/pkg/scripts/preinstall
index e0f655a..0e40919 100755
--- a/pkg/scripts/preinstall
+++ b/pkg/scripts/preinstall
@@ -2,5 +2,6 @@
rm -rf "$2/Templates/Apple IIgs"
rm -rf "$2/Templates/File Templates/Apple IIgs"
+rm -rf "$2/Templates/File Templates/Apple II/Merlin Assembly File.xctemplate"
rm -rf "$2/Plug-ins/OrcaM.ideplugin"