2008-01-08 00:19:24 +01:00
|
|
|
############################################################################
|
|
|
|
# arch/z16/src/Makefile
|
|
|
|
#
|
2020-04-30 05:41:57 +02:00
|
|
|
# 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
|
2008-01-08 00:19:24 +01:00
|
|
|
#
|
2020-04-30 05:41:57 +02:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2008-01-08 00:19:24 +01:00
|
|
|
#
|
2020-04-30 05:41:57 +02:00
|
|
|
# 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.
|
2008-01-08 00:19:24 +01:00
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2020-05-18 21:42:11 +02:00
|
|
|
include $(TOPDIR)/Make.defs
|
2021-07-21 18:48:05 +02:00
|
|
|
include chip/Make.defs
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2012-11-12 00:44:31 +01:00
|
|
|
COMPILER = ${shell basename "$(CC)"}
|
2012-11-11 14:52:31 +01:00
|
|
|
ARCHSRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
2012-11-29 17:48:29 +01:00
|
|
|
|
2022-11-01 14:47:53 +01:00
|
|
|
INCLUDES += ${INCDIR_PREFIX}$(ARCHSRCDIR)$(DELIM)chip
|
|
|
|
INCLUDES += ${INCDIR_PREFIX}$(ARCHSRCDIR)$(DELIM)common
|
|
|
|
INCLUDES += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)sched
|
2012-11-29 17:48:29 +01:00
|
|
|
|
2020-09-14 00:14:28 +02:00
|
|
|
CFLAGS += $(INCLUDES)
|
|
|
|
CPPFLAGS += $(INCLUDES)
|
2015-11-26 01:06:56 +01:00
|
|
|
|
2012-11-29 17:48:29 +01:00
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
2012-11-29 23:27:22 +01:00
|
|
|
LDFLAGS += @"$(ARCHSRCDIR)/nuttx.linkcmd"
|
2012-11-29 17:48:29 +01:00
|
|
|
else
|
2008-01-12 18:37:22 +01:00
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
2012-11-29 23:27:22 +01:00
|
|
|
LDFLAGS += @"${shell cygpath -w $(ARCHSRCDIR)/nuttx.linkcmd}"
|
2012-11-29 17:48:29 +01:00
|
|
|
endif
|
2008-01-12 18:37:22 +01:00
|
|
|
endif
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2012-11-11 14:52:31 +01:00
|
|
|
HEAD_ASRC = $(HEAD_SSRC:.S=$(ASMEXT))
|
|
|
|
HEAD_OBJ = $(HEAD_SSRC:.S=$(OBJEXT))
|
2014-09-04 21:31:34 +02:00
|
|
|
STARTUP_OBJS ?= $(HEAD_OBJ)
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2012-11-11 14:52:31 +01:00
|
|
|
SSRCS = $(CHIP_SSRCS) $(CMN_SSRCS)
|
|
|
|
ASRCS = $(SSRCS:.S=$(ASMEXT))
|
|
|
|
AOBJS = $(SSRCS:.S=$(OBJEXT))
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2012-11-11 14:52:31 +01:00
|
|
|
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
|
|
|
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2012-11-11 14:52:31 +01:00
|
|
|
DEPSRCS = $(SSRCS) $(CSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2012-11-11 14:52:31 +01:00
|
|
|
VPATH = chip:common
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
all: $(HEAD_OBJ) libarch$(LIBEXT)
|
|
|
|
|
2012-01-29 21:07:16 +01:00
|
|
|
.PHONY: board/libboard$(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
|
2012-11-16 15:13:04 +01:00
|
|
|
$(Q) $(CPP) $(CPPFLAGS) $< -o $@.tmp
|
|
|
|
$(Q) cat $@.tmp | sed -e "s/^#/;/g" > $@
|
|
|
|
$(Q) rm $@.tmp
|
2008-01-10 22:10:30 +01:00
|
|
|
|
2011-07-12 00:52:51 +02:00
|
|
|
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT)
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2008-01-12 18:37:22 +01:00
|
|
|
else
|
2011-07-12 00:52:51 +02:00
|
|
|
$(OBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
|
2008-01-13 16:31:26 +01:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2008-01-12 18:37:22 +01:00
|
|
|
endif
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
$(COBJS): %$(OBJEXT): %.c
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call COMPILE, $<, $@)
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
libarch$(LIBEXT): $(OBJS)
|
2012-11-15 18:43:29 +01:00
|
|
|
$(call ARCHIVE, $@, $(OBJS))
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
board/libboard$(LIBEXT):
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) $(MAKE) -C board libboard$(LIBEXT) EXTRAFLAGS="$(EXTRAFLAGS)"
|
2008-01-10 19:16:20 +01:00
|
|
|
|
2008-01-12 18:37:22 +01:00
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
2008-01-10 19:40:16 +01:00
|
|
|
nuttx.linkcmd: $(LINKCMDTEMPLATE)
|
2012-11-16 15:13:04 +01:00
|
|
|
$(Q) cp -f $(LINKCMDTEMPLATE) nuttx.linkcmd
|
2012-11-29 17:48:29 +01:00
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
2012-11-29 23:27:22 +01:00
|
|
|
@echo "$(TOPDIR)\nuttx"= \>>nuttx.linkcmd
|
2012-11-29 17:48:29 +01:00
|
|
|
@echo "$(ARCHSRCDIR)\$(HEAD_OBJ)", \>>nuttx.linkcmd
|
2018-05-29 19:36:21 +02:00
|
|
|
$(Q) for %%G in ($(LINKLIBS)) do ( echo "$(TOPDIR)\staging\%%G", \>>nuttx.linkcmd )
|
2012-11-29 17:48:29 +01:00
|
|
|
@echo "$(ARCHSRCDIR)\board\libboard$(LIBEXT)", \>>nuttx.linkcmd
|
|
|
|
@echo "$(ZDSSTDLIBDIR)\chelpld$(LIBEXT)", \>>nuttx.linkcmd
|
|
|
|
@echo "$(ZDSSTDLIBDIR)\fpld$(LIBEXT)">>nuttx.linkcmd
|
|
|
|
else
|
2008-01-10 19:16:20 +01:00
|
|
|
@echo "\"${shell cygpath -w $(TOPDIR)/nuttx}\"= \\" >>nuttx.linkcmd
|
2011-07-12 00:52:51 +02:00
|
|
|
@echo " \"${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_OBJ)}\", \\" >>nuttx.linkcmd
|
2012-11-16 15:13:04 +01:00
|
|
|
$(Q) ( for lib in $(LINKLIBS); do \
|
2018-05-29 19:36:21 +02:00
|
|
|
echo " \"`cygpath -w $(TOPDIR)/staging/$${lib}`\", \\" >>nuttx.linkcmd; \
|
2008-01-10 19:16:20 +01:00
|
|
|
done ; )
|
2008-02-03 14:54:33 +01:00
|
|
|
@echo " \"${shell cygpath -w $(ARCHSRCDIR)/board/libboard$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
|
|
|
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/chelpld$(LIBEXT)}\", \\" >>nuttx.linkcmd
|
|
|
|
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/fpld$(LIBEXT)}\"" >>nuttx.linkcmd
|
2012-11-29 17:48:29 +01:00
|
|
|
endif
|
2008-01-12 18:37:22 +01:00
|
|
|
else
|
|
|
|
nuttx.linkcmd:
|
|
|
|
endif
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2011-07-12 00:52:51 +02:00
|
|
|
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) nuttx.linkcmd
|
2012-11-14 16:55:07 +01:00
|
|
|
@echo "LD: nuttx$(EXEEXT)"
|
2012-11-16 15:13:04 +01:00
|
|
|
$(Q) $(LD) $(LDFLAGS)
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2020-07-22 09:54:29 +02:00
|
|
|
.depend: Makefile chip/Make.defs $(DEPSRCS) $(TOPDIR)$(DELIM).config
|
2012-11-29 23:27:22 +01:00
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board depend )
|
2012-11-29 23:27:22 +01:00
|
|
|
else
|
2012-11-16 15:13:04 +01:00
|
|
|
$(Q) if [ -e board/Makefile ]; then \
|
2020-09-14 18:53:37 +02:00
|
|
|
$(MAKE) -C board depend ; \
|
2008-01-08 00:19:24 +01:00
|
|
|
fi
|
2012-11-29 23:27:22 +01:00
|
|
|
endif
|
2020-03-23 03:44:03 +01:00
|
|
|
$(Q) $(MKDEP) --dep-path chip --dep-path common "$(CC)" -- $(CFLAGS) -- $(DEPSRCS) >Make.dep
|
|
|
|
$(Q) touch $@
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2011-07-12 00:52:51 +02:00
|
|
|
# This is part of the top-level export target
|
|
|
|
|
2022-05-12 12:41:27 +02:00
|
|
|
export_startup: $(STARTUP_OBJS)
|
2012-11-29 23:27:22 +01:00
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
2014-09-04 21:31:34 +02:00
|
|
|
$(Q) if exist "$(EXPORT_DIR)$(DELIM)startup" ( copy $(STARTUP_OBJS) "$(EXPORT_DIR)$(DELIM)startup$(DELIM)." /b /y)
|
2012-11-29 23:27:22 +01:00
|
|
|
else
|
2012-11-16 15:13:04 +01:00
|
|
|
$(Q) if [ -d "$(EXPORT_DIR)/startup" ]; then \
|
2014-09-04 21:31:34 +02:00
|
|
|
cp -f $(STARTUP_OBJS) "$(EXPORT_DIR)/startup"; \
|
2011-07-12 00:52:51 +02:00
|
|
|
else \
|
|
|
|
echo "$(EXPORT_DIR)/startup does not exist"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2012-11-29 23:27:22 +01:00
|
|
|
endif
|
2011-07-12 00:52:51 +02:00
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
|
2020-03-23 03:44:03 +01:00
|
|
|
depend: .depend
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2020-09-23 13:48:02 +02:00
|
|
|
context::
|
|
|
|
|
2008-01-08 00:19:24 +01:00
|
|
|
clean:
|
2012-11-29 23:27:22 +01:00
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board clean )
|
2012-11-29 23:27:22 +01:00
|
|
|
else
|
2012-11-16 15:13:04 +01:00
|
|
|
$(Q) if [ -e board/Makefile ]; then \
|
2020-09-14 18:53:37 +02:00
|
|
|
$(MAKE) -C board clean ; \
|
2008-01-08 00:19:24 +01:00
|
|
|
fi
|
2012-11-29 23:27:22 +01:00
|
|
|
endif
|
2008-01-12 18:37:22 +01:00
|
|
|
ifeq ($(COMPILER),zneocc.exe)
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, nuttx.linkcmd)
|
|
|
|
$(call DELFILE, *.asm)
|
|
|
|
$(call DELFILE, *.tmp)
|
|
|
|
$(call DELFILE, *.map)
|
2008-01-12 18:37:22 +01:00
|
|
|
endif
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, libarch$(LIBEXT))
|
2008-01-10 14:38:13 +01:00
|
|
|
$(call CLEAN)
|
2008-01-08 00:19:24 +01:00
|
|
|
|
2021-07-21 18:48:05 +02:00
|
|
|
distclean:: clean
|
2012-11-29 23:27:22 +01:00
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board distclean )
|
2012-11-29 23:27:22 +01:00
|
|
|
else
|
2012-11-16 15:13:04 +01:00
|
|
|
$(Q) if [ -e board/Makefile ]; then \
|
2020-09-14 18:53:37 +02:00
|
|
|
$(MAKE) -C board distclean ; \
|
2008-01-08 00:19:24 +01:00
|
|
|
fi
|
2012-11-29 23:27:22 +01:00
|
|
|
endif
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, Make.dep)
|
2020-03-23 03:44:03 +01:00
|
|
|
$(call DELFILE, .depend)
|
2008-01-08 00:19:24 +01:00
|
|
|
|
|
|
|
-include Make.dep
|