Skip to content

Commit

Permalink
Allow coco to build from same makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
markjfisher committed Jun 29, 2024
1 parent 2ccb0f1 commit 795b12a
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 262 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# Set the TARGETS and PROGRAM values as required.
# See makefiles/build.mk for details on directory structure for src files and how to add custom extensions to the build.

TARGETS = atari c64 apple2 apple2enh
#TARGETS = atari
TARGETS = atari c64 apple2 apple2enh coco
PROGRAM := fujinet.lib

SUB_TASKS := clean disk test release
Expand Down
214 changes: 0 additions & 214 deletions Makefile.coco

This file was deleted.

4 changes: 2 additions & 2 deletions atari/src/fn_fuji/fuji_appkey_open_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ bool fuji_read_appkey(uint8_t key_id, uint16_t *count, uint8_t *data)
open_data[4] = mode;
open_data[5] = 0; // reserved byte

copy_fuji_cmd_data(&t_fuji_open_appkey[0]);
copy_fuji_cmd_data(t_fuji_open_appkey);
OS.dcb.dbuf = open_data;
bus();
if (!fuji_success()) {
free(buffer);
return false;
}

copy_fuji_cmd_data(&t_fuji_read_appkey[0]);
copy_fuji_cmd_data(t_fuji_read_appkey);
OS.dcb.dbuf = buffer;
OS.dcb.dbyt = buffer_size + 2; // add 2 for count bytes
bus();
Expand Down
4 changes: 2 additions & 2 deletions atari/src/fn_fuji/fuji_appkey_open_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ bool fuji_write_appkey(uint8_t key_id, uint16_t count, uint8_t *data)
open_data[4] = 1; // WRITE mode
open_data[5] = 0; // reserved byte

copy_fuji_cmd_data((uint8_t *) &t_fuji_open_appkey[0]);
copy_fuji_cmd_data(t_fuji_open_appkey);
OS.dcb.dbuf = open_data;
bus();
if (!fuji_success()) return false;

copy_fuji_cmd_data(&t_fuji_write_appkey[0]);
copy_fuji_cmd_data(t_fuji_write_appkey);
OS.dcb.dbuf = data;
OS.dcb.dbyt = keysize; // we have to specify the 64/256/... value in dbyt
OS.dcb.daux = count; // ... but the count can be less in daux to tell the FN how much of the buffer needs to be written
Expand Down
2 changes: 1 addition & 1 deletion atari/src/include/fujinet-fuji-atari.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#include <stdint.h>

bool fuji_success();
extern uint8_t *t_fuji_open_appkey[];
extern uint8_t t_fuji_open_appkey[];

#endif // FUJINET_FUJI_ATARI_H
73 changes: 35 additions & 38 deletions makefiles/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ ALL_TASKS =
DISK_TASKS =

-include ./makefiles/os.mk
-include ./makefiles/compiler.mk

CC := cl65
# CC := cl65

SRCDIR := src
BUILD_DIR := build
Expand Down Expand Up @@ -43,14 +44,14 @@ OBJECTS := $(OBJECTS:common/$(SRCDIR)/%=$(OBJDIR)/$(CURRENT_TARGET)/common/%)
DEPENDS := $(OBJECTS:.o=.d)

ASFLAGS += \
--asm-include-dir common/inc \
--asm-include-dir $(PLATFORM_SRC_DIR)/include \
--asm-include-dir .
$(INCS_ARG) common/inc \
$(INCS_ARG) $(PLATFORM_SRC_DIR)/include \
$(INCS_ARG) .

CFLAGS += \
--include-dir common/inc \
--include-dir $(PLATFORM_SRC_DIR)/include \
--include-dir .
$(INCC_ARG) common/inc \
$(INCC_ARG) $(PLATFORM_SRC_DIR)/include \
$(INCC_ARG) .

FN_NW_HEADER = fujinet-network.h
FN_NW_INC = fujinet-network.inc
Expand All @@ -65,35 +66,12 @@ CHANGELOG = Changelog.md
# allow for application specific config
-include ./application.mk

define _listing_
CFLAGS += --listing $$(@:.o=.lst)
ASFLAGS += --listing $$(@:.o=.lst)
endef

define _mapfile_
LDFLAGS += --mapfile $$@.map
endef

define _labelfile_
LDFLAGS += -Ln $$@.lbl
endef

.SUFFIXES:
.PHONY: all clean release $(DISK_TASKS) $(BUILD_TASKS) $(PROGRAM_TGT) $(ALL_TASKS)
.PHONY: all clean release $(PROGRAM_TGT) $(ALL_TASKS)

all: $(ALL_TASKS) $(PROGRAM_TGT)

STATEFILE := Makefile.options
-include $(DEPENDS)
-include $(STATEFILE)

ifeq ($(origin _OPTIONS_),file)
OPTIONS = $(_OPTIONS_)
$(eval $(OBJECTS): $(STATEFILE))
endif

# Transform the abstract OPTIONS to the actual cc65 options.
$(foreach o,$(subst $(COMMA),$(SPACE),$(OPTIONS)),$(eval $(_$o_)))

ifeq ($(BUILD_DIR),)
BUILD_DIR := build
Expand Down Expand Up @@ -128,25 +106,44 @@ vpath %.c $(SRC_INC_DIRS)

$(OBJDIR)/$(CURRENT_TARGET)/common/%.o: %.c | $(TARGETOBJDIR)
@$(call MKDIR,$(dir $@))
$(CC) -t $(CURRENT_TARGET) -c --create-dep $(@:.o=.d) $(CFLAGS) -o $@ $<
ifeq ($(CC),cl65)
$(CC) -t $(CURRENT_TARGET) -c --create-dep $(@:.o=.d) $(CFLAGS) --listing $(@:.o=.lst) -Ln $@.lbl -o $@ $<
else
$(CC) -c --deps $(CFLAGS) -o $@ $< 2>/dev/null
endif

$(OBJDIR)/$(CURRENT_TARGET)/%.o: %.c $(VERSION_FILE) | $(OBJDIR)
@$(call MKDIR,$(dir $@))
ifeq ($(CC),cl65)
$(CC) -t $(CURRENT_TARGET) -c --create-dep $(@:.o=.d) $(CFLAGS) -o $@ $<
else
$(CC) -c --deps $(CFLAGS) -o $@ $< 2>/dev/null
endif

vpath %.s $(SRC_INC_DIRS)

$(OBJDIR)/$(CURRENT_TARGET)/common/%.o: %.s | $(TARGETOBJDIR)
@$(call MKDIR,$(dir $@))
$(CC) -t $(CURRENT_TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $<
## For now, no asm in common dirs... as it would be compiler specific
# $(OBJDIR)/$(CURRENT_TARGET)/common/%.o: %.s | $(TARGETOBJDIR)
# @$(call MKDIR,$(dir $@))
# ifeq ($(CC),cl65)
# $(CC) -t $(CURRENT_TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $<
# else
# endif

$(OBJDIR)/$(CURRENT_TARGET)/%.o: %.s $(VERSION_FILE) | $(OBJDIR)
@$(call MKDIR,$(dir $@))
$(CC) -t $(CURRENT_TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $<

ifeq ($(CC),cl65)
$(CC) -t $(CURRENT_TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) --listing $(@:.o=.lst) -Ln $@.lbl -o $@ $<
else
$(CC) -c --deps $(@:.o=.d) $(ASFLAGS) -o $@ $<
endif

$(BUILD_DIR)/$(PROGRAM_TGT): $(OBJECTS) | $(BUILD_DIR)
ar65 a $@ $(OBJECTS)
ifeq ($(CC),cl65)
$(AR) a $@ $(OBJECTS)
else
$(AR) $@ -a $(OBJECTS)
endif

$(PROGRAM_TGT): $(BUILD_DIR)/$(PROGRAM_TGT) | $(BUILD_DIR)

Expand Down
2 changes: 0 additions & 2 deletions makefiles/common.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
VERSION_FILE := version.txt
VERSION_STRING := $(file < $(VERSION_FILE))

CFLAGS += -Osir
Loading

0 comments on commit 795b12a

Please # to comment.