Add merlin file templates. Handle errors in merlin source better.

This commit is contained in:
Jeremy Rand 2019-07-19 10:51:55 -05:00
parent 61d28aadac
commit 5af0aa7f5c
19 changed files with 105 additions and 55 deletions

View File

@ -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

View File

@ -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=.

38
make/merlin-asm Executable file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -11,8 +11,7 @@
<string>make/createDiskImage</string>
<string>make/head.mk</string>
<string>make/launchEmulator</string>
<string>make/orca-asm</string>
<string>make/orca-cc</string>
<string>make/merlin-asm</string>
<string>make/orca-rez</string>
<string>make/system601.2mg</string>
<string>make/tail.mk</string>
@ -58,19 +57,12 @@
<key>Path</key>
<string>make/launchEmulator</string>
</dict>
<key>make/orca-asm</key>
<key>make/merlin-asm</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-asm</string>
</dict>
<key>make/orca-cc</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-cc</string>
<string>make/merlin-asm</string>
</dict>
<key>make/orca-rez</key>
<dict>

View File

@ -12,8 +12,7 @@
<string>make/createDiskImage</string>
<string>make/head.mk</string>
<string>make/launchEmulator</string>
<string>make/orca-asm</string>
<string>make/orca-cc</string>
<string>make/merlin-asm</string>
<string>make/orca-rez</string>
<string>make/system601.2mg</string>
<string>make/tail.mk</string>
@ -64,19 +63,12 @@
<key>Path</key>
<string>make/launchEmulator</string>
</dict>
<key>make/orca-asm</key>
<key>make/merlin-asm</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-asm</string>
</dict>
<key>make/orca-cc</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-cc</string>
<string>make/merlin-asm</string>
</dict>
<key>make/orca-rez</key>
<dict>

View File

@ -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

View File

@ -12,8 +12,7 @@
<string>make/createDiskImage</string>
<string>make/head.mk</string>
<string>make/launchEmulator</string>
<string>make/orca-asm</string>
<string>make/orca-cc</string>
<string>make/merlin-asm</string>
<string>make/orca-rez</string>
<string>make/system601.2mg</string>
<string>make/tail.mk</string>
@ -64,19 +63,12 @@
<key>Path</key>
<string>make/launchEmulator</string>
</dict>
<key>make/orca-asm</key>
<key>make/merlin-asm</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-asm</string>
</dict>
<key>make/orca-cc</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-cc</string>
<string>make/merlin-asm</string>
</dict>
<key>make/orca-rez</key>
<dict>

View File

@ -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

View File

@ -12,8 +12,7 @@
<string>make/createDiskImage</string>
<string>make/head.mk</string>
<string>make/launchEmulator</string>
<string>make/orca-asm</string>
<string>make/orca-cc</string>
<string>make/merlin-asm</string>
<string>make/orca-rez</string>
<string>make/system601.2mg</string>
<string>make/tail.mk</string>
@ -64,19 +63,12 @@
<key>Path</key>
<string>make/launchEmulator</string>
</dict>
<key>make/orca-asm</key>
<key>make/merlin-asm</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-asm</string>
</dict>
<key>make/orca-cc</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-cc</string>
<string>make/merlin-asm</string>
</dict>
<key>make/orca-rez</key>
<dict>

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AllowedTypes</key>
<array>
<string>com.rand-family.xcode.merlin</string>
</array>
<key>DefaultCompletionName</key>
<string>File</string>
<key>Description</key>
<string>A Merlin assembly source file.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>MainTemplateFile</key>
<string>___FILEBASENAME___.s</string>
<key>Summary</key>
<string>A Merlin assembly source file</string>
</dict>
</plist>

View File

@ -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

View File

@ -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

View File

@ -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"