Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
PRODUCT = config
PLATFORMS = coco apple2 atari c64 adam pmd85
PLATFORMS = coco apple2 atari c64 adam

# Not currently in buildable state
#PLATFORMS += dragon
#PLATFORMS += msdos
#PLATFORMS += pc6001
#PLATFORMS += pc8801
#PLATFORMS += pmd85
#PLATFORMS += rc2014

# Require special toolchains
Expand All @@ -29,7 +30,7 @@ SRC_DIRS = src src/%PLATFORM%
# - a URL to a git repo
# - empty which will use whatever is the latest
# - undefined, no fujinet-lib will be used
FUJINET_LIB =
FUJINET_LIB = 4.7.9
$(info FUJUNET_LIB=$(FUJINET_LIB))

# Some platforms don’t use FUJINET_LIB; set this to allow builds to continue
Expand Down Expand Up @@ -93,6 +94,9 @@ apple2/disk-post::
########################################
# Atari customization

ATARI_LINKER_CFG = src/atari/atari.cfg
EXECUTABLE_EXTRA_DEPS_ATARI = $(ATARI_LINKER_CFG)
LDFLAGS_EXTRA_ATARI = -C $(ATARI_LINKER_CFG)
EXTRA_INCLUDE_ATARI = src/atari/asminc

########################################
Expand Down
22 changes: 14 additions & 8 deletions makefiles/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# Makefile Framework
# MekkoGX Modular Makefile Framework

This directory provides a modular framework of Makefiles.
[MekkoGX](https://github.com/fozzTexx/MekkoGX) is a cross-platform
build template for retro and classic computers. It provides a
collection of modular Makefiles and a top-level template project to
simplify compiling, linking, and building disk images across multiple
platforms.

The main goal is to make it easy to:

* Add new computer platforms by dropping in a new
platforms/<platform>.mk file.
* Avoid per-project hacks inside platform makefiles.
* Keep all project-specific customization in the top-level Makefile,
where it’s visible and easy to maintain.
* Easily switch between different FUJINET_LIB versions by setting a
single variable (supports directories, releases, or Git URLs).
* Keep platforms and toolchains fully modular: each uses a small .mk
file with shared logic in common.mk and tc-common.mk, making it
simple to add new platforms or toolchains.
* **Keep all project-specific customization in the top-level Makefile,
where it’s visible and easy to maintain.**

Think of this as a library of Makefiles.

Expand Down Expand Up @@ -117,7 +123,7 @@ With `SRC_DIRS = src src/%PLATFORM%`, building for `c64` would expand `%PLATFORM
- `src/commodore`
- `src/eightbit`

### The `r2r` Target
### The `r2r` "Ready 2 Run" Target

The `r2r` target is the **default build output** for a platform. It
will always build the platform’s executable. For some platforms, it
Expand Down
7 changes: 4 additions & 3 deletions makefiles/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ $(info Building for PLATFORM=$(PLATFORM))

include $(MWD)/../Makefile

# Add GIT_VERSION macro define to CFLAGS, includes tag if available,
# short commit hash, appends '*' if changes haven't been commited
CFLAGS += -DGIT_VERSION='"$(shell git rev-parse --short HEAD)$(shell git status --porcelain | grep -q '^[ MADRCU]' && echo '*')"'
# Define GIT_VERSION to be used in macro define to CFLAGS, includes
# tag if available, short commit hash, appends '*' if changes haven't
# been commited
GIT_VERSION := $(shell git rev-parse --short HEAD)$(shell git status --porcelain | grep -q '^[ MADRCU]' && echo '*')

IS_LIBRARY := $(if $(filter %.lib,$(PRODUCT)),1,0)
ifeq ($(IS_LIBRARY),1)
Expand Down
6 changes: 4 additions & 2 deletions makefiles/fnlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
VERSION_NUM_RE = r"([0-9]+[.][0-9]+[.][0-9]+)"
VERSION_NAME_RE = fr"v?{VERSION_NUM_RE}"
LDLIB_REGEX = r"lib(.*)[.]a$"
LDLIB_PLATFORMS = ["coco", "dragon", "msdos"]

# FIXME - this is really toolchains, not platforms
LDLIB_PLATFORMS = ["coco", "dragon"]

def build_argparser():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
Expand Down Expand Up @@ -265,7 +267,7 @@ def downloadZip(self):

return

error_exit("Unable to download FujiNet library from", release_url)
#error_exit("Unable to download FujiNet library from", release_url)
return

def gitClone(self, url):
Expand Down
6 changes: 4 additions & 2 deletions makefiles/toolchains/cc65.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ AR_DEFAULT ?= ar65

include $(MWD)/tc-common.mk

CFLAGS += -O --cpu 6502
ASFLAGS += --cpu 6502
CFLAGS +=
ASFLAGS +=
LDFLAGS +=

CFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"'

define include-dir-flag
--include-dir $1
endef
Expand Down
2 changes: 2 additions & 0 deletions makefiles/toolchains/cmoc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ CFLAGS += --intdir=$(OBJ_DIR)
ASFLAGS +=
LDFLAGS +=

CFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"'

# Needed because of using sed on error messages
SHELL = /bin/bash -o pipefail

Expand Down
5 changes: 4 additions & 1 deletion makefiles/toolchains/ow2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ AS_DEFAULT ?= wasm
LD_DEFAULT ?= wlink OPTION quiet

include $(MWD)/tc-common.mk
CFLAGS += -0 -bt=dos -ms -s -osh -zu

CFLAGS += -0 -bt=dos -ms -s -osh -zu -fr=$(basename $@).err
ASFLAGS +=
LDFLAGS += SYSTEM dos LIBPATH $(FUJINET_LIB_DIR)

CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"

define include-dir-flag
-I$1
endef
Expand Down
2 changes: 2 additions & 0 deletions makefiles/toolchains/z88dk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ CFLAGS +=
ASFLAGS +=
LDFLAGS +=

CFLAGS += -DGIT_VERSION='\"$(GIT_VERSION)\"'

define include-dir-flag
-I$1
endef
Expand Down