Make.defs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ############################################################################
  2. # apps/Make.defs
  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. TOPDIR ?= $(APPDIR)/import
  21. include $(TOPDIR)/Make.defs
  22. # The GNU make CURDIR will always be a POSIX-like path with forward slashes
  23. # as path segment separators. This is fine for the above inclusions but
  24. # will cause problems later for the native build. If we know that this is
  25. # a native build, then we need to fix up the APPDIR path for subsequent
  26. # use
  27. ifeq ($(CONFIG_WINDOWS_NATIVE),y)
  28. APPDIR := ${shell echo %CD%}
  29. endif
  30. # Application Directories
  31. # BUILDIRS is the list of top-level directories containing Make.defs files
  32. # CLEANDIRS is the list of all top-level directories containing Makefiles.
  33. # It is used only for cleaning.
  34. BUILDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Make.defs))
  35. BUILDIRS := $(filter-out $(APPDIR)$(DELIM)import$(DELIM),$(BUILDIRS))
  36. CONFIGDIRS := $(filter-out $(APPDIR)$(DELIM)builtin$(DELIM),$(BUILDIRS))
  37. CONFIGDIRS := $(filter-out $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Kconfig)),$(CONFIGDIRS))
  38. CLEANDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Makefile))
  39. # CONFIGURED_APPS is the application directories that should be built in
  40. # the current configuration.
  41. CONFIGURED_APPS :=
  42. define Add_Application
  43. include $(1)Make.defs
  44. endef
  45. $(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR))))
  46. # File extensions
  47. CXXEXT ?= .cxx
  48. # Library path
  49. LIBPATH ?= $(TOPDIR)$(DELIM)staging
  50. # The install path
  51. BINDIR ?= $(APPDIR)$(DELIM)bin
  52. # The final build target
  53. BIN ?= $(APPDIR)$(DELIM)libapps$(LIBEXT)
  54. # Tools
  55. ifeq ($(CONFIG_WINDOWS_NATIVE),y)
  56. MKKCONFIG ?= $(APPDIR)$(DELIM)tools$(DELIM)mkkconfig.bat
  57. else
  58. MKKCONFIG ?= $(APPDIR)$(DELIM)tools$(DELIM)mkkconfig.sh
  59. endif
  60. # Builtin Registration
  61. BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry
  62. DEPCONFIG = $(TOPDIR)$(DELIM).config
  63. define REGISTER
  64. $(Q) echo Register: $1
  65. $(Q) echo { \"$1\", $2, $3, $4 }, > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat"
  66. $(Q) if [ ! -z $4 ]; then \
  67. echo "int $4(int argc, char *argv[]);" > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat"; \
  68. fi;
  69. $(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated"
  70. endef
  71. # Standard include path
  72. CFLAGS += ${shell $(INCDIR) "$(CC)" "$(APPDIR)$(DELIM)include"}
  73. CXXFLAGS += ${shell $(INCDIR) "$(CC)" "$(APPDIR)$(DELIM)include"}
  74. ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
  75. NUTTXLIB ?= "${shell cygpath -w $(TOPDIR)$(DELIM)staging}"
  76. else
  77. NUTTXLIB ?= "$(TOPDIR)$(DELIM)staging"
  78. endif