2008-01-08 00:19:24 +01:00
|
|
|
############################################################################
|
|
|
|
# arch/z16/src/Makefile
|
|
|
|
#
|
|
|
|
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
|
|
|
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in
|
|
|
|
# the documentation and/or other materials provided with the
|
|
|
|
# distribution.
|
|
|
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
# used to endorse or promote products derived from this software
|
|
|
|
# without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
-include $(TOPDIR)/Make.defs
|
|
|
|
-include chip/Make.defs
|
|
|
|
|
2008-01-12 18:37:22 +01:00
|
|
|
COMPILER = ${shell basename $(CC)}
|
2008-01-08 20:45:13 +01:00
|
|
|
ARCHSRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
2008-01-12 18:37:22 +01:00
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
2008-01-08 20:45:13 +01:00
|
|
|
WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)}
|
2008-01-11 23:40:09 +01:00
|
|
|
USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR);$(WARCHSRCDIR)\common'
|
2008-01-12 18:37:22 +01:00
|
|
|
else
|
|
|
|
WARCHSRCDIR = $(ARCHSRCDIR)
|
|
|
|
USRINCLUDES = -I$(TOPDIR)/sched -I$(ARCHSRCDIR) -I$(ARCHSRCDIR)/common
|
|
|
|
endif
|
2008-01-08 18:06:21 +01:00
|
|
|
INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
|
|
|
|
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES)
|
2008-01-11 01:02:55 +01:00
|
|
|
CPPFLAGS += -I$(ARCHSRCDIR)
|
2008-01-12 18:37:22 +01:00
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
2008-01-10 22:10:30 +01:00
|
|
|
LDFLAGS = @"${shell cygpath -w $(ARCHSRCDIR)/nuttx.linkcmd}"
|
2008-01-12 18:37:22 +01:00
|
|
|
endif
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2008-01-10 22:10:30 +01:00
|
|
|
HEAD_ASRC = $(HEAD_SSRC:.S=$(ASMEXT))
|
|
|
|
HEAD_AOBJ = $(HEAD_SSRC:.S=$(OBJEXT))
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2008-01-10 22:10:30 +01:00
|
|
|
SSRCS = $(CHIP_SSRCS) $(CMN_SSRCS)
|
|
|
|
ASRCS = $(SSRCS:.S=$(ASMEXT))
|
|
|
|
AOBJS = $(SSRCS:.S=$(OBJEXT))
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
|
|
|
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
|
|
|
|
2008-01-10 22:10:30 +01:00
|
|
|
DEPSRCS = $(SSRCS) $(CSRCS)
|
2008-01-08 00:19:24 +01:00
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
|
|
|
|
|
|
|
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
|
|
|
|
|
|
|
|
VPATH = chip:common
|
|
|
|
|
|
|
|
all: $(HEAD_OBJ) libarch$(LIBEXT)
|
|
|
|
|
2008-01-12 18:37:22 +01:00
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
2008-01-10 22:10:30 +01:00
|
|
|
$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
|
|
|
|
@$(CPP) $(CPPFLAGS) $< -o $@.tmp
|
|
|
|
@cat $@.tmp | sed -e "s/^#/;/g" > $@
|
|
|
|
@rm $@.tmp
|
|
|
|
|
|
|
|
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %$(ASMEXT)
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2008-01-12 18:37:22 +01:00
|
|
|
else
|
|
|
|
$(OBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
|
|
|
|
$(call ASSEMBLE, $<, $@)endif
|
|
|
|
endif
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
$(COBJS): %$(OBJEXT): %.c
|
2008-01-12 18:37:22 +01:00
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
|
|
|
$(call COMPILE, `cygpath -w $<`, $@)
|
|
|
|
else
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call COMPILE, $<, $@)
|
2008-01-12 18:37:22 +01:00
|
|
|
endif
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
libarch$(LIBEXT): $(OBJS)
|
|
|
|
@( for obj in $(OBJS) ; do \
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call ARCHIVE, $@, $${obj}); \
|
2008-01-08 00:19:24 +01:00
|
|
|
done ; )
|
|
|
|
|
|
|
|
board/libboard$(LIBEXT):
|
2008-01-10 19:16:20 +01:00
|
|
|
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT)
|
|
|
|
|
2008-01-12 18:37:22 +01:00
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
2008-01-10 19:40:16 +01:00
|
|
|
nuttx.linkcmd: $(LINKCMDTEMPLATE)
|
2008-01-10 19:16:20 +01:00
|
|
|
@cp -f $(LINKCMDTEMPLATE) nuttx.linkcmd
|
|
|
|
@echo "\"${shell cygpath -w $(TOPDIR)/nuttx}\"= \\" >>nuttx.linkcmd
|
|
|
|
@echo " ${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_AOBJ)}, \\" >>nuttx.linkcmd
|
2008-01-10 19:40:16 +01:00
|
|
|
@( for lib in $(LINKLIBS); do \
|
|
|
|
echo " `cygpath -w $(TOPDIR)/$${lib}`, \\" >>nuttx.linkcmd; \
|
2008-01-10 19:16:20 +01:00
|
|
|
done ; )
|
|
|
|
@echo " ${shell cygpath -w $(ARCHSRCDIR)/board/libboard$(LIBEXT)}" >>nuttx.linkcmd
|
2008-01-12 18:37:22 +01:00
|
|
|
else
|
|
|
|
nuttx.linkcmd:
|
|
|
|
endif
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2008-01-10 19:16:20 +01:00
|
|
|
nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd
|
2008-01-10 22:10:30 +01:00
|
|
|
@echo "LD: nuttx.hex"
|
2008-01-10 19:16:20 +01:00
|
|
|
@$(LD) $(LDFLAGS)
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2008-01-10 22:10:30 +01:00
|
|
|
.depend: Makefile chip/Make.defs $(DEPSRCS)
|
2008-01-08 00:19:24 +01:00
|
|
|
@if [ -e board/Makefile ]; then \
|
2008-01-08 14:02:47 +01:00
|
|
|
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \
|
2008-01-08 00:19:24 +01:00
|
|
|
fi
|
2008-01-10 22:10:30 +01:00
|
|
|
@$(MKDEP) --dep-path chip --dep-path common $(CC) -- $(CFLAGS) -- $(DEPSRCS) >Make.dep
|
2008-01-08 00:19:24 +01:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
depend: .depend
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@if [ -e board/Makefile ]; then \
|
2008-01-08 14:02:47 +01:00
|
|
|
$(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \
|
2008-01-08 00:19:24 +01:00
|
|
|
fi
|
2008-01-12 18:37:22 +01:00
|
|
|
@rm -f libarch$(LIBEXT) *~ .*.swp
|
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
|
|
|
@rm -f nuttx.linkcmd *.asm *.tmp *.map
|
|
|
|
endif
|
2008-01-10 14:38:13 +01:00
|
|
|
$(call CLEAN)
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
@if [ -e board/Makefile ]; then \
|
2008-01-08 14:02:47 +01:00
|
|
|
$(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ; \
|
2008-01-08 00:19:24 +01:00
|
|
|
fi
|
|
|
|
@rm -f Make.dep .depend
|
|
|
|
|
|
|
|
-include Make.dep
|