Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. #############################################################
  2. # Required variables for each makefile
  3. # Discard this section from all parent makefiles
  4. # Expected variables (with automatic defaults):
  5. # CSRCS (all "C" files in the dir)
  6. # SUBDIRS (all subdirs with a Makefile)
  7. # GEN_LIBS - list of libs to be generated ()
  8. # GEN_IMAGES - list of object file images to be generated ()
  9. # GEN_BINS - list of binaries to be generated ()
  10. # COMPONENTS_xxx - a list of libs/objs in the form
  11. # subdir/lib to be extracted and rolled up into
  12. # a generated lib/image xxx.a ()
  13. #
  14. #FLAVOR = release
  15. FLAVOR = debug
  16. #EXTRA_CCFLAGS += -u
  17. ifndef PDIR # {
  18. GEN_IMAGES= eagle.app.v6.out
  19. GEN_BINS= eagle.app.v6.bin
  20. SPECIAL_MKTARGETS=$(APP_MKTARGETS)
  21. SUBDIRS= \
  22. user \
  23. driver \
  24. json \
  25. platform \
  26. lua \
  27. coap \
  28. mqtt \
  29. task \
  30. u8glib \
  31. ucglib \
  32. smart \
  33. modules \
  34. spiffs \
  35. cjson \
  36. crypto \
  37. dhtlib \
  38. tsl2561 \
  39. net \
  40. http
  41. endif # } PDIR
  42. APPDIR = .
  43. LDDIR = ../ld
  44. CCFLAGS += -Os
  45. TARGET_LDFLAGS = \
  46. -nostdlib \
  47. -Wl,-EL \
  48. --longcalls \
  49. --text-section-literals
  50. ifeq ($(FLAVOR),debug)
  51. TARGET_LDFLAGS += -g -Os
  52. endif
  53. ifeq ($(FLAVOR),release)
  54. TARGET_LDFLAGS += -Os
  55. endif
  56. COMPONENTS_eagle.app.v6 = \
  57. user/libuser.a \
  58. driver/libdriver.a \
  59. json/libjson.a \
  60. platform/libplatform.a \
  61. task/libtask.a \
  62. lua/liblua.a \
  63. coap/coap.a \
  64. mqtt/mqtt.a \
  65. u8glib/u8glib.a \
  66. ucglib/ucglib.a \
  67. smart/smart.a \
  68. spiffs/spiffs.a \
  69. cjson/libcjson.a \
  70. crypto/libcrypto.a \
  71. dhtlib/libdhtlib.a \
  72. tsl2561/tsl2561lib.a \
  73. http/libhttp.a \
  74. net/libnodemcu_net.a \
  75. modules/libmodules.a \
  76. # Inspect the modules library and work out which modules need to be linked.
  77. # For each enabled module, a symbol name of the form XYZ_module_selected is
  78. # returned. At link time those names are declared undefined, so those (and
  79. # only those) modules are pulled in.
  80. SELECTED_MODULE_SYMS=$(filter %_module_selected %module_selected1,$(shell $(NM) modules/.output/$(TARGET)/$(FLAVOR)/lib/libmodules.a))
  81. USED_SDK_LIBS= \
  82. crypto \
  83. freertos \
  84. gcc \
  85. lwip \
  86. main \
  87. net80211 \
  88. phy \
  89. pp \
  90. smartconfig \
  91. ssl \
  92. wpa \
  93. wps \
  94. $(TARGET_SDK_LIBS) \
  95. LINKFLAGS_eagle.app.v6 = \
  96. -Wl,--gc-sections \
  97. -Wl,-Map=mapfile.$(TARGET) \
  98. -nostdlib \
  99. -T$(LD_FILE) \
  100. -Wl,@$(LDDIR)/defsym.rom \
  101. -T$(LDDIR)/extrasyms.rom \
  102. -Wl,--no-check-sections \
  103. -Wl,-static \
  104. $(TARGET_LDFLAGS) \
  105. $(addprefix -u , $(SELECTED_MODULE_SYMS)) \
  106. -Wl,--start-group \
  107. $(DEP_LIBS_eagle.app.v6) \
  108. -Wl,--end-group \
  109. -Wl,--no-gc-sections \
  110. -Wl,--start-group \
  111. $(addprefix -l,$(USED_SDK_LIBS)) \
  112. -lhal \
  113. -Wl,--end-group \
  114. DEPENDS_eagle.app.v6 = \
  115. $(LD_FILE) \
  116. Makefile
  117. #############################################################
  118. # Configuration i.e. compile options etc.
  119. # Target specific stuff (defines etc.) goes in here!
  120. # Generally values applying to a tree are captured in the
  121. # makefile at its root level - these are then overridden
  122. # for a subtree within the makefile rooted therein
  123. #
  124. #UNIVERSAL_TARGET_DEFINES = \
  125. # Other potential configuration flags include:
  126. # -DTXRX_TXBUF_DEBUG
  127. # -DTXRX_RXBUF_DEBUG
  128. # -DWLAN_CONFIG_CCX
  129. CONFIGURATION_DEFINES = -D__ets__ \
  130. -DICACHE_FLASH \
  131. -DLUA_OPTIMIZE_MEMORY=2 \
  132. -DMIN_OPT_LEVEL=2 \
  133. -DLWIP_OPEN_SRC \
  134. -DPBUF_RSV_FOR_WLAN \
  135. -DEBUF_LWIP \
  136. DEFINES += \
  137. $(UNIVERSAL_TARGET_DEFINES) \
  138. $(CONFIGURATION_DEFINES)
  139. DDEFINES += \
  140. $(UNIVERSAL_TARGET_DEFINES) \
  141. $(CONFIGURATION_DEFINES)
  142. #############################################################
  143. # Recursion Magic - Don't touch this!!
  144. #
  145. # Each subtree potentially has an include directory
  146. # corresponding to the common APIs applicable to modules
  147. # rooted at that subtree. Accordingly, the INCLUDE PATH
  148. # of a module can only contain the include directories up
  149. # its parent path, and not its siblings
  150. #
  151. # Required for each makefile to inherit from the parent
  152. #
  153. INCLUDES := $(INCLUDES) -I $(PDIR)include
  154. INCLUDES += -I ./
  155. PDIR := ../$(PDIR)
  156. sinclude $(PDIR)Makefile
  157. .PHONY: FORCE
  158. FORCE: