Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. TARGET = eagle
  15. #FLAVOR = release
  16. FLAVOR = debug
  17. #EXTRA_CCFLAGS += -u
  18. ifndef PDIR # {
  19. GEN_IMAGES= eagle.app.v6.out
  20. GEN_BINS= eagle.app.v6.bin
  21. SPECIAL_MKTARGETS=$(APP_MKTARGETS)
  22. SUBDIRS= \
  23. user \
  24. driver \
  25. pcm \
  26. mbedtls \
  27. platform \
  28. libc \
  29. lua \
  30. lwip \
  31. coap \
  32. mqtt \
  33. task \
  34. u8glib \
  35. ucglib \
  36. smart \
  37. modules \
  38. spiffs \
  39. crypto \
  40. dhtlib \
  41. tsl2561 \
  42. net \
  43. http \
  44. fatfs \
  45. esp-gdbstub \
  46. websocket \
  47. swTimer \
  48. misc \
  49. pm \
  50. sjson \
  51. sqlite3 \
  52. endif # } PDIR
  53. APPDIR = .
  54. LDDIR = ../ld
  55. CCFLAGS += -Os
  56. TARGET_LDFLAGS = \
  57. -nostdlib \
  58. -Wl,-EL \
  59. --longcalls \
  60. --text-section-literals
  61. ifeq ($(FLAVOR),debug)
  62. TARGET_LDFLAGS += -g -Os
  63. endif
  64. ifeq ($(FLAVOR),release)
  65. TARGET_LDFLAGS += -Os
  66. endif
  67. LD_FILE = $(LDDIR)/nodemcu.ld
  68. COMPONENTS_eagle.app.v6 = \
  69. user/libuser.a \
  70. driver/libdriver.a \
  71. pcm/pcm.a \
  72. platform/libplatform.a \
  73. task/libtask.a \
  74. libc/liblibc.a \
  75. lua/liblua.a \
  76. lwip/liblwip.a \
  77. coap/coap.a \
  78. mqtt/mqtt.a \
  79. u8glib/u8glib.a \
  80. ucglib/ucglib.a \
  81. smart/smart.a \
  82. spiffs/spiffs.a \
  83. fatfs/libfatfs.a \
  84. crypto/libcrypto.a \
  85. dhtlib/libdhtlib.a \
  86. tsl2561/tsl2561lib.a \
  87. http/libhttp.a \
  88. pm/libpm.a \
  89. websocket/libwebsocket.a \
  90. esp-gdbstub/libgdbstub.a \
  91. net/libnodemcu_net.a \
  92. mbedtls/libmbedtls.a \
  93. modules/libmodules.a \
  94. swTimer/libswtimer.a \
  95. misc/libmisc.a \
  96. sjson/libsjson.a \
  97. sqlite3/libsqlite3.a \
  98. # Inspect the modules library and work out which modules need to be linked.
  99. # For each enabled module, a symbol name of the form XYZ_module_selected is
  100. # returned. At link time those names are declared undefined, so those (and
  101. # only those) modules are pulled in.
  102. SELECTED_MODULE_SYMS=$(filter %_module_selected %module_selected1,$(shell $(NM) modules/.output/$(TARGET)/$(FLAVOR)/lib/libmodules.a))
  103. LINKFLAGS_eagle.app.v6 = \
  104. -Wl,--gc-sections \
  105. -Wl,-Map=mapfile \
  106. -nostdlib \
  107. -T$(LD_FILE) \
  108. -Wl,@../ld/defsym.rom \
  109. -Wl,--no-check-sections \
  110. -Wl,--wrap=_xtos_set_exception_handler \
  111. -Wl,-static \
  112. $(addprefix -u , $(SELECTED_MODULE_SYMS)) \
  113. -Wl,--start-group \
  114. -lmain \
  115. -lc \
  116. -lgcc \
  117. -lhal \
  118. -lphy \
  119. -lpp \
  120. -lnet80211 \
  121. -lwpa \
  122. -lwpa2 \
  123. -lsmartconfig \
  124. -lcrypto \
  125. -lwps \
  126. $(DEP_LIBS_eagle.app.v6) \
  127. -Wl,--end-group \
  128. -lm
  129. DEPENDS_eagle.app.v6 = \
  130. $(LD_FILE) \
  131. Makefile
  132. #############################################################
  133. # Configuration i.e. compile options etc.
  134. # Target specific stuff (defines etc.) goes in here!
  135. # Generally values applying to a tree are captured in the
  136. # makefile at its root level - these are then overridden
  137. # for a subtree within the makefile rooted therein
  138. #
  139. #UNIVERSAL_TARGET_DEFINES = \
  140. # Other potential configuration flags include:
  141. # -DTXRX_TXBUF_DEBUG
  142. # -DTXRX_RXBUF_DEBUG
  143. # -DWLAN_CONFIG_CCX
  144. CONFIGURATION_DEFINES = -D__ets__ \
  145. -DICACHE_FLASH \
  146. -DLUA_OPTIMIZE_MEMORY=2 \
  147. -DMIN_OPT_LEVEL=2 \
  148. -DLWIP_OPEN_SRC \
  149. -DPBUF_RSV_FOR_WLAN \
  150. -DEBUF_LWIP \
  151. -DUSE_OPTIMIZE_PRINTF \
  152. -DMBEDTLS_USER_CONFIG_FILE=\"user_mbedtls.h\" \
  153. DEFINES += \
  154. $(UNIVERSAL_TARGET_DEFINES) \
  155. $(CONFIGURATION_DEFINES)
  156. DDEFINES += \
  157. $(UNIVERSAL_TARGET_DEFINES) \
  158. $(CONFIGURATION_DEFINES)
  159. #############################################################
  160. # Recursion Magic - Don't touch this!!
  161. #
  162. # Each subtree potentially has an include directory
  163. # corresponding to the common APIs applicable to modules
  164. # rooted at that subtree. Accordingly, the INCLUDE PATH
  165. # of a module can only contain the include directories up
  166. # its parent path, and not its siblings
  167. #
  168. # Required for each makefile to inherit from the parent
  169. #
  170. INCLUDES := $(INCLUDES) -I $(PDIR)include
  171. INCLUDES += -I ./
  172. PDIR := ../$(PDIR)
  173. sinclude $(PDIR)Makefile
  174. .PHONY: FORCE
  175. FORCE: