Skip to content

Commit 66c17b6

Browse files
authored
Fix ups for cc65 and cmoc with xcode installed (#44)
* Fix cmoc compilation with Xcode SDK - Remove direct includes of cmoc.h and coco.h from fujinet-fuji.h - Define bool and integer types using macros for CMOC builds - Avoid including system headers that conflict with cmoc target - Add -D_CMOC_VERSION_=1 flag to compiler-cmoc.mk This fixes the issue where cmoc was picking up macOS Xcode headers instead of cmoc-compatible headers, causing preprocessor errors. * Fix cc65 cpu.mac multiple inclusion error - Create common/inc/cpu.inc with include guard for cpu macros - Update apple2/apple2-6502/bus/sp_init.s to use guarded include - Prevents 'Symbol already defined' errors when cpu.mac is included multiple times This fixes the issue where ca65 was redefining CPU_ISET_* symbols during compilation of assembly files. * Fix cpu.inc guard to check for actual CPU symbol - Change guard from checking __CPU_INC_INCLUDED__ to CPU_ISET_NONE - This properly detects if cpu.mac has already been included - Fixes the 'Symbol already defined' errors for all apple2 targets The issue was that .ifndef __CPU_INC_INCLUDED__ didn't prevent the .macpack cpu from being executed multiple times, since the CPU symbols are defined with = (assignment) not .define. Checking for CPU_ISET_NONE (which is defined by cpu.mac) properly guards against multiple inclusion. * Add GNU Make 4.0+ version check to Makefile - Require GNU Make 4.0 or later for $(file ...) function support - Display helpful error message on macOS directing users to use 'gmake' - Fixes issue where VERSION_STRING was empty with old make 3.81 - Ensures version numbers appear in dist filenames (e.g., fujinet-lib-apple2-4.8.0.zip) Users on macOS should use 'gmake' instead of 'make' for proper version handling.
1 parent 89e23c6 commit 66c17b6

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
# Set the TARGETS and PROGRAM values as required.
44
# See makefiles/build.mk for details on directory structure for src files and how to add custom extensions to the build.
55

6-
TARGETS = adam apple2 apple2enh atari c64 coco msdos
6+
# Require GNU Make 4.0 or later for $(file ...) function
7+
ifeq ($(filter 4.%,$(MAKE_VERSION)),)
8+
$(error This Makefile requires GNU Make 4.0 or later. You are using $(MAKE_VERSION). Please use 'gmake' instead of 'make' on macOS.)
9+
endif
10+
11+
TARGETS = apple2 apple2enh atari c64 coco
712
PROGRAM := fujinet.lib
813

914
SUB_TASKS := clean disk test release unit-test

apple2/apple2-6502/bus/sp_init.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
.include "macros.inc"
1212
.include "zp.inc"
13-
.macpack cpu
13+
.include "cpu.inc"
1414

1515
; Find the SmartPort device that has a FujiNet NETWORK adapter on it.
1616
; Really we should search for the FUJI device on it, but historically that was

common/inc/cpu.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
; Guard to prevent multiple inclusion of cpu macros
2+
; Check if CPU_ISET_NONE is already defined (from cpu.mac)
3+
.ifndef CPU_ISET_NONE
4+
5+
.macpack cpu
6+
7+
.endif

fujinet-fuji.h

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,25 @@
66
// In general, bools return the "success" status, so true is good, false is bad.
77

88
#ifdef _CMOC_VERSION_
9-
#include <cmoc.h>
10-
#include <coco.h>
11-
12-
#ifndef bool
13-
#define bool _FNBool
14-
typedef unsigned char _FNBool;
15-
#endif /* bool */
16-
17-
#define true 1
18-
#define false 0
9+
// CMOC-specific types and definitions
10+
#ifndef bool
11+
#define bool unsigned char
12+
#endif /* bool */
13+
14+
#define true 1
15+
#define false 0
16+
17+
// Define standard integer types for CMOC
18+
#define uint8_t unsigned char
19+
#define int8_t signed char
20+
#define uint16_t unsigned short
21+
#define int16_t signed short
22+
#define uint32_t unsigned long
23+
#define int32_t signed long
1924
#else
20-
#include <stddef.h>
21-
#include <stdbool.h>
22-
#include <stdint.h>
25+
#include <stddef.h>
26+
#include <stdbool.h>
27+
#include <stdint.h>
2328
#endif /* _CMOC_VERSION_ */
2429

2530
#ifdef __CBM__

makefiles/compiler-cmoc.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CC := cmoc
22
AR := lwar
3-
CFLAGS := -O2
3+
CFLAGS := -O2 -D_CMOC_VERSION_=1
44

55
INCC_ARG := -I
66
INCS_ARG := -I

0 commit comments

Comments
 (0)