Makefile 4.5 KB

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