-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.coco
116 lines (85 loc) · 3.27 KB
/
Makefile.coco
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# NOTE: Update the CMOC_SRC to the cmoc source directory to include its own <..> header files
CMOC_SRC := ~/Documents/projects/cmoc-0.1.88/src
TARGET_EXEC = fujitzee
VERSION = 1.0.0
TARGET = coco
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
CC=cmoc
ASM=lwasm
SRCS := $(shell ls $(SRC_DIRS)/*.c) $(shell find $(SRC_DIRS)/coco -name *.c) $(shell find $(SRC_DIRS)/coco -name *.s)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
# Required libraries.
# this downloads fujinet-lib and populates FUJINET_LIB_VERSION_DIR and FUJINET_LIB_NAME
include fujinet-lib.mk
LIBS = \
-L $(FUJINET_LIB_VERSION_DIR) -l:$(FUJINET_LIB_NAME)
# Not using bcontrol now, but may in future for joystick
# -L support/coco/bcontrol -lbcontrol
ASFLAGS =
CFLAGS= \
-I $(CMOC_SRC) \
-I src/include \
-I $(FUJINET_LIB_VERSION_DIR) \
--$(TARGET) \
--intdir ./intermediates \
--stack-space=512 \
-fomit-frame-pointer \
-O2 \
--raw
# --check-null \
# -D_CMOC_CHECK_STACK_OVERFLOW_ --check-stack\
# Load from 1A00 to 7D00, but have early warning at 7B00
LDFLAGS= --$(TARGET) \
-o$(TARGET_EXEC).app \
-I $(CMOC_SRC) \
--limit=7B00 \
--org=1A00
LDFLAGS_TEST= --$(TARGET) \
-o$$(TARGET_EXEC).app
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
DSK = $(TARGET_EXEC).dsk
$(BUILD_DIR)/$(TARGET_EXEC): clean .get_fujinet_lib $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) $(LIBS)
# Prepare Disk
$(RM) $(DSK)
decb dskini $(DSK)
cp $(TARGET_EXEC).app f.bin
writecocofile $(DSK) f.bin
# install-coco-boot-loader $(DSK) support/coco/loader.bin
# split -a1 -n6 -d $(TARGET_EXEC).app $(TARGET_EXEC).aa
# for f in $(TARGET_EXEC).aa*; do writecocofile $(DSK) $$f; done
# writecocofile $(DSK) support/coco/loader.bin
# writecocofile $(DSK) $(TARGET_EXEC).bin
# Normal Method without loader.bin
# decb copy -t -0 support/coco/autoexec.bas $(DSK),AUTOEXEC.BAS
# writecocofile $(DSK) $(TARGET_EXEC).bin
ifeq ($(OS),Windows_NT)
@echo ........................................................................ & dir $(TARGET_EXEC).app | find "$(TARGET_EXEC).app" &echo ........................................................................
else
@echo ........................................................................ ;ls -l $(TARGET_EXEC).app;echo ........................................................................
endif
cp $(CURDIR)/$(DSK) ~/Documents/fujinetpc-coco/SD/$(DSK)
cd ~/mame_coco;mame coco3 -window -nomaximize -resolution 1024x768 -natural -autoboot_delay 1 -autoboot_command "runm\"f\n"
# cd ~/mame_coco;mame coco -window -nomaximize -resolution 1024x768 -natural -autoboot_delay 2 -autoboot_command "runm\"f\n"
# cd ~/mame_coco;mame coco3 -window -nomaximize -resolution 1024x768 -natural -autoboot_delay 1
# cd ~/mame_coco;mame coco -window -natural -autoboot_delay 2 -autoboot_command "dos\n" -flop1 $(CURDIR)/$(DSK)
# -killall -q wine64-preloader;wine64 ~/Downloads/vcc-2.1.9.0/vcc.exe $(TARGET_EXEC).bin
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) intermediates
$(MKDIR_P) $(dir $@)
$(CC) $(CFLAGS) -o $@ -c $<
# assy source
$(BUILD_DIR)/%.s.o: %.s
$(MKDIR_P) $(dir $@)
$(ASM) $(ASFLAGS) -fobj --output=$@ $<
.PHONY: clean
clean:
# $(RM) -r $(TARGET_EXEC).*
$(RM) -r $(BUILD_DIR)*
cd support/coco/gen;make
-include $(DEPS)
MKDIR_P ?= mkdir -p