nes-proj/platform/pc-6001/Makefile.pc-6001

104 lines
2.8 KiB
Makefile

#
# Makefile for PC-6001 using z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org>
#
# $Id: Makefile.pc-6001,v 1.13 2009/12/16 06:47:18 matsutsuka Exp $
#
ifndef CONTIKI
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
endif
### setup default values
ifndef ARCH
ARCH=PC6001
endif
ifndef MEMORY
MEMORY=32K
endif
ifndef CONTIKI_TARGET_MAIN
CONTIKI_TARGET_MAIN = contiki-main.c
endif
ifndef CTKCONF
CTKCONF=NORMAL
endif
ifndef LOADER
LOADER=0
endif
ifndef HEX2BIN
HEX2BINDIR = ../../tools/z80/hex2bin/
HEX2BIN = $(HEX2BINDIR)/hexameter
endif
### setup flags to be used in compiler, assembler, and HEX2BIN
PLATFORM = $(CONTIKI)/platform/$(TARGET)
CONTIKI_TARGET_DIRS = . ctk dev loader
CFLAGS += -DMEMORY_$(MEMORY) -DARCH_$(ARCH) -DCTK_$(CTKCONF)
ifeq ($(MEMORY),16K)
LDFLAGS += --code-loc 0xc40f --data-loc 0
HEX2BINFLAGS = -d TAPE=contki $(HEX2BINDIR)/ihx/mode1.ihx -o contiki.p6
else ifeq ($(MEMORY),ROM)
LDFLAGS += --code-loc 0x4004 --data-loc 0xf000
HEX2BINFLAGS = -d ROMEXEC=4004 $(HEX2BINDIR)/ihx/rom60.ihx -b 4000 -o contiki.rom
else ifeq ($(ARCH),PC6001MK2)
LDFLAGS += --code-loc 0x800f --data-loc 0
HEX2BINFLAGS = -d TAPE=contki $(HEX2BINDIR)/ihx/mode5.ihx -o contiki2.p6
else
LDFLAGS += --code-loc 0x840f --data-loc 0
HEX2BINFLAGS = -d TAPE=contki $(HEX2BINDIR)/ihx/mode2.ihx -o contiki.p6
endif
ifeq ($(LOADER),1)
CFLAGS += -DWITH_LOADER_ARCH=1
endif
### Include platform-depend application makefiles
ifdef PLATFORM_APPS
PLATFORM_APPDIRS += ${addprefix $(PLATFORM)/apps/, $(PLATFORM_APPS)}
PLATFORM_APPINCLUDES = ${foreach APP, $(PLATFORM_APPS), $(PLATFORM)/apps/$(APP)/Makefile.$(APP)}
-include $(PLATFORM_APPINCLUDES)
PLATFORM_APP_SOURCES = ${foreach APP, $(PLATFORM_APPS), $($(APP)_src)}
PLATFORM_DSC_SOURCES = ${foreach APP, $(PLATFORM_APPS), $($(APP)_dsc)}
CONTIKI_SOURCEFILES += $(PLATFORM_APP_SOURCES) $(PLATFORM_DSC_SOURCES)
endif
CONTIKI_TARGET_SOURCEFILES = \
$(CTK) cfs-ram.c serial-line.c slip.c \
resolv.c loader_arch.c \
ctk-conio_arch.c $(CONTIKI_TARGET_MAIN)
#you can use the below instead of ctk-conio_arch.c, ctk-conio_arch-asm.cS,
# and libconio_arch-asm.cS
#ctk-conio_arch-source.c
CONTIKI_ASMFILES += getkey.S isprint_arch.S clock.S rs232-asm.S
CONTIKI_CASMFILES += ctk-conio_arch-asm.cS libconio_arch-asm.cS\
libconio_arch-small.cS
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
CLEAN += *.rom *.p6
contiki: $(HEX2BIN) contiki.p6
.SUFFIXES:
%.p6: %.ihx
$(HEX2BIN) $(HEX2BINFLAGS) $< $(HEX2BINDIR)/ihx/suffix.ihx
%.rom: %.ihx
$(HEX2BIN) $(HEX2BINFLAGS) $<
$(HEX2BIN):
cd $(HEX2BINDIR); make
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/cpu/z80
include $(CONTIKI_CPU)/Makefile.z80
### Setup directory search path for source files
PROJECTDIRS += $(PLATFORM_APPDIRS)