Add a macgen wrapper script. Set the filetype correctly for most targets. Fix the build for CDevs which are pure resources

This commit is contained in:
Jeremy Rand 2017-06-13 22:03:02 -04:00
parent a86b9a5b5a
commit a9bddfb1e1
9 changed files with 104 additions and 23 deletions

Binary file not shown.

View File

@ -23,9 +23,9 @@ INCLUDE_PATHS=
REZ=make/orca-rez REZ=make/orca-rez
REZFLAGS= REZFLAGS=
MACGEN=$(ORCA) macgen MACGEN=make/orca-macgen
MACGENFLAGS=-P MACGENFLAGS=-P
MACGENMACROS=$(wildcard $(ORCA_HOME)/libraries/ORCAInclude/m*) MACGENMACROS=13/ORCAInclude/m=
ASSEMBLE=make/orca-asm ASSEMBLE=make/orca-asm
ASMFLAGS=-P ASMFLAGS=-P
@ -33,5 +33,7 @@ ASMFLAGS=-P
LINK=$(ORCA) link LINK=$(ORCA) link
LDFLAGS=-P LDFLAGS=-P
CHTYP=$(ORCA) chtyp
RM=rm -f RM=rm -f
CP=cp CP=cp

View File

@ -6,7 +6,24 @@ export PATH := $(PATH):$(ORCA_BIN)
CWD=$(shell pwd) 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= ROOTCFILE=
endif endif
@ -17,6 +34,7 @@ C_DEPS=$(ROOTCFILE:.c=.d) $(C_SRCS:.c=.d)
ASM_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS)))) ASM_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS))))
ASM_MACROS=$(ASM_SRCS:.s=.macros) ASM_MACROS=$(ASM_SRCS:.s=.macros)
ASM_DEPS=$(ASM_SRCS:.s=.macros.d)
ASM_ROOTS=$(ASM_SRCS:.s=.ROOT) ASM_ROOTS=$(ASM_SRCS:.s=.ROOT)
ASM_OBJS=$(ASM_SRCS:.s=.a) 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)) $(error Only a single resource file supported, found $(REZ_SRCS))
endif 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=) 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_OBJS=$(C_ROOTS:.root=.a) $(C_OBJS) $(ASM_OBJS) $(REZ_OBJS)
ALL_ROOTS=$(C_ROOTS) $(C_OBJS:.a=.root) $(ASM_ROOTS) ALL_ROOTS=$(C_ROOTS) $(C_OBJS:.a=.root) $(ASM_ROOTS)
ALL_DEPS=$(C_DEPS) $(REZ_DEPS) ALL_DEPS=$(C_DEPS) $(ASM_DEPS) $(REZ_DEPS)
LINK_ARGS=
EXECCMD= EXECCMD=
#ALLTARGET=$(DISKIMAGE) #ALLTARGET=$(DISKIMAGE)
ifeq ($(TARGETTYPE),shell) #ifeq ($(TARGETTYPE),shell)
ALLTARGET=execute # ALLTARGET=execute
else #else
ALLTARGET=$(PGM) # ALLTARGET=$(PGM)
endif #endif
ALLTARGET=$(PGM)
.PHONY: all execute clean .PHONY: all execute clean
#.PRECIOUS: $(ASM_MACROS) .PRECIOUS: $(ASM_MACROS)
all: $(ALLTARGET) all: $(ALLTARGET)
clean: clean:
$(RM) "$(PGM)" $(RM) "$(PGM)" $(BINTARGET)
$(RM) $(ALL_OBJS) $(RM) $(ALL_OBJS)
$(RM) $(ALL_ROOTS) $(RM) $(ALL_ROOTS)
$(RM) $(ALL_DEPS) $(RM) $(ALL_DEPS)
@ -66,12 +86,37 @@ createPackage:
cleanMacCruft: cleanMacCruft:
rm -rf pkg 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) $(PGM): $(BUILD_OBJS)
ifneq ($(REZ_OBJS),) ifneq ($(REZ_OBJS),)
$(RM) $(PGM) $(RM) $(PGM)
$(CP) $(REZ_OBJS) $(PGM) $(CP) $(REZ_OBJS) $(PGM)
endif 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) #$(DISKIMAGE): $(PGM)
# make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)" # make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)"
@ -89,7 +134,7 @@ execute: $(PGM)
$(COMPILE) $< $(CFLAGS) $(COMPILE) $< $(CFLAGS)
%.macros: %.s %.macros: %.s
$(MACGEN) $(MACGENFLAGS) $< $@ $(MACGENMACROS) $(MACGEN) "$(MACGENFLAGS)" $< $@ $(MACGENMACROS)
%.ROOT: %.macros %.ROOT: %.macros
$(ASSEMBLE) $(<:.macros=.s) $(ASMFLAGS) $(ASSEMBLE) $(<:.macros=.s) $(ASMFLAGS)
@ -99,13 +144,6 @@ execute: $(PGM)
$(OBJS): Makefile $(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 # Include the C and rez dependencies which were generated from the last build
# so we recompile correctly on .h file changes. # so we recompile correctly on .h file changes.
-include $(ALL_DEPS) -include $(ALL_DEPS)

View File

@ -9,6 +9,7 @@
<string>make/head.mk</string> <string>make/head.mk</string>
<string>make/orca-asm</string> <string>make/orca-asm</string>
<string>make/orca-cc</string> <string>make/orca-cc</string>
<string>make/orca-macgen</string>
<string>make/orca-rez</string> <string>make/orca-rez</string>
<string>make/tail.mk</string> <string>make/tail.mk</string>
</array> </array>
@ -40,6 +41,13 @@
<key>Path</key> <key>Path</key>
<string>make/orca-cc</string> <string>make/orca-cc</string>
</dict> </dict>
<key>make/orca-macgen</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-macgen</string>
</dict>
<key>make/orca-rez</key> <key>make/orca-rez</key>
<dict> <dict>
<key>Group</key> <key>Group</key>

View File

@ -11,6 +11,7 @@
<string>make/head.mk</string> <string>make/head.mk</string>
<string>make/orca-asm</string> <string>make/orca-asm</string>
<string>make/orca-cc</string> <string>make/orca-cc</string>
<string>make/orca-macgen</string>
<string>make/orca-rez</string> <string>make/orca-rez</string>
<string>make/tail.mk</string> <string>make/tail.mk</string>
</array> </array>
@ -52,6 +53,13 @@
<key>Path</key> <key>Path</key>
<string>make/orca-cc</string> <string>make/orca-cc</string>
</dict> </dict>
<key>make/orca-macgen</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-macgen</string>
</dict>
<key>make/orca-rez</key> <key>make/orca-rez</key>
<dict> <dict>
<key>Group</key> <key>Group</key>

View File

@ -11,6 +11,7 @@
<string>make/head.mk</string> <string>make/head.mk</string>
<string>make/orca-asm</string> <string>make/orca-asm</string>
<string>make/orca-cc</string> <string>make/orca-cc</string>
<string>make/orca-macgen</string>
<string>make/orca-rez</string> <string>make/orca-rez</string>
<string>make/tail.mk</string> <string>make/tail.mk</string>
</array> </array>
@ -52,6 +53,13 @@
<key>Path</key> <key>Path</key>
<string>make/orca-cc</string> <string>make/orca-cc</string>
</dict> </dict>
<key>make/orca-macgen</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-macgen</string>
</dict>
<key>make/orca-rez</key> <key>make/orca-rez</key>
<dict> <dict>
<key>Group</key> <key>Group</key>

View File

@ -9,6 +9,7 @@
<string>make/head.mk</string> <string>make/head.mk</string>
<string>make/orca-asm</string> <string>make/orca-asm</string>
<string>make/orca-cc</string> <string>make/orca-cc</string>
<string>make/orca-macgen</string>
<string>make/orca-rez</string> <string>make/orca-rez</string>
<string>make/tail.mk</string> <string>make/tail.mk</string>
</array> </array>
@ -40,6 +41,13 @@
<key>Path</key> <key>Path</key>
<string>make/orca-cc</string> <string>make/orca-cc</string>
</dict> </dict>
<key>make/orca-macgen</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-macgen</string>
</dict>
<key>make/orca-rez</key> <key>make/orca-rez</key>
<dict> <dict>
<key>Group</key> <key>Group</key>

View File

@ -9,6 +9,7 @@
<string>make/head.mk</string> <string>make/head.mk</string>
<string>make/orca-asm</string> <string>make/orca-asm</string>
<string>make/orca-cc</string> <string>make/orca-cc</string>
<string>make/orca-macgen</string>
<string>make/orca-rez</string> <string>make/orca-rez</string>
<string>make/tail.mk</string> <string>make/tail.mk</string>
</array> </array>
@ -40,6 +41,13 @@
<key>Path</key> <key>Path</key>
<string>make/orca-cc</string> <string>make/orca-cc</string>
</dict> </dict>
<key>make/orca-macgen</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-macgen</string>
</dict>
<key>make/orca-rez</key> <key>make/orca-rez</key>
<dict> <dict>
<key>Group</key> <key>Group</key>

View File

@ -11,6 +11,7 @@ shell:Shell Command in Assembly
cda:Classic Desk Accessory in C cda:Classic Desk Accessory in C
nda:New Desk Accessory in C nda:New Desk Accessory in C
desktop:Desktop Application in C desktop:Desktop Application in C
cdev:Control Panel in C
EOF EOF
while read PROJECT while read PROJECT