Skip to content

Commit abcf08e

Browse files
committed
Update to latest MekkoGX makefiles
1 parent 0c5ed08 commit abcf08e

File tree

15 files changed

+226
-21
lines changed

15 files changed

+226
-21
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.md

makefiles/common.mk

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@ PLATFORM := $(basename $(notdir $(lastword $(PLATFORM_MK))))
88
PLATFORM_UC := $(shell echo "$(PLATFORM)" | tr '[:lower:]' '[:upper:]')
99
$(info Building for PLATFORM=$(PLATFORM))
1010

11+
# Add GIT_VERSION macro define to CFLAGS, includes tag if available,
12+
# short commit hash, appends '*' if changes haven't been commited
13+
CFLAGS += -DGIT_VERSION='\"$(shell git rev-parse --short HEAD)$(shell git status --porcelain | grep -q '^[ MADRCU]' && echo '*')\"'
14+
1115
include $(MWD)/../Makefile
1216

17+
# Add GIT_VERSION macro define to CFLAGS, includes tag if available,
18+
# short commit hash, appends '*' if changes haven't been commited
19+
CFLAGS += -DGIT_VERSION='\"$(shell git rev-parse --short HEAD)$(shell git status --porcelain | grep -q '^[ MADRCU]' && echo '*')\"'
20+
1321
IS_LIBRARY := $(if $(filter %.lib,$(PRODUCT)),1,0)
1422
ifeq ($(IS_LIBRARY),1)
1523
PRODUCT_BASE = $(basename $(PRODUCT))
@@ -33,6 +41,10 @@ ifneq ($(strip $(LD_$(TOOLCHAIN_UC))),)
3341
LD_DEFAULT = $(LD_$(TOOLCHAIN_UC))
3442
endif
3543

44+
ifneq ($(strip $(PC_$(TOOLCHAIN_UC))),)
45+
PC_DEFAULT = $(PC_$(TOOLCHAIN_UC))
46+
endif
47+
3648
R2R_PD := $(R2R_DIR)/$(PLATFORM)
3749
OBJ_DIR := $(BUILD_DIR)/$(PLATFORM)
3850
CACHE_PLATFORM := $(CACHE_DIR)/$(PLATFORM)
@@ -60,16 +72,16 @@ SRC_DIRS_EXPANDED := $(call expand_platform_pattern,$(SRC_DIRS))
6072
CFILES := $(foreach dir,$(SRC_DIRS_EXPANDED),$(wildcard $(dir)/*.c))
6173
AFILES := $(foreach dir,$(SRC_DIRS_EXPANDED),$(wildcard $(dir)/*.s)) \
6274
$(foreach dir,$(SRC_DIRS_EXPANDED),$(wildcard $(dir)/*.asm))
75+
PFILES := $(foreach dir,$(SRC_DIRS_EXPANDED),$(wildcard $(dir)/*.pas))
6376

6477
# Need two steps: AFILES may be .s or .asm; `make` swaps one suffix at a time
6578
NORM_AFILES := $(AFILES:.asm=.s)
66-
OBJS := $(addprefix $(OBJ_DIR)/, $(notdir $(CFILES:.c=.o) $(NORM_AFILES:.s=.o)))
79+
OBJS := $(addprefix $(OBJ_DIR)/, $(notdir $(CFILES:.c=.o) $(NORM_AFILES:.s=.o) $(PFILES:.pas=.o)))
6780

6881
$(BUILD_EXEC):: $(OBJS) $(EXECUTABLE_EXTRA_DEPS_$(PLATFORM_UC)) | $(R2R_PD)
6982
$(call link-bin,$@,$(OBJS))
7083
@$(MAKE) -f $(PLATFORM_MK) $(PLATFORM)/executable-post
7184

72-
$(info LIBRARY=$(BUILD_LIB))
7385
$(BUILD_LIB):: $(OBJS) $(LIBRARY_EXTRA_DEPS_$(PLATFORM_UC)) | $(R2R_PD)
7486
$(call link-lib,$@,$(OBJS))
7587
@$(MAKE) -f $(PLATFORM_MK) $(PLATFORM)/library-post
@@ -85,10 +97,13 @@ $(OBJ_DIR)/%.o: %.s | $(OBJ_DIR)
8597
$(call assemble,$@,$<)
8698
$(OBJ_DIR)/%.o: %.asm | $(OBJ_DIR)
8799
$(call assemble,$@,$<)
100+
$(OBJ_DIR)/%.o: %.pas | $(OBJ_DIR)
101+
$(call compile-pas,$@,$<)
88102

89103
vpath %.c $(SRC_DIRS_EXPANDED)
90104
vpath %.s $(SRC_DIRS_EXPANDED)
91105
vpath %.asm $(SRC_DIRS_EXPANDED)
106+
vpath %.pas $(SRC_DIRS_EXPANDED)
92107

93108
.PHONY: clean debug r2r $(PLATFORM)/r2r disk $(PLATFORM)/disk
94109

makefiles/fnlib.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def getVersion(self):
201201
return
202202
if self.skipIfMissing:
203203
exit(0)
204-
error_exit(f"No library found for \"{self.PLATFORM}\"")
204+
#error_exit(f"No library found for \"{self.PLATFORM}\"")
205205

206206
# No version was specified, so any version is fine
207207
if self.MV.FUJINET_LIB_VERSION:
@@ -284,8 +284,7 @@ def gitClone(self, url):
284284
cmd.extend(["-b", branch])
285285
subprocess.run(cmd, cwd=FUJINET_CACHE_DIR, check=True)
286286

287-
possibleOutput = ["build", *[f"r2r/{p}"
288-
for p in self.possiblePlatforms.get(self.PLATFORM, [])]]
287+
possibleOutput = ["build", *[f"r2r/{p}" for p in self.possiblePlatforms]]
289288
self.findLibraryDir(repoDir, possibleOutput)
290289
if not self.MV.FUJINET_LIB_FILE:
291290
cmd = ["make", ]
@@ -305,7 +304,6 @@ def findLibraryDir(self, baseDir, dirsToCheck):
305304
raise ValueError("What platform?", rxm)
306305
self.MV.FUJINET_LIB_FILE = rxm.group(0)
307306
return rxm
308-
raise ValueError("No library dir")
309307
return None
310308

311309
def getInclude(self):
@@ -318,8 +316,9 @@ def getInclude(self):
318316
if os.path.exists(os.path.join(idir, "fujinet-fuji.h")):
319317
self.MV.FUJINET_LIB_INCLUDE = idir
320318
return
319+
if self.skipIfMissing:
320+
exit(0)
321321
raise ValueError("Unable to find include directory", self.MV.FUJINET_LIB_DIR)
322-
323322
return
324323

325324
def printMakeVariables(self):

makefiles/platforms/atari-pas.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
EXECUTABLE = $(R2R_PD)/$(PRODUCT_BASE).xex
2+
LIBRARY = $(R2R_PD)/$(PRODUCT_BASE).$(PLATFORM).lib
3+
4+
MWD := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))..)
5+
include $(MWD)/common.mk
6+
include $(MWD)/toolchains/madpas.mk
7+
8+
r2r:: $(BUILD_EXEC) $(BUILD_LIB) $(R2R_EXTRA_DEPS_$(PLATFORM_UC))
9+
make -f $(PLATFORM_MK) $(PLATFORM)/r2r-post

makefiles/platforms/atari.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ATRBOOT := $(CACHE_PLATFORM)/$(PICOBOOT_BIN)
1414

1515
$(BUILD_DISK): $(BUILD_EXEC) $(ATRBOOT) $(DISK_EXTRA_DEPS_$(PLATFORM_UC)) | $(R2R_PD)
1616
$(RM) $@
17+
$(RM) -rf $(CACHE_PLATFORM)/disk
1718
$(MKDIR_P) $(CACHE_PLATFORM)/disk
1819
cp $< $(CACHE_PLATFORM)/disk
1920
dir2atr -m -S -B $(ATRBOOT) $@ $(CACHE_PLATFORM)/disk

makefiles/platforms/c16.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
EXECUTABLE = $(R2R_PD)/$(PRODUCT_BASE).prg
2+
LIBRARY = $(R2R_PD)/$(PRODUCT_BASE).$(PLATFORM).lib
3+
4+
MWD := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))..)
5+
include $(MWD)/common.mk
6+
include $(MWD)/toolchains/cc65.mk
7+
8+
r2r:: $(BUILD_EXEC) $(BUILD_LIB) $(R2R_EXTRA_DEPS_$(PLATFORM_UC))
9+
make -f $(PLATFORM_MK) $(PLATFORM)/r2r-post

makefiles/platforms/pc6001.mk

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
EXECUTABLE = $(R2R_PD)/$(PRODUCT_BASE).ptp
2+
LIBRARY = $(R2R_PD)/$(PRODUCT_BASE).$(PLATFORM).lib
3+
AS_DEFAULT = zcc
4+
5+
MWD := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))..)
6+
include $(MWD)/common.mk
7+
include $(MWD)/toolchains/z88dk.mk
8+
9+
$(PLATFORM_UC)_FLAGS = +$(PLATFORM)
10+
CFLAGS += $($(PLATFORM_UC)_FLAGS)
11+
ASFLAGS += $($(PLATFORM_UC)_FLAGS) -c
12+
LDFLAGS += $($(PLATFORM_UC)_FLAGS)
13+
14+
r2r:: $(BUILD_EXEC) $(BUILD_LIB) $(R2R_EXTRA_DEPS_$(PLATFORM_UC))
15+
make -f $(PLATFORM_MK) $(PLATFORM)/r2r-post

makefiles/platforms/pmd85.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ MWD := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))..)
66
include $(MWD)/common.mk
77
include $(MWD)/toolchains/z88dk.mk
88

9-
PMD85_FLAGS = +pmd85
10-
CFLAGS += $(PMD85_FLAGS)
11-
ASFLAGS += $(PMD85_FLAGS) -c
12-
LDFLAGS += $(PMD85_FLAGS)
9+
$(PLATFORM_UC)_FLAGS = +$(PLATFORM)
10+
CFLAGS += $($(PLATFORM_UC)_FLAGS)
11+
ASFLAGS += $($(PLATFORM_UC)_FLAGS) -c
12+
LDFLAGS += $($(PLATFORM_UC)_FLAGS)
1313

1414
r2r:: $(BUILD_EXEC) $(BUILD_LIB) $(R2R_EXTRA_DEPS_$(PLATFORM_UC))
1515
make -f $(PLATFORM_MK) $(PLATFORM)/r2r-post

makefiles/platforms/vic20.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
EXECUTABLE = $(R2R_PD)/$(PRODUCT_BASE).prg
2+
LIBRARY = $(R2R_PD)/$(PRODUCT_BASE).$(PLATFORM).lib
3+
4+
MWD := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))..)
5+
include $(MWD)/common.mk
6+
include $(MWD)/toolchains/cc65.mk
7+
8+
r2r:: $(BUILD_EXEC) $(BUILD_LIB) $(R2R_EXTRA_DEPS_$(PLATFORM_UC))
9+
make -f $(PLATFORM_MK) $(PLATFORM)/r2r-post

makefiles/tc-common.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ CC_$(TOOLCHAIN_UC) ?= $(CC_DEFAULT)
88
AS_$(TOOLCHAIN_UC) ?= $(AS_DEFAULT)
99
LD_$(TOOLCHAIN_UC) ?= $(LD_DEFAULT)
1010
AR_$(TOOLCHAIN_UC) ?= $(AR_DEFAULT)
11+
PC_$(TOOLCHAIN_UC) ?= $(PC_DEFAULT)
1112

1213
CC := $(CC_$(TOOLCHAIN_UC))
1314
AS := $(AS_$(TOOLCHAIN_UC))
1415
LD := $(LD_$(TOOLCHAIN_UC))
1516
AR := $(AR_$(TOOLCHAIN_UC))
17+
PC := $(PC_$(TOOLCHAIN_UC))
1618

1719
EXTRA_INCLUDE_$(TOOLCHAIN_UC) += $(EXTRA_INCLUDE) $(EXTRA_INCLUDE_$(PLATFORM_UC))
1820
CFLAGS += $(CFLAGS_EXTRA_$(TOOLCHAIN_UC)) $(CFLAGS_EXTRA_$(PLATFORM_UC))

0 commit comments

Comments
 (0)