2017-05-17 02:34:15 +00:00
|
|
|
#
|
|
|
|
# tail.mk
|
|
|
|
#
|
|
|
|
|
|
|
|
export PATH := $(PATH):$(ORCA_BIN)
|
|
|
|
|
|
|
|
CWD=$(shell pwd)
|
|
|
|
|
2019-07-15 04:28:25 +00:00
|
|
|
DISKIMAGE=$(TARGETDIR)/$(PGM).2mg
|
2017-08-31 03:07:13 +00:00
|
|
|
BUILDTARGET=$(DISKIMAGE)
|
2017-08-30 03:27:04 +00:00
|
|
|
EXECTARGET=executeGUI
|
2017-07-17 04:53:56 +00:00
|
|
|
DISKIMAGEDEST=.
|
2018-08-17 02:37:33 +00:00
|
|
|
AUXTYPE=
|
2019-07-21 05:28:39 +00:00
|
|
|
CFLAGS+=-i$(GENDIR)
|
|
|
|
|
|
|
|
vpath $(GENDIR)
|
2017-07-17 04:53:56 +00:00
|
|
|
|
2017-06-14 02:03:02 +00:00
|
|
|
ifeq ($(TARGETTYPE),shell)
|
|
|
|
FILETYPE=exe
|
2017-08-30 03:27:04 +00:00
|
|
|
EXECTARGET=executeShell
|
2019-07-15 04:28:25 +00:00
|
|
|
BUILDTARGET=$(TARGETDIR)/$(PGM)
|
2017-06-14 02:03:02 +00:00
|
|
|
else ifeq ($(TARGETTYPE),desktop)
|
|
|
|
FILETYPE=s16
|
2019-07-12 00:28:12 +00:00
|
|
|
ifeq ($(MESSAGE_CENTER),1)
|
2019-07-18 00:42:12 +00:00
|
|
|
AUXTYPE=-a 0x0000db07
|
2019-07-12 00:28:12 +00:00
|
|
|
else
|
2019-07-18 00:42:12 +00:00
|
|
|
AUXTYPE=-a 0x0000db03
|
2019-07-12 00:28:12 +00:00
|
|
|
endif
|
|
|
|
CFLAGS+=-dMESSAGE_CENTER=$(MESSAGE_CENTER)
|
|
|
|
REZFLAGS+=rez='-d DESKTOP_RES_MODE=$(DESKTOP_RES_MODE)'
|
|
|
|
REZFLAGS+=rez='-d MESSAGE_CENTER=$(MESSAGE_CENTER)'
|
2017-06-14 02:03:02 +00:00
|
|
|
else ifeq ($(TARGETTYPE),cda)
|
|
|
|
FILETYPE=cda
|
2017-07-17 04:53:56 +00:00
|
|
|
DISKIMAGEDEST=System/Desk.Accs
|
2017-06-14 02:03:02 +00:00
|
|
|
else ifeq ($(TARGETTYPE),cdev)
|
2019-07-15 04:28:25 +00:00
|
|
|
BINTARGET=$(TARGETDIR)/$(PGM).bin
|
2017-06-14 02:03:02 +00:00
|
|
|
FILETYPE=199
|
2017-07-17 04:53:56 +00:00
|
|
|
DISKIMAGEDEST=System/CDevs
|
2019-07-15 04:28:25 +00:00
|
|
|
REZFLAGS+=rez='-d BINTARGET="$(BINTARGET)"'
|
2017-06-14 02:03:02 +00:00
|
|
|
else ifeq ($(TARGETTYPE),nba)
|
|
|
|
FILETYPE=exe
|
2019-07-15 04:28:25 +00:00
|
|
|
BUILDTARGET=$(TARGETDIR)/$(PGM)
|
2017-06-14 02:03:02 +00:00
|
|
|
else ifeq ($(TARGETTYPE),nda)
|
|
|
|
FILETYPE=nda
|
2017-07-17 04:53:56 +00:00
|
|
|
DISKIMAGEDEST=System/Desk.Accs
|
2017-06-14 02:03:02 +00:00
|
|
|
else ifeq ($(TARGETTYPE),xcmd)
|
|
|
|
FILETYPE=exe
|
2019-07-15 04:28:25 +00:00
|
|
|
BUILDTARGET=$(TARGETDIR)/$(PGM)
|
2017-06-14 02:03:02 +00:00
|
|
|
endif
|
|
|
|
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2019-07-21 05:28:39 +00:00
|
|
|
ASM_SRCS=$(patsubst $(GENDIR)/%, %, $(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS)))))
|
2019-07-18 00:42:12 +00:00
|
|
|
|
|
|
|
ifeq ($(ASSEMBLER),orcam)
|
|
|
|
ASM_MACROS=$(patsubst %.s, $(OBJDIR)/%.macros, $(ASM_SRCS))
|
|
|
|
ASM_DEPS=$(patsubst %.s, $(OBJDIR)/%.macros.d, $(ASM_SRCS))
|
|
|
|
ASM_ROOTS=$(patsubst %.s, $(OBJDIR)/%.ROOT, $(ASM_SRCS))
|
|
|
|
ASM_OBJS=$(patsubst %.s, $(OBJDIR)/%.a, $(ASM_SRCS))
|
|
|
|
|
|
|
|
ifeq ($(wildcard $(ROOTCFILE)),)
|
|
|
|
ROOTCFILE=
|
|
|
|
endif
|
|
|
|
|
|
|
|
C_ROOTS=$(patsubst %.c, $(OBJDIR)/%.root, $(ROOTCFILE))
|
2019-07-21 05:28:39 +00:00
|
|
|
C_SRCS+=$(filter-out $(ROOTCFILE), $(patsubst $(GENDIR)/%, %, $(patsubst ./%, %, $(wildcard $(addsuffix /*.c, $(SRCDIRS))))))
|
2019-07-18 00:42:12 +00:00
|
|
|
C_OBJS=$(patsubst %.c, $(OBJDIR)/%.a, $(C_SRCS))
|
|
|
|
C_DEPS=$(patsubst %.c, $(OBJDIR)/%.d, $(ROOTCFILE)) $(patsubst %.c, $(OBJDIR)/%.d, $(C_SRCS))
|
|
|
|
endif
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2019-07-21 05:28:39 +00:00
|
|
|
REZ_SRCS=$(patsubst $(GENDIR)/%, %, $(patsubst ./%, %, $(wildcard $(addsuffix /*.rez, $(SRCDIRS)))))
|
2019-07-15 04:28:25 +00:00
|
|
|
REZ_DEPS=$(patsubst %.rez, $(OBJDIR)/%.rez.d, $(REZ_SRCS))
|
|
|
|
REZ_OBJS=$(patsubst %.rez, $(OBJDIR)/%.r, $(REZ_SRCS))
|
2017-05-17 02:34:15 +00:00
|
|
|
|
|
|
|
ifneq ($(firstword $(REZ_SRCS)), $(lastword $(REZ_SRCS)))
|
|
|
|
$(error Only a single resource file supported, found $(REZ_SRCS))
|
|
|
|
endif
|
|
|
|
|
2017-06-14 02:03:02 +00:00
|
|
|
BUILD_OBJS=$(C_ROOTS) $(C_OBJS) $(ASM_ROOTS)
|
|
|
|
ifeq ($(BINTARGET),)
|
|
|
|
BUILD_OBJS+=$(REZ_OBJS)
|
|
|
|
endif
|
2017-05-17 02:34:15 +00:00
|
|
|
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)
|
2017-06-14 02:03:02 +00:00
|
|
|
ALL_DEPS=$(C_DEPS) $(ASM_DEPS) $(REZ_DEPS)
|
2017-05-17 02:34:15 +00:00
|
|
|
|
|
|
|
EXECCMD=
|
|
|
|
|
2018-08-10 03:30:24 +00:00
|
|
|
.PHONY: build execute executeShell executeGUI clean xcodefix
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2017-06-14 02:03:02 +00:00
|
|
|
.PRECIOUS: $(ASM_MACROS)
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2017-08-31 03:07:13 +00:00
|
|
|
build: $(BUILDTARGET)
|
|
|
|
|
2018-08-10 03:30:24 +00:00
|
|
|
gen: xcodefix
|
|
|
|
|
|
|
|
xcodefix:
|
2020-11-26 21:58:14 +00:00
|
|
|
[ "`uname`" = Darwin ] && defaults write "$(ORCAM_PLUGIN_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)s -array `defaults read "$(XCODE_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)` || true
|
2018-08-10 03:30:24 +00:00
|
|
|
|
2017-08-31 03:07:13 +00:00
|
|
|
clean: genclean
|
2019-07-15 04:28:25 +00:00
|
|
|
$(RM) "$(TARGETDIR)/$(PGM)" $(BINTARGET)
|
2017-05-17 02:34:15 +00:00
|
|
|
$(RM) $(ALL_OBJS)
|
|
|
|
$(RM) $(ALL_ROOTS)
|
|
|
|
$(RM) $(ALL_DEPS)
|
|
|
|
$(RM) $(ASM_MACROS)
|
2017-07-17 04:53:56 +00:00
|
|
|
$(RM) "$(DISKIMAGE)"
|
2017-05-17 02:34:15 +00:00
|
|
|
|
|
|
|
createPackage:
|
|
|
|
pkg/createPackage
|
|
|
|
|
|
|
|
cleanMacCruft:
|
|
|
|
rm -rf pkg
|
|
|
|
|
2017-06-14 02:03:02 +00:00
|
|
|
|
|
|
|
ifeq ($(BINTARGET),)
|
2019-07-18 00:42:12 +00:00
|
|
|
ifeq ($(ASSEMBLER),orcam)
|
2017-06-14 02:03:02 +00:00
|
|
|
|
2019-07-18 00:42:12 +00:00
|
|
|
# This is a standard ORCA 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.
|
2019-07-15 04:28:25 +00:00
|
|
|
$(TARGETDIR)/$(PGM): $(BUILD_OBJS)
|
2019-08-08 02:25:17 +00:00
|
|
|
$(MKDIR) $(TARGETDIR)
|
2017-05-17 02:34:15 +00:00
|
|
|
ifneq ($(REZ_OBJS),)
|
2019-07-15 04:28:25 +00:00
|
|
|
$(RM) $(TARGETDIR)/$(PGM)
|
|
|
|
$(CP) $(REZ_OBJS) $(TARGETDIR)/$(PGM)
|
2017-05-17 02:34:15 +00:00
|
|
|
endif
|
2020-11-26 23:05:34 +00:00
|
|
|
cd $(OBJDIR); $(LINK) $(LDFLAGS) $(patsubst $(OBJDIR)/%, %, $(BUILD_OBJS_NOSUFFIX)) keep="$(abspath $(TARGETDIR)/$(PGM))"
|
2019-07-15 04:28:25 +00:00
|
|
|
$(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM)
|
2017-06-14 02:03:02 +00:00
|
|
|
|
2019-07-18 00:42:12 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ASSEMBLER),merlin)
|
|
|
|
# This is a standard Merlin 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.
|
|
|
|
|
|
|
|
$(TARGETDIR)/$(PGM): $(BUILD_OBJS) $(ASM_SRCS)
|
2019-08-08 02:25:17 +00:00
|
|
|
$(MKDIR) $(TARGETDIR)
|
2019-07-18 00:42:12 +00:00
|
|
|
$(RM) $(TARGETDIR)/$(PGM)
|
2019-07-19 15:51:55 +00:00
|
|
|
$(MERLIN_ASM) linkscript.s $(PGM) $(TARGETDIR)/$(PGM)
|
2019-07-18 00:42:12 +00:00
|
|
|
ifneq ($(REZ_OBJS),)
|
2019-07-18 04:11:44 +00:00
|
|
|
$(CP) $(REZ_OBJS)/..namedfork/rsrc $(TARGETDIR)/$(PGM)/..namedfork/rsrc
|
2019-07-18 00:42:12 +00:00
|
|
|
endif
|
|
|
|
$(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2017-06-14 02:03:02 +00:00
|
|
|
else
|
|
|
|
|
2019-07-18 00:42:12 +00:00
|
|
|
ifeq ($(ASSEMBLER),orcam)
|
|
|
|
# This is a special build for CDevs under ORCA 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.
|
2017-06-14 02:03:02 +00:00
|
|
|
$(BINTARGET): $(BUILD_OBJS)
|
2020-11-26 23:05:34 +00:00
|
|
|
cd $(OBJDIR); $(LINK) $(LDFLAGS) $(patsubst $(OBJDIR)/%, %, $(BUILD_OBJS_NOSUFFIX)) keep="$(abspath $(BINTARGET))"
|
2017-06-14 02:03:02 +00:00
|
|
|
|
2019-07-18 00:42:12 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ASSEMBLER),merlin)
|
|
|
|
# This is a special build for CDevs under Merlin 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) $(ASM_SRCS)
|
2019-07-19 15:51:55 +00:00
|
|
|
$(MERLIN_ASM) linkscript.s $(PGM) $(BINTARGET)
|
2019-07-18 00:42:12 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2017-06-14 02:03:02 +00:00
|
|
|
$(REZ_OBJS): $(BINTARGET)
|
|
|
|
|
2019-07-15 04:28:25 +00:00
|
|
|
$(TARGETDIR)/$(PGM): $(REZ_OBJS)
|
2019-08-08 02:25:17 +00:00
|
|
|
$(MKDIR) $(TARGETDIR)
|
2019-07-15 04:28:25 +00:00
|
|
|
$(RM) $(TARGETDIR)/$(PGM)
|
|
|
|
$(CP) $(REZ_OBJS) $(TARGETDIR)/$(PGM)
|
|
|
|
$(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM)
|
2017-06-14 02:03:02 +00:00
|
|
|
|
|
|
|
endif
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2019-07-15 04:28:25 +00:00
|
|
|
$(DISKIMAGE): $(TARGETDIR)/$(PGM)
|
|
|
|
make/createDiskImage "$(DISKIMAGE)" "$(TARGETDIR)/$(PGM)" "$(DISKIMAGEDEST)" $(COPYDIRS)
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2017-08-30 03:27:04 +00:00
|
|
|
execute: $(EXECTARGET)
|
|
|
|
|
2017-08-31 03:07:13 +00:00
|
|
|
executeGUI: all
|
2020-11-26 23:05:34 +00:00
|
|
|
make/launchEmulator "$(DISKIMAGE)"
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2017-08-31 03:07:13 +00:00
|
|
|
executeShell: all
|
2019-07-15 04:28:25 +00:00
|
|
|
$(ORCA) $(TARGETDIR)/$(PGM)
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2019-07-15 04:28:25 +00:00
|
|
|
$(OBJDIR)/%.a: %.c
|
|
|
|
$(COMPILE) $< $(@:.a=) $(CFLAGS) --noroot
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2019-07-21 05:28:39 +00:00
|
|
|
$(OBJDIR)/%.a: $(GENDIR)/%.c
|
|
|
|
$(COMPILE) $< $(@:.a=) $(CFLAGS) --noroot
|
|
|
|
|
2019-07-15 04:28:25 +00:00
|
|
|
$(OBJDIR)/%.root: %.c
|
|
|
|
$(COMPILE) $< $(@:.root=) $(CFLAGS)
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2019-07-21 05:28:39 +00:00
|
|
|
$(OBJDIR)/%.root: $(GENDIR)/%.c
|
|
|
|
$(COMPILE) $< $(@:.root=) $(CFLAGS)
|
|
|
|
|
2019-07-15 04:28:25 +00:00
|
|
|
$(OBJDIR)/%.ROOT: %.s
|
|
|
|
MACGENFLAGS="$(MACGENFLAGS)" MACGENMACROS="$(MACGENMACROS)" $(ASSEMBLE) $< $(@:.ROOT=) $(ASMFLAGS)
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2019-07-21 05:28:39 +00:00
|
|
|
$(OBJDIR)/%.ROOT: $(GENDIR)/%.s
|
|
|
|
MACGENFLAGS="$(MACGENFLAGS)" MACGENMACROS="$(MACGENMACROS)" $(ASSEMBLE) $< $(@:.ROOT=) $(ASMFLAGS)
|
|
|
|
|
2019-07-15 04:28:25 +00:00
|
|
|
$(OBJDIR)/%.r: %.rez
|
|
|
|
$(REZ) $< $(@:.r=) $(REZFLAGS)
|
2018-08-09 03:54:36 +00:00
|
|
|
ifneq ($(RLINT_PATH),)
|
|
|
|
$(ORCA) $(RLINT_PATH) $@
|
|
|
|
endif
|
2017-05-17 02:34:15 +00:00
|
|
|
|
2019-07-21 05:28:39 +00:00
|
|
|
$(OBJDIR)/%.r: $(GENDIR)/%.rez
|
|
|
|
$(REZ) $< $(@:.r=) $(REZFLAGS)
|
|
|
|
ifneq ($(RLINT_PATH),)
|
|
|
|
$(ORCA) $(RLINT_PATH) $@
|
|
|
|
endif
|
|
|
|
|
2017-05-17 02:34:15 +00:00
|
|
|
$(OBJS): Makefile
|
|
|
|
|
|
|
|
# Include the C and rez dependencies which were generated from the last build
|
|
|
|
# so we recompile correctly on .h file changes.
|
|
|
|
-include $(ALL_DEPS)
|