diff --git a/Apple2GSXcodeTemplate.pkg b/Apple2GSXcodeTemplate.pkg
index f4ffee1..334e91e 100644
Binary files a/Apple2GSXcodeTemplate.pkg and b/Apple2GSXcodeTemplate.pkg differ
diff --git a/make/head.mk b/make/head.mk
index a062f62..1d7e7c4 100644
--- a/make/head.mk
+++ b/make/head.mk
@@ -23,9 +23,9 @@ INCLUDE_PATHS=
REZ=make/orca-rez
REZFLAGS=
-MACGEN=$(ORCA) macgen
+MACGEN=make/orca-macgen
MACGENFLAGS=-P
-MACGENMACROS=$(wildcard $(ORCA_HOME)/libraries/ORCAInclude/m*)
+MACGENMACROS=13/ORCAInclude/m=
ASSEMBLE=make/orca-asm
ASMFLAGS=-P
@@ -33,5 +33,7 @@ ASMFLAGS=-P
LINK=$(ORCA) link
LDFLAGS=-P
+CHTYP=$(ORCA) chtyp
+
RM=rm -f
CP=cp
diff --git a/make/tail.mk b/make/tail.mk
index 09e6e8f..0213e19 100644
--- a/make/tail.mk
+++ b/make/tail.mk
@@ -6,7 +6,24 @@ export PATH := $(PATH):$(ORCA_BIN)
CWD=$(shell pwd)
-ifeq ($(wildcard $(ROOTCFILE)),)
+ifeq ($(TARGETTYPE),shell)
+ FILETYPE=exe
+else ifeq ($(TARGETTYPE),desktop)
+ FILETYPE=s16
+else ifeq ($(TARGETTYPE),cda)
+ FILETYPE=cda
+else ifeq ($(TARGETTYPE),cdev)
+ BINTARGET=$(PGM).bin
+ FILETYPE=199
+else ifeq ($(TARGETTYPE),nba)
+ FILETYPE=exe
+else ifeq ($(TARGETTYPE),nda)
+ FILETYPE=nda
+else ifeq ($(TARGETTYPE),xcmd)
+ FILETYPE=exe
+endif
+
+ifeq ($(wildcard $(ROOTCFILE)),)
ROOTCFILE=
endif
@@ -17,6 +34,7 @@ C_DEPS=$(ROOTCFILE:.c=.d) $(C_SRCS:.c=.d)
ASM_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS))))
ASM_MACROS=$(ASM_SRCS:.s=.macros)
+ASM_DEPS=$(ASM_SRCS:.s=.macros.d)
ASM_ROOTS=$(ASM_SRCS:.s=.ROOT)
ASM_OBJS=$(ASM_SRCS:.s=.a)
@@ -28,32 +46,34 @@ ifneq ($(firstword $(REZ_SRCS)), $(lastword $(REZ_SRCS)))
$(error Only a single resource file supported, found $(REZ_SRCS))
endif
-BUILD_OBJS=$(C_ROOTS) $(C_OBJS) $(ASM_ROOTS) $(REZ_OBJS)
+BUILD_OBJS=$(C_ROOTS) $(C_OBJS) $(ASM_ROOTS)
+ifeq ($(BINTARGET),)
+ BUILD_OBJS+=$(REZ_OBJS)
+endif
BUILD_OBJS_NOSUFFIX=$(C_ROOTS:.root=) $(C_OBJS:.a=) $(ASM_ROOTS:.ROOT=)
ALL_OBJS=$(C_ROOTS:.root=.a) $(C_OBJS) $(ASM_OBJS) $(REZ_OBJS)
ALL_ROOTS=$(C_ROOTS) $(C_OBJS:.a=.root) $(ASM_ROOTS)
-ALL_DEPS=$(C_DEPS) $(REZ_DEPS)
-
-LINK_ARGS=
+ALL_DEPS=$(C_DEPS) $(ASM_DEPS) $(REZ_DEPS)
EXECCMD=
#ALLTARGET=$(DISKIMAGE)
-ifeq ($(TARGETTYPE),shell)
- ALLTARGET=execute
-else
- ALLTARGET=$(PGM)
-endif
+#ifeq ($(TARGETTYPE),shell)
+# ALLTARGET=execute
+#else
+# ALLTARGET=$(PGM)
+#endif
+ALLTARGET=$(PGM)
.PHONY: all execute clean
-#.PRECIOUS: $(ASM_MACROS)
+.PRECIOUS: $(ASM_MACROS)
all: $(ALLTARGET)
clean:
- $(RM) "$(PGM)"
+ $(RM) "$(PGM)" $(BINTARGET)
$(RM) $(ALL_OBJS)
$(RM) $(ALL_ROOTS)
$(RM) $(ALL_DEPS)
@@ -66,12 +86,37 @@ createPackage:
cleanMacCruft:
rm -rf pkg
+
+ifeq ($(BINTARGET),)
+
+# This is a standard build where we generate the resources if any and then link
+# the binary over that same file creating the resource fork first and the data
+# fork second.
$(PGM): $(BUILD_OBJS)
ifneq ($(REZ_OBJS),)
$(RM) $(PGM)
$(CP) $(REZ_OBJS) $(PGM)
endif
- $(LINK) $(BUILD_OBJS_NOSUFFIX) --keep=$(PGM) $(LDFLAGS)
+ $(LINK) $(LDFLAGS) $(BUILD_OBJS_NOSUFFIX) --keep=$(PGM)
+ $(CHTYP) -t $(FILETYPE) $(PGM)
+
+else
+
+# This is a special build for CDevs (maybe others also?) where we build the binary
+# into a $(PGM).bin file and then build the resources into the $(PGM) target. The
+# resource compile will read the $(PGM).bin binary and load it into the resources
+# also.
+$(BINTARGET): $(BUILD_OBJS)
+ $(LINK) $(LDFLAGS) $(BUILD_OBJS_NOSUFFIX) --keep=$(BINTARGET)
+
+$(REZ_OBJS): $(BINTARGET)
+
+$(PGM): $(REZ_OBJS)
+ $(RM) $(PGM)
+ $(CP) $(REZ_OBJS) $(PGM)
+ $(CHTYP) -t $(FILETYPE) $(PGM)
+
+endif
#$(DISKIMAGE): $(PGM)
# make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)"
@@ -89,7 +134,7 @@ execute: $(PGM)
$(COMPILE) $< $(CFLAGS)
%.macros: %.s
- $(MACGEN) $(MACGENFLAGS) $< $@ $(MACGENMACROS)
+ $(MACGEN) "$(MACGENFLAGS)" $< $@ $(MACGENMACROS)
%.ROOT: %.macros
$(ASSEMBLE) $(<:.macros=.s) $(ASMFLAGS)
@@ -99,13 +144,6 @@ execute: $(PGM)
$(OBJS): Makefile
-# This adds a dependency to force all .macro targets to be regenerated if
-# any of the macro library files have changed. We can't tell which actual
-# macros are used so we have to regenerate if any have changed.
-ifneq ($(ASM_MACROS),)
-$(ASM_MACROS): $(MACGENMACROS)
-endif
-
# Include the C and rez dependencies which were generated from the last build
# so we recompile correctly on .h file changes.
-include $(ALL_DEPS)
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 71fb651..070e708 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
@@ -9,6 +9,7 @@
make/head.mk
make/orca-asm
make/orca-cc
+ make/orca-macgen
make/orca-rez
make/tail.mk
@@ -40,6 +41,13 @@
Path
make/orca-cc
+ make/orca-macgen
+
+ Group
+ make
+ Path
+ make/orca-macgen
+
make/orca-rez
Group
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 4450607..abab725 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
@@ -11,6 +11,7 @@
make/head.mk
make/orca-asm
make/orca-cc
+ make/orca-macgen
make/orca-rez
make/tail.mk
@@ -52,6 +53,13 @@
Path
make/orca-cc
+ make/orca-macgen
+
+ Group
+ make
+ Path
+ make/orca-macgen
+
make/orca-rez
Group
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 d0afa1f..c30cea2 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
@@ -11,6 +11,7 @@
make/head.mk
make/orca-asm
make/orca-cc
+ make/orca-macgen
make/orca-rez
make/tail.mk
@@ -52,6 +53,13 @@
Path
make/orca-cc
+ make/orca-macgen
+
+ Group
+ make
+ Path
+ make/orca-macgen
+
make/orca-rez
Group
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 7e99161..ae7f09c 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
@@ -9,6 +9,7 @@
make/head.mk
make/orca-asm
make/orca-cc
+ make/orca-macgen
make/orca-rez
make/tail.mk
@@ -40,6 +41,13 @@
Path
make/orca-cc
+ make/orca-macgen
+
+ Group
+ make
+ Path
+ make/orca-macgen
+
make/orca-rez
Group
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 edc59fd..eecf1b1 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
@@ -9,6 +9,7 @@
make/head.mk
make/orca-asm
make/orca-cc
+ make/orca-macgen
make/orca-rez
make/tail.mk
@@ -40,6 +41,13 @@
Path
make/orca-cc
+ make/orca-macgen
+
+ Group
+ make
+ Path
+ make/orca-macgen
+
make/orca-rez
Group
diff --git a/pkg/createPackage b/pkg/createPackage
index 38a7e45..472ca2a 100755
--- a/pkg/createPackage
+++ b/pkg/createPackage
@@ -11,6 +11,7 @@ shell:Shell Command in Assembly
cda:Classic Desk Accessory in C
nda:New Desk Accessory in C
desktop:Desktop Application in C
+cdev:Control Panel in C
EOF
while read PROJECT