Board.mk 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ############################################################################
  2. # configs/Board.mk
  3. #
  4. # Copyright (C) 2015 Gregory Nutt. All rights reserved.
  5. # Copyright (C) 2015 Omni Hoverboards Inc. All rights reserved.
  6. # Author: Gregory Nutt <gnutt@nuttx.org>
  7. # Paul Alexander Patience <paul-a.patience@polymtl.ca>
  8. #
  9. # Redistribution and use in source and binary forms, with or without
  10. # modification, are permitted provided that the following conditions
  11. # are met:
  12. #
  13. # 1. Redistributions of source code must retain the above copyright
  14. # notice, this list of conditions and the following disclaimer.
  15. # 2. Redistributions in binary form must reproduce the above copyright
  16. # notice, this list of conditions and the following disclaimer in
  17. # the documentation and/or other materials provided with the
  18. # distribution.
  19. # 3. Neither the name NuttX nor the names of its contributors may be
  20. # used to endorse or promote products derived from this software
  21. # without specific prior written permission.
  22. #
  23. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  26. # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  27. # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  28. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  29. # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  30. # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  31. # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  33. # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. # POSSIBILITY OF SUCH DAMAGE.
  35. #
  36. ############################################################################
  37. -include $(TOPDIR)/Make.defs
  38. ifneq ($(ZDSVERSION),)
  39. AOBJS = $(ASRCS:.S=$(OBJEXT))
  40. else
  41. AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT))
  42. endif
  43. COBJS = $(CSRCS:.c=$(OBJEXT))
  44. CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
  45. SRCS = $(ASRCS) $(CSRCS)
  46. OBJS = $(AOBJS) $(COBJS)
  47. SCHEDSRCDIR = $(TOPDIR)$(DELIM)sched
  48. ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
  49. ifneq ($(CONFIG_ARCH_FAMILY),)
  50. ARCH_FAMILY = $(patsubst "%",%,$(CONFIG_ARCH_FAMILY))
  51. endif
  52. ifneq ($(ZDSVERSION),)
  53. ifeq ($(WINTOOL),y)
  54. WSCHEDSRCDIR = ${shell cygpath -w $(SCHEDSRCDIR)}
  55. WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)}
  56. USRINCLUDES = -usrinc:'.;$(WSCHEDSRCDIR);$(WARCHSRCDIR);$(WARCHSRCDIR)\common'
  57. else
  58. USRINCLUDES = -usrinc:".;$(SCHEDSRCDIR);$(ARCHSRCDIR);$(ARCHSRCDIR)\common"
  59. endif
  60. else
  61. ifeq ($(WINTOOL),y)
  62. CFLAGS += -I "${shell cygpath -w $(SCHEDSRCDIR)}"
  63. ifeq ($(CONFIG_ARCH_SIM),y)
  64. CFLAGS += -I "${shell cygpath -w $(ARCHSRCDIR)}"
  65. else
  66. CFLAGS += -I "${shell cygpath -w $(ARCHSRCDIR)$(DELIM)chip}"
  67. CFLAGS += -I "${shell cygpath -w $(ARCHSRCDIR)$(DELIM)common}"
  68. ifneq ($(ARCH_FAMILY),)
  69. CFLAGS += -I "${shell cygpath -w $(ARCHSRCDIR)$(DELIM)$(ARCH_FAMILY)}"
  70. endif
  71. endif
  72. else
  73. CFLAGS += -I$(SCHEDSRCDIR)
  74. ifeq ($(CONFIG_ARCH_SIM),y)
  75. CFLAGS += -I$(ARCHSRCDIR)
  76. else
  77. CFLAGS += -I$(ARCHSRCDIR)$(DELIM)chip
  78. CFLAGS += -I$(ARCHSRCDIR)$(DELIM)common
  79. ifneq ($(ARCH_FAMILY),)
  80. CFLAGS += -I$(ARCHSRCDIR)$(DELIM)$(ARCH_FAMILY)
  81. endif
  82. endif
  83. endif
  84. endif
  85. ifneq ($(ZDSVERSION),)
  86. INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
  87. CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
  88. endif
  89. all: libboard$(LIBEXT)
  90. ifneq ($(ZDSVERSION),)
  91. $(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
  92. ifeq ($(WINTOOL),y)
  93. $(Q) $(CPP) $(CPPFLAGS) `cygpath -w $<` -o $@.tmp
  94. else
  95. $(Q) $(CPP) $(CPPFLAGS) $< -o $@.tmp
  96. endif
  97. $(Q) cat $@.tmp | sed -e "s/^#/;/g" > $@
  98. $(Q) rm $@.tmp
  99. endif
  100. $(AOBJS): %$(OBJEXT): %$(ASMEXT)
  101. $(call ASSEMBLE, $<, $@)
  102. $(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
  103. $(call COMPILE, $<, $@)
  104. $(CXXOBJS) $(LINKOBJS): %$(OBJEXT): %.cxx
  105. $(call COMPILEXX, $<, $@)
  106. libboard$(LIBEXT): $(OBJS) $(CXXOBJS)
  107. $(Q) $(AR) $@
  108. ifneq ($(OBJS),)
  109. $(call ARCHIVE, $@, $(OBJS) $(CXXOBJS))
  110. endif
  111. .depend: Makefile $(SRCS) $(CXXSRCS)
  112. ifneq ($(ZDSVERSION),)
  113. $(Q) $(MKDEP) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
  114. else
  115. $(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
  116. endif
  117. ifneq ($(CXXSRCS),)
  118. $(Q) $(MKDEP) "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >>Make.dep
  119. endif
  120. $(Q) touch $@
  121. depend: .depend
  122. ifneq ($(BOARD_CONTEXT),y)
  123. context:
  124. endif
  125. clean:
  126. $(call DELFILE, libboard$(LIBEXT))
  127. $(call CLEAN)
  128. $(EXTRA_CLEAN)
  129. distclean: clean
  130. $(call DELFILE, Make.dep)
  131. $(call DELFILE, .depend)
  132. $(EXTRA_DISTCLEAN)
  133. -include Make.dep