Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. ############################################################################
  2. # boards/Makefile
  3. #
  4. # Licensed to the Apache Software Foundation (ASF) under one or more
  5. # contributor license agreements. See the NOTICE file distributed with
  6. # this work for additional information regarding copyright ownership. The
  7. # ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. # "License"); you may not use this file except in compliance with the
  9. # License. You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. # License for the specific language governing permissions and limitations
  17. # under the License.
  18. #
  19. ############################################################################
  20. include $(TOPDIR)/Make.defs
  21. # Determine if there is a Kconfig file for any custom board configuration
  22. ifeq ($(CONFIG_ARCH_BOARD_CUSTOM),y)
  23. CUSTOM_DIR = $(patsubst "%",%,$(CONFIG_ARCH_BOARD_CUSTOM_DIR))
  24. ifeq ($(CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH),y)
  25. CUSTOM_KPATH = $(TOPDIR)$(DELIM)$(CUSTOM_DIR)$(DELIM)Kconfig
  26. else
  27. CUSTOM_KPATH = $(CUSTOM_DIR)$(DELIM)Kconfig
  28. endif
  29. CUSTOM_KCONFIG = $(if $(wildcard $(CUSTOM_KPATH)),y,)
  30. endif
  31. ifeq ($(CUSTOM_KCONFIG),y)
  32. BOARD_KCONFIG = $(CUSTOM_KPATH)
  33. else
  34. BOARD_KCONFIG = $(TOPDIR)$(DELIM)boards$(DELIM)dummy$(DELIM)dummy_kconfig
  35. endif
  36. DUMMY_KCONFIG = $(TOPDIR)$(DELIM)boards$(DELIM)dummy$(DELIM)Kconfig
  37. # The board configuration should be installed in the arch/ directory
  38. BOARDDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board
  39. BOARD_INSTALLED = $(if $(wildcard $(BOARDDIR)$(DELIM)Makefile),y,)
  40. # Basic
  41. CONFIG_CSRCS = dummy.c
  42. # boardctl support
  43. ifeq ($(CONFIG_LIB_BOARDCTL),y)
  44. CONFIG_CSRCS += boardctl.c
  45. endif
  46. ASRCS = $(CONFIG_ASRCS)
  47. AOBJS = $(ASRCS:.S=$(OBJEXT))
  48. CSRCS = $(CONFIG_CSRCS)
  49. COBJS = $(CSRCS:.c=$(OBJEXT))
  50. CXXSRCS = $(CONFIG_CXXSRCS)
  51. CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
  52. SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
  53. OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
  54. BIN = libboards$(LIBEXT)
  55. all: $(BIN)
  56. .PHONY: depend context clean_context clean distclean
  57. $(AOBJS): %$(OBJEXT): %.S
  58. $(call ASSEMBLE, $<, $@)
  59. $(COBJS): %$(OBJEXT): %.c
  60. $(call COMPILE, $<, $@)
  61. $(CXXOBJS): %$(OBJEXT): %.cxx
  62. $(call COMPILEXX, $<, $@)
  63. $(BIN): $(OBJS)
  64. $(call ARCHIVE, $@, $(OBJS))
  65. makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds) $(CXXSRCS:.cxx=.ddx)
  66. $(call CATFILE, Make.dep, $^)
  67. $(call DELFILE, $^)
  68. .depend: Makefile $(SRCS) $(TOPDIR)$(DELIM).config
  69. $(Q) $(MAKE) makedepfile
  70. $(Q) touch $@
  71. depend: .depend
  72. $(DUMMY_KCONFIG): $(BOARD_KCONFIG)
  73. $(call DELFILE, $(DUMMY_KCONFIG))
  74. $(call COPYFILE, $(BOARD_KCONFIG), $(DUMMY_KCONFIG))
  75. dirlinks: $(DUMMY_KCONFIG)
  76. context: $(DUMMY_KCONFIG)
  77. ifeq ($(BOARD_INSTALLED),y)
  78. $(Q) $(MAKE) -C $(BOARDDIR) context
  79. endif
  80. clean_context:
  81. $(call DELFILE, $(DUMMY_KCONFIG))
  82. clean: clean_context
  83. $(call DELFILE, $(BIN))
  84. $(call CLEAN)
  85. distclean: clean
  86. $(call DELFILE, Make.dep)
  87. $(call DELFILE, .depend)
  88. -include Make.dep