FoenixMCP/src/Makefile

121 lines
3.5 KiB
Makefile
Raw Normal View History

#
# User may over-ride the UNIT and MEMORY parameters to specify target machine
# and where the MCP will run (ram or flash)
#
UNIT := a2560k
MEMORY := ram
# CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */
# CPU_M68000 0x20 /* CPU code for the Motorola 68000 */
# CPU_M68010 0x21 /* CPU code for the Motorola 68010 */
# CPU_M68020 0x22 /* CPU code for the Motorola 68020 */
# CPU_M68030 0x23 /* CPU code for the Motorola 68030 */
# CPU_M68040 0x24 /* CPU code for the Motorola 68040 */
# CPU_I486DX 0x34 /* CPU code for the Intel 486DX */
# MODEL_FOENIX_FMX 0
# MODEL_FOENIX_C256U 1
# MODEL_FOENIX_GENX 4
# MODEL_FOENIX_C256U_PLUS 5
# MODEL_FOENIX_A2560U_PLUS 6
# MODEL_FOENIX_A2560X 8
# MODEL_FOENIX_A2560U 9
# MODEL_FOENIX_A2560K 13
# Determine target CPU and MODEL based on the UNIT
ifeq ($(UNIT),a2560k)
export CPU_NUMBER = 36 # M68040
export VASM_CPU = -m68040 # VASM CPU flag
export VBCC_CPU = 68040 # VBCC CPU flag
export MODEL_NUMBER = 13 # A2560K
export cpu = m68040
else ifeq ($(UNIT),a2560u)
export CPU_NUMBER = 32 # M68000
export VASM_CPU = -m68000 # VASM CPU flag
export VBCC_CPU = 68000 # VBCC CPU flag
export MODEL_NUMBER = 9 # A2560U
export CFG_FILE = $(VBCC)/config/a2560u_ram
export cpu = m68k
endif
# Determine the correct configuration file (barring OS)
ifeq ($(MEMORY),ram)
export CFG_FILE = $(VBCC)/config/$(UNIT)_ram
else
export CFG_FILE = $(VBCC)/config/$(UNIT)_flash
endif
export AS = vasmm68k_mot
export ASFLAGS = $(VASM_CPU) -quiet -Fvobj -nowarn=62
export CC = vc
export DEFINES = -DCPU=$(CPU_NUMBER) -DMODEL=$(MODEL_NUMBER) # -DKBD_POLLED
2021-11-06 11:28:34 -04:00
ifeq ($(OS),Windows_NT)
export CFLAGS = -cpu=$(VBCC_CPU) +$(CFG_FILE) -I. -I$(CURDIR)/include -I$(CURDIR)
2021-11-06 11:28:34 -04:00
export RM = cmd /C del /Q /F
else
export CFLAGS = -cpu=$(VBCC_CPU) +$(CFG_FILE)_linux -I. -I$(CURDIR)/include -I$(CURDIR)
2021-11-06 11:28:34 -04:00
export RM = rm -f
endif
2021-08-30 10:24:51 -04:00
cpu_assembly_src := $(wildcard $(cpu)/*.s)
cpu_c_src := $(wildcard $(cpu)/*.c)
cpu_assembly_obj := $(subst .s,.o,$(cpu_assembly_src))
cpu_c_obj := $(subst .c,.o,$(cpu_c_src))
dev_base_sources = dev/block.c dev/channel.c dev/console.c dev/fsys.c dev/pata.c dev/ps2.c dev/rtc.c dev/sdc.c dev/txt_screen.c dev/uart.c
ifeq ($(UNIT),a2560k)
dev_c_src := $(dev_base_sources) dev/fdc.c dev/kbd_mo.c dev/lpt.c dev/midi.c dev/txt_a2560k_a.o dev/txt_a2560k_b.o
else
dev_c_src := $(dev_base_sources)
endif
dev_c_obj := $(subst .c,.o,$(dev_c_src))
snd_c_src := $(wildcard snd/*.c)
snd_c_obj := $(subst .c,.o,$(snd_c_src))
2021-09-14 18:23:33 -04:00
fat_c_src := $(wildcard fatfs/*.c)
fat_c_obj := $(subst .c,.o,$(fat_c_src))
cli_c_src := $(wildcard cli/*.c)
cli_c_obj := $(subst .c,.o,$(cli_c_src))
c_src := $(wildcard *.c)
c_obj := $(subst .c,.o,$(c_src))
.PHONY: all $(cpu) dev fatfs snd cli
all: foenixmcp.s68 $(cpu) dev snd cli
$(cpu):
$(MAKE) --directory=$@
dev:
$(MAKE) --directory=dev
2021-09-14 18:23:33 -04:00
fatfs:
$(MAKE) --directory=fatfs
snd:
$(MAKE) --directory=snd
cli:
$(MAKE) --directory=cli
foenixmcp.s68: $(c_obj) $(cpu) dev fatfs snd cli
$(CC) $(CFLAGS) $(DEFINES) -o foenixmcp.s68 $(c_obj) $(cpu_c_obj) $(dev_c_obj) $(fat_c_obj) $(snd_c_obj) $(cli_c_obj)
2021-08-30 10:24:51 -04:00
%.o: %.c $(DEPS)
2021-10-16 15:11:23 -04:00
$(CC) -S -c -o $@ $< $(CFLAGS) $(DEFINES)
2021-08-30 10:24:51 -04:00
.PHONEY: clean
2021-08-30 10:24:51 -04:00
clean:
$(RM) *.s68 *.o *.asm
$(MAKE) --directory=$(cpu) clean
$(MAKE) --directory=dev clean
$(MAKE) --directory=fatfs clean
$(MAKE) --directory=snd clean
$(MAKE) --directory=cli clean