Directories.mk 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ############################################################################
  2. # Directories.mk
  3. #
  4. # Copyright (C) 2007-2012, 2014, 2016 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. # All add-on directories.
  36. #
  37. # NUTTX_ADDONS is the list of directories built into the NuttX kernel.
  38. # USER_ADDONS is the list of directories that will be built into the user
  39. # application
  40. NUTTX_ADDONS :=
  41. USER_ADDONS :=
  42. # In the protected build, the applications in the apps/ directory will be
  43. # into the userspace; in the flat build, the applications will b built into
  44. # the kernel space. But in the kernel build, the applications will not be
  45. # built at all by this Makefile.
  46. ifeq ($(CONFIG_BUILD_PROTECTED),y)
  47. USER_ADDONS += $(APPDIR)
  48. else
  49. ifneq ($(CONFIG_BUILD_KERNEL),y)
  50. NUTTX_ADDONS += $(APPDIR)
  51. endif
  52. endif
  53. # Lists of build directories.
  54. #
  55. # FSDIRS depend on file descriptor support; NONFSDIRS do not (except for parts
  56. # of FSDIRS). We will exclude FSDIRS from the build if file descriptor
  57. # support is disabled. NOTE that drivers, in general, depends on file
  58. # descriptor support but is always built because there are other components
  59. # in the drivers directory that are needed even if file descriptors are not
  60. # supported.
  61. # CONTEXTDIRS include directories that have special, one-time pre-build
  62. # requirements. Normally this includes things like auto-generation of
  63. # configuration specific files or creation of configurable symbolic links
  64. # USERDIRS - When NuttX is build is a monolithic kernel, this provides the
  65. # list of directories that must be built
  66. # OTHERDIRS - These are directories that are not built but probably should
  67. # be cleaned to prevent garbage from collecting in them when changing
  68. # configurations.
  69. NONFSDIRS = sched drivers configs $(ARCH_SRC) $(NUTTX_ADDONS)
  70. FSDIRS = fs binfmt
  71. CONTEXTDIRS = configs $(APPDIR)
  72. USERDIRS =
  73. OTHERDIRS = lib
  74. ifeq ($(CONFIG_BUILD_PROTECTED),y)
  75. USERDIRS += libc mm $(USER_ADDONS)
  76. ifeq ($(CONFIG_HAVE_CXX),y)
  77. USERDIRS += libxx
  78. endif
  79. else
  80. ifeq ($(CONFIG_BUILD_KERNEL),y)
  81. USERDIRS += libc mm
  82. ifeq ($(CONFIG_HAVE_CXX),y)
  83. USERDIRS += libxx
  84. endif
  85. else
  86. NONFSDIRS += libc mm
  87. OTHERDIRS += $(USER_ADDONS)
  88. ifeq ($(CONFIG_HAVE_CXX),y)
  89. NONFSDIRS += libxx
  90. else
  91. OTHERDIRS += libxx
  92. endif
  93. endif
  94. endif
  95. ifeq ($(CONFIG_LIB_SYSCALL),y)
  96. NONFSDIRS += syscall
  97. CONTEXTDIRS += syscall
  98. USERDIRS += syscall
  99. else
  100. OTHERDIRS += syscall
  101. endif
  102. ifeq ($(CONFIG_LIB_ZONEINFO_ROMFS),y)
  103. CONTEXTDIRS += libc
  104. endif
  105. ifeq ($(CONFIG_NX),y)
  106. NONFSDIRS += graphics libnx
  107. CONTEXTDIRS += graphics libnx
  108. else
  109. OTHERDIRS += graphics libnx
  110. endif
  111. ifeq ($(CONFIG_AUDIO),y)
  112. NONFSDIRS += audio
  113. else
  114. OTHERDIRS += audio
  115. endif
  116. ifeq ($(CONFIG_DRIVERS_WIRELESS),y)
  117. NONFSDIRS += wireless
  118. else
  119. OTHERDIRS += wireless
  120. endif
  121. # CLEANDIRS are the directories that will clean in. These are
  122. # all directories that we know about.
  123. # KERNDEPDIRS are the directories in which we will build target dependencies.
  124. # If NuttX and applications are built separately (CONFIG_BUILD_PROTECTED or
  125. # CONFIG_BUILD_KERNEL), then this holds only the directories containing
  126. # kernel files.
  127. # USERDEPDIRS. If NuttX and applications are built separately (CONFIG_BUILD_PROTECTED),
  128. # then this holds only the directories containing user files. If
  129. # CONFIG_BUILD_KERNEL is selected, then applications are not build at all.
  130. CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS)
  131. KERNDEPDIRS = $(NONFSDIRS)
  132. USERDEPDIRS = $(USERDIRS)
  133. # Add file system directories to KERNDEPDIRS (they are already in CLEANDIRS)
  134. ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
  135. ifeq ($(CONFIG_NET),y)
  136. ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
  137. KERNDEPDIRS += fs
  138. endif
  139. KERNDEPDIRS += drivers
  140. endif
  141. else
  142. KERNDEPDIRS += $(FSDIRS)
  143. endif
  144. # Add networking directories to KERNDEPDIRS and CLEANDIRS
  145. ifeq ($(CONFIG_NET),y)
  146. KERNDEPDIRS += net
  147. endif
  148. CLEANDIRS += net
  149. ifeq ($(CONFIG_CRYPTO),y)
  150. KERNDEPDIRS += crypto
  151. endif
  152. CLEANDIRS += crypto