diff options
Diffstat (limited to 'nuttx/arch/z80/src/Makefile')
-rw-r--r-- | nuttx/arch/z80/src/Makefile | 186 |
1 files changed, 5 insertions, 181 deletions
diff --git a/nuttx/arch/z80/src/Makefile b/nuttx/arch/z80/src/Makefile index c5f77d180..39c569783 100644 --- a/nuttx/arch/z80/src/Makefile +++ b/nuttx/arch/z80/src/Makefile @@ -40,186 +40,10 @@ -include chip/Make.defs ############################################################################ -# Tools -# CFLAGS, CPPFLAGS, ASFLAGS, LDFLAGS are set in $(TOPDIR)/Make.defs - -CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(TOPDIR)/sched -CPPFLAGS += -D__ASSEMBLY__ - -############################################################################ -# Files and directories - -# There should be one head source (.asm file) - -HEAD_AOBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT)) - -# Assembly sources and objects - -ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS) -AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT)) - -# C sources and objects - -CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -# All sources and objcts - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -# Sources that can have dependencies (no .asm files) - -DEPSRCS = $(CSRCS) - -# Directories - -ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src -BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board - -VPATH = chip:common - -# Libraries - -LIBGCC = ${shell $(CC) -print-libgcc-file-name} - -# Supports dynamic sizing of HEAP. -# -HEAP_BASE = ${shell ./mkhpbase.sh} - -############################################################################ -# Targets - -all: $(HEAD_AOBJ) libarch$(LIBEXT) - -$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %$(ASMEXT) - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -# This is a kludge to work around some conflicting symbols in libsdcc.liXqueb - -$(SDCCLIBDIR)/myz80.lib: $(SDCCLIBDIR)/$(SDCCLIB) - @cat $(SDCCLIBDIR)/$(SDCCLIB) | \ - grep -v alloc | grep -v free | grep -v printf | \ - grep -v _str | grep -v _mem | grep -v crt0\.o \ - > myz80.lib - @sudo mv -f myz80.lib $(SDCCLIBDIR)/myz80.lib - -# Create a header file that contains addressing information needed by the code - -up_mem.h: - @echo "#ifndef __ARCH_MEM_H" >up_mem.h - @echo "#define __ARCH_MEM_H" >>up_mem.h - @echo "" >>up_mem.h - @echo "#define UP_STACK_END $(CONFIG_DRAM_SIZE)" >> up_mem.h - @echo "#define UP_STACK_BASE (UP_STACK_END - $(CONFIG_PROC_STACK_SIZE))" >> up_mem.h - @echo "#define UP_HEAP1_END UP_STACK_BASE" >> up_mem.h - @echo "#define UP_HEAP1_BASE $(HEAP_BASE)" >> up_mem.h - @echo "" >>up_mem.h - @echo "#endif /* __ARCH_MEM_H */" >>up_mem.h - -asm_mem.h: - @echo " UP_COMPILER_OTHER == 0" > asm_mem.h - @echo " UP_COMPILER_SDCC == 1" >> asm_mem.h -ifeq ($(CC),sdcc) - @echo " UP_COMPILER == 1" >> asm_mem.h +# Compiler-Dependent Make +COMPILER = ${shell basename $(CC)} +ifeq ($(COMPILER),sdcc) +include Makefile.sdcc else - @echo " UP_COMPILER == 0" >> asm_mem.h +include Makefile.zdsii endif - @echo " UP_STACK_END == ($(CONFIG_DRAM_SIZE) - 1)" >> asm_mem.h - @echo " UP_STACK_BASE == (UP_STACK_END - $(CONFIG_PROC_STACK_SIZE))" >> asm_mem.h - @echo " UP_HEAP1_END == (UP_STACK_END - $(CONFIG_PROC_STACK_SIZE) - 1)" >> asm_mem.h - @echo " UP_HEAP1_BASE == $(HEAP_BASE)" >> asm_mem.h - -# Combine all objects in this directory into a library - -libarch$(LIBEXT): up_mem.h asm_mem.h $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $@, $${obj}); \ - done ; ) - -# This builds the libboard library in the board/ subdirectory - -board/libboard$(LIBEXT): - $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) - -# This target builds the final executable - -pass1.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboard$(LIBEXT) - @echo "LD: pass1.ihx" - @echo "--" >pass1.lnk # Non-interactive - @echo "-k $(BOARDDIR)" >>pass1.lnk # Path to board library - @echo "-k $(SDCCLIBDIR)" >>pass1.lnk # Path to SDCC z80 library - @echo "-l libboard$(LIBEXT)" >>pass1.lnk # Name of board library - @for LIB in $(LINKLIBS); do \ - echo "-l $(TOPDIR)/$$LIB" >> pass1.lnk ;\ - done - @echo "-l myz80.lib" >>pass1.lnk # Name of SDCC z80 library - @echo "-b START=0" >>pass1.lnk # Start of START area - @echo "-b _CODE=256" >>pass1.lnk # Start of _CODE area - @echo "-i" >>pass1.lnk # Intel hex format - @echo "-x" >>pass1.lnk # Hexadecimal - @echo "-m" >>pass1.lnk # Generate a map file - @echo "-j" >>pass1.lnk # Generate a symbol file - @echo "pass1.ihx" >>pass1.lnk # Path to head object - @echo "$(HEAD_AOBJ)" >>pass1.lnk # Path to head object - @echo "-e" >>pass1.lnk # End of script - @$(LD) -f pass1.lnk - @rm -f up_mem.h asm_mem.h - @rm -f up_allocateheap$(OBJEXT) $(HEAD_AOBJ) libarch$(LIBEXT) - @$(MAKE) TOPDIR="$(TOPDIR)" libarch$(LIBEXT) - @$(MAKE) TOPDIR="$(TOPDIR)" $(HEAD_AOBJ) - -nuttx.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboard$(LIBEXT) - @echo "LD: nuttx.ihx" - @echo "--" >nuttx.lnk # Non-interactive - @echo "-k $(BOARDDIR)" >>nuttx.lnk # Path to board library - @echo "-k $(SDCCLIBDIR)" >>nuttx.lnk # Path to SDCC z80 library - @echo "-l libboard$(LIBEXT)" >>nuttx.lnk # Name of board library - @for LIB in $(LINKLIBS); do \ - echo "-l $(TOPDIR)/$$LIB" >> nuttx.lnk ;\ - done - @echo "-l myz80.lib" >>nuttx.lnk # Name of SDCC z80 library - @echo "-b START=0" >>nuttx.lnk # Start of START area - @echo "-b _CODE=256" >>nuttx.lnk # Start of _CODE area - @echo "-i" >>nuttx.lnk # Intel hex format - @echo "-x" >>nuttx.lnk # Hexadecimal - @echo "-m" >>nuttx.lnk # Generate a map file - @echo "-j" >>nuttx.lnk # Generate a symbol file - @echo "nuttx.ihx" >>nuttx.lnk # Path to head object - @echo "$(HEAD_AOBJ)" >>nuttx.lnk # Path to head object - @echo "-e" >>nuttx.lnk # End of script - @$(LD) -f nuttx.lnk - -nuttx$(EXEEXT): pass1.ihx nuttx.ihx - @rm -f pass1.* - @packihx nuttx.ihx > $(TOPDIR)/nuttx$(EXEEXT) - @cp -f nuttx.map $(TOPDIR)/. - -# Build dependencies - -.depend: Makefile up_mem.h asm_mem.h chip/Make.defs $(DEPSRCS) - @if [ -e board/Makefile ]; then \ - $(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \ - fi - @$(MKDEP) --dep-path chip --dep-path common $(CC) -- $(CFLAGS) -- $(DEPSRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - @if [ -e board/Makefile ]; then \ - $(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \ - fi - @rm -f libarch$(LIBEXT) up_mem.h asm_mem.h pass1.* nuttx.* *~ .*.swp - $(call CLEAN) - -distclean: clean - @if [ -e board/Makefile ]; then \ - $(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ; \ - fi - rm -f Make.dep .depend - --include Make.dep |