2014-09-05 04:10:59 +00:00
|
|
|
#
|
|
|
|
# tail.mk
|
|
|
|
# Apple2BuildPipelineSample
|
|
|
|
#
|
|
|
|
# Part of a sample build pipeline for Apple ][ software development
|
|
|
|
#
|
|
|
|
# Created by Quinn Dunki on 8/15/14.
|
|
|
|
# One Girl, One Laptop Productions
|
|
|
|
# http://www.quinndunki.com
|
|
|
|
# http://www.quinndunki.com/blondihacks
|
|
|
|
#
|
|
|
|
|
|
|
|
export PATH := $(PATH):$(CC65_BIN)
|
|
|
|
|
2014-09-30 02:01:18 +00:00
|
|
|
CWD=$(shell pwd)
|
|
|
|
|
2014-09-05 04:10:59 +00:00
|
|
|
C_OBJS=$(C_SRCS:.c=.o)
|
2014-09-09 04:18:35 +00:00
|
|
|
C_DEPS=$(C_SRCS:.c=.u)
|
2014-09-05 04:10:59 +00:00
|
|
|
ASM_OBJS=$(ASM_SRCS:.s=.o)
|
|
|
|
ASM_LSTS=$(ASM_SRCS:.s=.lst)
|
|
|
|
OBJS=$(C_OBJS) $(ASM_OBJS)
|
|
|
|
|
|
|
|
MAPFILE=$(PGM).map
|
|
|
|
DISKIMAGE=$(PGM).dsk
|
|
|
|
|
|
|
|
LINK_ARGS=
|
|
|
|
|
2014-09-09 04:18:35 +00:00
|
|
|
EXECCMD=
|
|
|
|
|
2014-09-11 02:21:21 +00:00
|
|
|
ALLTARGET=$(DISKIMAGE)
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
ALLTARGET=execute
|
|
|
|
endif
|
|
|
|
|
2014-09-05 04:10:59 +00:00
|
|
|
ifneq ($(START_ADDR),)
|
|
|
|
# If the MACHINE is set to an option which does not support a variable start
|
|
|
|
# address, then error.
|
|
|
|
ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),)
|
|
|
|
$(error You cannot change start address with this machine type)
|
|
|
|
endif
|
2014-09-10 05:28:12 +00:00
|
|
|
else
|
2014-09-11 02:21:21 +00:00
|
|
|
# If not set, then use the default for the config as per cc65 documentation
|
2014-09-10 05:28:12 +00:00
|
|
|
ifneq ($(filter $(MACHINE), apple2 apple2-dos33 apple2enh apple2enh-dos33),)
|
|
|
|
START_ADDR=803
|
|
|
|
endif
|
|
|
|
ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),)
|
|
|
|
START_ADDR=2000
|
|
|
|
endif
|
|
|
|
ifneq ($(filter $(MACHINE), apple2-loader apple2-reboot apple2enh-loader apple2enh-reboot),)
|
|
|
|
START_ADDR=800
|
|
|
|
endif
|
2014-09-09 04:18:35 +00:00
|
|
|
endif
|
2014-09-10 05:28:12 +00:00
|
|
|
LDFLAGS += --start-addr 0x$(START_ADDR)
|
2014-09-09 04:18:35 +00:00
|
|
|
|
|
|
|
ifneq ($(filter $(MACHINE), apple2 apple2enh apple2-dos33 apple2enh-dos33),)
|
|
|
|
EXECCMD=$(shell echo brun $(PGM) | tr '[a-z]' '[A-Z]')
|
2014-09-05 04:10:59 +00:00
|
|
|
endif
|
|
|
|
|
2014-09-09 04:18:35 +00:00
|
|
|
MACHCONFIG= -t apple2
|
|
|
|
|
|
|
|
ifneq ($(filter $(MACHINE), apple2enh apple2apple2enh-dos33 apple2enh-system apple2enh-loader apple2enh-reboot),)
|
|
|
|
MACHCONFIG= -t apple2enh
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(filter $(MACHINE), apple2 apple2enh),)
|
|
|
|
MACHCONFIG += -C $(MACHINE).cfg
|
|
|
|
endif
|
2014-09-05 04:10:59 +00:00
|
|
|
|
|
|
|
.PHONY: all execute clean
|
|
|
|
|
2014-09-11 02:21:21 +00:00
|
|
|
all: $(ALLTARGET)
|
2014-09-05 04:10:59 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(PGM)
|
|
|
|
rm -f $(OBJS)
|
2014-09-09 04:18:35 +00:00
|
|
|
rm -f $(C_DEPS)
|
2014-09-05 04:10:59 +00:00
|
|
|
rm -f $(MAPFILE)
|
|
|
|
rm -f $(ASM_LSTS)
|
|
|
|
rm -f $(DISKIMAGE)
|
|
|
|
|
|
|
|
$(PGM): $(OBJS)
|
2014-09-09 04:18:35 +00:00
|
|
|
$(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o $(PGM) $(OBJS)
|
2014-09-05 04:10:59 +00:00
|
|
|
|
|
|
|
$(DISKIMAGE): $(PGM)
|
2014-09-10 05:28:12 +00:00
|
|
|
make/createDiskImage $(AC) $(MACHINE) $(DISKIMAGE) $(PGM) "$(START_ADDR)"
|
2014-09-05 04:10:59 +00:00
|
|
|
|
|
|
|
execute: $(DISKIMAGE)
|
2014-09-30 02:01:18 +00:00
|
|
|
osascript make/V2Make.scpt $(CWD) $(PGM) $(CWD)/make/DevApple.vii "$(EXECCMD)"
|
2014-09-05 04:10:59 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
2014-09-09 04:18:35 +00:00
|
|
|
$(CL65) $(MACHCONFIG) $(CFLAGS) --create-dep -c -o $@ $<
|
|
|
|
sed -i .bak 's/\.s:/.o:/' $(@:.o=.u)
|
|
|
|
rm -f $(@:.o=.u).bak
|
2014-09-05 04:10:59 +00:00
|
|
|
|
|
|
|
%.o: %.s
|
2014-09-09 04:18:35 +00:00
|
|
|
$(CL65) $(MACHCONFIG) --cpu $(CPU) $(ASMFLAGS) -l -c -o $@ $<
|
2014-09-05 04:10:59 +00:00
|
|
|
|
2014-09-09 04:18:35 +00:00
|
|
|
-include $(C_DEPS)
|