libmetal.defs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. ############################################################################
  2. # openamp/libmetal.defs
  3. #
  4. # Copyright (C) 2019 Xiaomi. All rights reserved.
  5. # Author: Xiang Xiao <xiaoxiang@pinecone.net>
  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. ifeq ($(CONFIG_OPENAMP),y)
  36. ifeq ($(CONFIG_ARCH), sim)
  37. LIBMETAL_ARCH = x86_64
  38. else
  39. LIBMETAL_ARCH = $(subst -,,$(CONFIG_ARCH))
  40. endif
  41. LIBMETAL_HDRS += $(wildcard libmetal/lib/compiler/gcc/*.h)
  42. LIBMETAL_HDRS += $(wildcard libmetal/lib/processor/$(LIBMETAL_ARCH)/*.h)
  43. LIBMETAL_HDRS += $(wildcard libmetal/lib/system/nuttx/*.h)
  44. LIBMETAL_HDRS += $(wildcard libmetal/lib/*.h)
  45. CSRCS += libmetal/lib/system/nuttx/condition.c
  46. CSRCS += libmetal/lib/system/nuttx/device.c
  47. CSRCS += libmetal/lib/system/nuttx/init.c
  48. CSRCS += libmetal/lib/system/nuttx/io.c
  49. CSRCS += libmetal/lib/system/nuttx/irq.c
  50. CSRCS += libmetal/lib/system/nuttx/shmem.c
  51. CSRCS += libmetal/lib/system/nuttx/time.c
  52. CSRCS += libmetal/lib/device.c
  53. CSRCS += libmetal/lib/dma.c
  54. CSRCS += libmetal/lib/init.c
  55. CSRCS += libmetal/lib/io.c
  56. CSRCS += libmetal/lib/irq.c
  57. CSRCS += libmetal/lib/log.c
  58. CSRCS += libmetal/lib/shmem.c
  59. CSRCS += libmetal/lib/version.c
  60. CFLAGS += -DMETAL_INTERNAL
  61. LIBMETAL_HDRS_SEDEXP := \
  62. "s/@PROJECT_VER_MAJOR@/0/g; \
  63. s/@PROJECT_VER_MINOR@/1/g; \
  64. s/@PROJECT_VER_PATCH@/0/g; \
  65. s/@PROJECT_VER@/0.1.0/g; \
  66. s/@PROJECT_SYSTEM@/nuttx/g; \
  67. s/@PROJECT_PROCESSOR@/$(LIBMETAL_ARCH)/g; \
  68. s/@PROJECT_MACHINE@/$(CONFIG_ARCH_CHIP)/g; \
  69. s/@PROJECT_SYSTEM_UPPER@/nuttx/g; \
  70. s/@PROJECT_PROCESSOR_UPPER@/$(LIBMETAL_ARCH)/g; \
  71. s/@PROJECT_MACHINE_UPPER@/$(CONFIG_ARCH_CHIP)/g; \
  72. s/cmakedefine/undef/g"
  73. .libmetal_headers: $(LIBMETAL_HDRS)
  74. $(foreach headers,$(LIBMETAL_HDRS), \
  75. $(eval hobj := $(patsubst libmetal$(DELIM)lib$(DELIM)%,$(TOPDIR)$(DELIM)include$(DELIM)metal$(DELIM)%,$(headers))) \
  76. $(shell if [ ! -d $(dir $(hobj)) ];then mkdir -p $(dir $(hobj)); fi) \
  77. $(shell sed $(LIBMETAL_HDRS_SEDEXP) $(headers) > $(hobj)) \
  78. )
  79. touch $@
  80. dirlinks:: .libmetal_headers
  81. distclean::
  82. $(call DELDIR, $(TOPDIR)$(DELIM)include$(DELIM)metal)
  83. $(call DELFILE, .libmetal_headers)
  84. endif