Makefile 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. #topee imx6ull
  2. #CC=/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
  3. #mrzy
  4. #CC=/usr/local/arm/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-
  5. #mc am335x
  6. #CC=/usr/local/arm/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf-
  7. # --sysroot=/home/cyx/LLVMEmbeddedToolchainForArm-17.0.0-Linux-x86_64/lib/clang-runtimes/arm-none-eabi/armv7a_hard_vfpv3_d16 \
  8. # CC=clang \
  9. # --target=arm-linux-gnueabihf \
  10. # -mcpu=cortex-a7 \
  11. # -mfpu=neon \
  12. # -fno-exceptions \
  13. # -fno-rtti \
  14. # -lcrt0-semihost \
  15. # -lsemihost \
  16. # -T picolibc.ld \
  17. # CC=clang \
  18. # --target=armv7-linux-gnueabihf \
  19. # -mfpu=none \
  20. # -mfpu=neon \
  21. # -fno-exceptions \
  22. # -fno-rtti \
  23. # ifeq (, $(shell which clang-17))
  24. CC=arm-linux-gnueabihf-gcc
  25. # $(info "use gcc for default")
  26. # else
  27. # CC=clang-17 \
  28. # -Xclang -fix-only-warnings \
  29. # -mcpu=cortex-a7 \
  30. # -mfpu=neon \
  31. # -mfloat-abi=hard \
  32. # --target=armv7l-linux-gnueabihf \
  33. # --sysroot=/usr/arm-linux-gnueabihf/ \
  34. # -fuse-ld=lld \
  35. # -stdlib=libc++
  36. # $(info "we got clang 17")
  37. # endif
  38. # -rtlib=compiler-rt
  39. #
  40. # CFLAGS=-flto -w -Wfatal-errors -Wall -Wextra -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-parameter -Wno-unused-variable -Werror=format -Werror=incompatible-pointer-types
  41. # CFLAGS=-flto -Wfatal-errors -Wall -Wextra -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-comment -Werror=format -Werror=incompatible-pointer-types
  42. # CFLAGS=-flto -Wfatal-errors -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-comment -Werror=format -Werror=incompatible-pointer-types -Werror=implicit-int -Werror=lto-type-mismatch -Werror=return-type -Werror=conversion
  43. # CFLAGS=-Wfatal-errors -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-comment -Werror=format -Werror=incompatible-pointer-types -Werror=implicit-int
  44. CFLAGS=-funwind-tables -flto -Wfatal-errors -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-const-variable -Wno-unused-parameter -Wno-unused-variable -Wno-comment -Werror=format -Werror=incompatible-pointer-types -Werror=implicit-int
  45. SRCFILES = appl/main.c \
  46. appl/appl.c \
  47. appl/cloud/cloud.c \
  48. appl/tb/tb.c \
  49. appl/ems/ems_sm.c \
  50. appl/ems/ems.c \
  51. appl/ems/timeseg.c \
  52. appl/ems/estats.c \
  53. appl/ems/pcurv.c \
  54. appl/ems/schedule.c \
  55. appl/ems/pgrid.c \
  56. platform/abs/plt.c\
  57. platform/abs/ctn.c\
  58. platform/abs/ess.c\
  59. platform/abs/meter.c\
  60. platform/abs/transformers.c\
  61. platform/util/misc/misc.c\
  62. platform/util/log/log.c\
  63. platform/util/tool/tool.c\
  64. platform/util/shm/shm.c\
  65. platform/util/mqtt/mqtt_sm.c\
  66. platform/util/mqtt/mqtt.c\
  67. platform/util/mqtt/mqtt_ringbuffer.c\
  68. platform/util/mqtt/mqtt_cache.c\
  69. platform/util/tbmqtt/tbmqtt_sm.c\
  70. platform/util/tbmqtt/tbmqtt.c\
  71. platform/util/tbmqtt/tbmqtt_ringbuffer.c\
  72. platform/util/tbmqtt/tbmqtt_cache.c\
  73. platform/util/comm/comm.c\
  74. platform/util/statemachine/sm.c\
  75. platform/device/chan/chan.c\
  76. platform/device/chan/chan_serial_ringbuffer.c\
  77. platform/device/chan/chan_socketcan_ringbuffer.c\
  78. platform/device/chan/chan_tcpservcan_ringbuffer.c\
  79. platform/device/chan/mbs.c\
  80. platform/device/ctn/zh200_comm.c\
  81. platform/device/ctn/zh200_sm.c\
  82. platform/device/ctn/zh200.c\
  83. platform/device/meter/abb_b23_4_comm.c\
  84. platform/device/meter/abb_b23_4_sm.c\
  85. platform/device/meter/abb_b23_4.c\
  86. platform/device/meter/dtsd1352_comm.c\
  87. platform/device/meter/dtsd1352_sm.c\
  88. platform/device/meter/dtsd1352.c\
  89. platform/device/meter/dlt645_comm.c\
  90. platform/device/meter/dlt645_sm.c\
  91. platform/device/meter/dlt645.c\
  92. platform/device/meter/dlt645_api_07.c\
  93. platform/device/meter/adl200_comm.c\
  94. platform/device/meter/adl200_sm.c\
  95. platform/device/meter/adl200.c\
  96. platform/device/mac/mac.c\
  97. appl/sta/sta_sm.c\
  98. appl/sta/sta.c
  99. COMPONENTS = component/freemodbus/modbus/ascii/mbascii.c \
  100. component/freemodbus/modbus/functions/mbfunccoils.c \
  101. component/freemodbus/modbus/functions/mbfuncdiag.c \
  102. component/freemodbus/modbus/functions/mbfuncdisc.c \
  103. component/freemodbus/modbus/functions/mbfuncholding.c \
  104. component/freemodbus/modbus/functions/mbfuncinput.c \
  105. component/freemodbus/modbus/functions/mbfuncother.c \
  106. component/freemodbus/modbus/functions/mbutils.c \
  107. component/freemodbus/modbus/rtu/mbcrc.c \
  108. component/freemodbus/modbus/rtu/mbrtu.c \
  109. component/freemodbus/modbus/tcp/mbtcp.c \
  110. component/freemodbus/modbus/mb.c \
  111. component/freemodbus/port/portevent.c \
  112. component/freemodbus/port/portother.c \
  113. component/freemodbus/port/portserial.c \
  114. component/freemodbus/port/porttcp.c \
  115. component/freemodbus/port/porttimer.c \
  116. component/libmodbus/src/modbus.c \
  117. component/libmodbus/src/modbus-data.c \
  118. component/libmodbus/src/modbus-rtu.c \
  119. component/libmodbus/src/modbus-tcp.c \
  120. component/sqlite/sqlite3.c \
  121. component/zlog/buf.c \
  122. component/zlog/category.c \
  123. component/zlog/category_table.c \
  124. component/zlog/conf.c \
  125. component/zlog/event.c \
  126. component/zlog/format.c \
  127. component/zlog/level.c \
  128. component/zlog/level_list.c \
  129. component/zlog/mdc.c \
  130. component/zlog/record.c \
  131. component/zlog/record_table.c \
  132. component/zlog/rotater.c \
  133. component/zlog/rule.c \
  134. component/zlog/spec.c \
  135. component/zlog/thread.c \
  136. component/zlog/zc_arraylist.c \
  137. component/zlog/zc_hashtable.c \
  138. component/zlog/zc_profile.c \
  139. component/zlog/zc_util.c \
  140. component/zlog/zlog.c \
  141. component/cJSON/cJSON.c \
  142. component/paho.mqtt.c-1.3.9/src/Base64.c \
  143. component/paho.mqtt.c-1.3.9/src/Clients.c \
  144. component/paho.mqtt.c-1.3.9/src/Heap.c \
  145. component/paho.mqtt.c-1.3.9/src/LinkedList.c \
  146. component/paho.mqtt.c-1.3.9/src/Log.c \
  147. component/paho.mqtt.c-1.3.9/src/Messages.c \
  148. component/paho.mqtt.c-1.3.9/src/MQTTClient.c \
  149. component/paho.mqtt.c-1.3.9/src/MQTTPacket.c \
  150. component/paho.mqtt.c-1.3.9/src/MQTTPacketOut.c \
  151. component/paho.mqtt.c-1.3.9/src/MQTTPersistence.c \
  152. component/paho.mqtt.c-1.3.9/src/MQTTPersistenceDefault.c \
  153. component/paho.mqtt.c-1.3.9/src/MQTTProperties.c \
  154. component/paho.mqtt.c-1.3.9/src/MQTTProtocolClient.c \
  155. component/paho.mqtt.c-1.3.9/src/MQTTProtocolOut.c \
  156. component/paho.mqtt.c-1.3.9/src/MQTTReasonCodes.c \
  157. component/paho.mqtt.c-1.3.9/src/MQTTTime.c \
  158. component/paho.mqtt.c-1.3.9/src/OsWrapper.c \
  159. component/paho.mqtt.c-1.3.9/src/SHA1.c \
  160. component/paho.mqtt.c-1.3.9/src/Socket.c \
  161. component/paho.mqtt.c-1.3.9/src/SocketBuffer.c \
  162. component/paho.mqtt.c-1.3.9/src/SSLSocket.c \
  163. component/paho.mqtt.c-1.3.9/src/StackTrace.c \
  164. component/paho.mqtt.c-1.3.9/src/Thread.c \
  165. component/paho.mqtt.c-1.3.9/src/Tree.c \
  166. component/paho.mqtt.c-1.3.9/src/utf-8.c \
  167. component/paho.mqtt.c-1.3.9/src/WebSocket.c\
  168. component/snowid/snowid.c \
  169. component/snowid/snowid_util.c \
  170. component/snowid/snowid_checkpoint.c \
  171. component/uuid4/src/uuid4.c
  172. SRC = $(shell find platform/ -name "*.c") $(shell find appl/ -name "*.c") $(COMPONENTS)
  173. INCLUDES = $(addprefix -I,$(shell find appl/ -type d -print)) $(addprefix -I,$(shell find platform/ -type d -print)) $(addprefix -I,$(shell find component/ -type d -print))
  174. all:
  175. mkdir -p bin
  176. $(CC) $(CFLAGS) $(SRCFILES) $(COMPONENTS) $(INCLUDES) -lpthread -lm -lrt -ldl -ggdb3 -o bin/stad
  177. debug:
  178. mkdir -p bin
  179. $(CC) $(CFLAGS) $(SRCFILES) $(COMPONENTS) $(INCLUDES) -rdynamic -DDEBUG -lpthread -lm -lrt -ldl -w -ggdb3 -o bin/stad
  180. backtrace:
  181. mkdir -p bin
  182. $(CC) $(CFLAGS) $(SRCFILES) $(COMPONENTS) $(INCLUDES) -rdynamic -funwind-tables -DBACKTRACE -lpthread -lm -lrt -ldl -w -ggdb3 -o bin/stad
  183. backtrace-test:
  184. mkdir -p bin
  185. $(CC) $(CFLAGS) backtrace-test.c -lpthread -lm -lrt -ldl -w -ggdb3 -o bin/backtrace-test
  186. clean:
  187. rm -rf ./bin/*
  188. # tidy:
  189. # clang-tidy-17 -checks= --warnings-as-errors= --fix-errors appl/ems/ems.c -- $(INCLUDES)