Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. ############################################################################
  2. # libs/libxx/Makefile
  3. #
  4. # Copyright (C) 2009, 2012, 2016-2017 Gregory Nutt. All rights reserved.
  5. # Author: Gregory Nutt <gnutt@nuttx.org>
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions
  9. # are met:
  10. #
  11. # 1. Redistributions of source code must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. # 2. Redistributions in binary form must reproduce the above copyright
  14. # notice, this list of conditions and the following disclaimer in
  15. # the documentation and/or other materials provided with the
  16. # distribution.
  17. # 3. Neither the name NuttX nor the names of its contributors may be
  18. # used to endorse or promote products derived from this software
  19. # without specific prior written permission.
  20. #
  21. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. # POSSIBILITY OF SUCH DAMAGE.
  33. #
  34. ###########################################################################
  35. -include $(TOPDIR)/Make.defs
  36. ifeq ($(CONFIG_LIBCXX),y)
  37. LIBXX=libcxx
  38. else
  39. LIBXX=libxx
  40. endif
  41. # Sources
  42. ASRCS =
  43. CSRCS =
  44. CXXSRCS = libxx_cxapurevirtual.cxx libxx_eabi_atexit.cxx libxx_cxa_atexit.cxx
  45. ifeq ($(CONFIG_CXX_EXCEPTION),y)
  46. CXXSRCS += libxx__gnu_unwind_find_exidx.cxx
  47. endif
  48. # Some of the libs/libxx/ files are not need if uClibc++ or libcxx is installed
  49. # because uClibx++ or libcxx will replace them
  50. ifeq (,$(findstring y,$(CONFIG_UCLIBCXX) $(CONFIG_LIBCXX)))
  51. CXXSRCS += libxx_delete.cxx libxx_delete_sized.cxx libxx_deletea.cxx
  52. CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx
  53. CXXSRCS += libxx_stdthrow.cxx
  54. endif
  55. # uClibc++ doesn't need this file
  56. ifneq ($(CONFIG_UCLIBCXX),y)
  57. CXXSRCS += libxx_cxa_guard.cxx
  58. endif
  59. # Paths
  60. DEPPATH = --dep-path .
  61. VPATH = .
  62. # Include the uClibc++ Make.defs file if selected. If it is included,
  63. # the uClibc++/Make.defs file will add its files to the source file list,
  64. # add its DEPPATH info, and will add the appropriate paths to the VPATH
  65. # variable
  66. #
  67. # Note that an error will occur if you select CONFIG_LIBXX_UCLIBCXX
  68. # without installing the uClibc++ package. This is intentional to let
  69. # you know about the configuration problem. Refer to the README.txt file
  70. # in the NuttX uClibc++ GIT repository for more information
  71. ifeq ($(CONFIG_UCLIBCXX),y)
  72. include uClibc++/Make.defs
  73. endif
  74. ifeq ($(CONFIG_LIBCXX),y)
  75. include libcxx/Make.defs
  76. endif
  77. # Object Files
  78. AOBJS = $(ASRCS:.S=$(OBJEXT))
  79. COBJS = $(CSRCS:.c=$(OBJEXT))
  80. CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
  81. SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
  82. OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
  83. BIN = $(LIBXX)$(LIBEXT)
  84. all: $(BIN)
  85. .PHONY: depend clean distclean
  86. $(AOBJS): %$(OBJEXT): %.S
  87. $(call ASSEMBLE, $<, $@)
  88. $(COBJS): %$(OBJEXT): %.c
  89. $(call COMPILE, $<, $@)
  90. $(CXXOBJS): %$(OBJEXT): %.cxx
  91. $(call COMPILEXX, $<, $@)
  92. $(BIN): $(OBJS)
  93. $(call ARCHIVE, $@, $(OBJS))
  94. .depend: Makefile $(SRCS)
  95. $(Q) $(MKDEP) $(DEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(SRCS) >Make.dep
  96. $(Q) touch $@
  97. depend: .depend
  98. clean:
  99. $(call DELFILE, $(BIN))
  100. $(call CLEAN)
  101. distclean: clean
  102. $(call DELFILE, Make.dep)
  103. $(call DELFILE, .depend)
  104. -include Make.dep