nuttx/arch/z80/src/z180/Toolchain.defs
chao.an fc3565e9eb arch/z80: Unify the toolchain definition of SDCC for linux and windows
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-19 23:17:27 +08:00

110 lines
3.4 KiB
Plaintext

############################################################################
# arch/z80/src/z180/Toolchain.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
# Setup for the selected toolchain
#
# SDCC is currently the only z180 toolchain supported. See
# http://sdcc.sourceforge.net/. Source and pre-built SDCC binaries can be
# downloaded from the SDCC SourceForge site:
# http://sourceforge.net/projects/sdcc/files/. Pre-built binaries are
# available for Linux, macOS, and for Win32. In addition, SDCC can be
# built to run on Windows as a POSIX toolchain. The various SDCC options
# are selected in the NuttX configuration with:
#
# CONFIG_Z180_TOOLCHAIN_SDCC=y : Win32, SDCC for Linux, macOS or Cygwin
#
# These are the directories where the SDCC toolchain is installed. NOTE
# that short 8.3 path names are used in order to avoid spaces. On my machine
# I have:
#
# C:\PROGRA~1\ = C:\Profram Files\
# C:\PROGRA~2\ = C:\Program Files (x86)\
#
# Your PC may be configured differently.
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\z180
else
SDCC_INSTALLDIR = /usr/local
SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/z180
endif
ARCHCPUFLAGS = -mz180
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = --debug
endif
SDCCLIB = z180.lib
# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
# compiler to assemble files because this has the advantage of running the C
# Pre-Processor against. This is not possible with other SDCC; we need to
# define AS and over-ride the common definition in order to use the assembler
# directly.
define ASSEMBLE
@echo "AS: $1"
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) $2 $1
endef
# Custom CLEAN definition
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
define CLEAN
$(Q) if exist *.o (del /f /q *.o)
$(Q) if exist *.asm (del /f /q *.asm)
$(Q) if exist *.rel (del /f /q *.rel)
$(Q) if exist *.lst (del /f /q *.lst)
$(Q) if exist *.rst (del /f /q *.rst)
$(Q) if exist *.sym (del /f /q *.sym)
$(Q) if exist *.adb (del /f /q *.adb)
$(Q) if exist *.lnk (del /f /q *.lnk)
$(Q) if exist *.map (del /f /q *.map)
$(Q) if exist *.mem (del /f /q *.mem)
$(Q) if exist *.hex (del /f /q *.hex)
$(Q) if exist *.cmd (del /f /q *.cmd)
endef
else
define CLEAN
$(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
endef
endif
# Tool names/paths
CC = sdcc
CPP = sdcpp
LD = sdldz80
AS = sdasz80
AR = sdar -r
# File extensions
ASMEXT = .asm
OBJEXT = .rel
LIBEXT = .lib
EXEEXT = .hex