Makefile 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. PROG ?= ./ctn2 # Program we are building
  2. PACK ?= ./pack # Packing executable
  3. DELETE = rm -rf # Command to remove files
  4. GZIP ?= gzip # For compressing files in web_root/
  5. OUT ?= -o $(PROG) # Compiler argument for output file
  6. SOURCES = main.c mongoose.c net.c appl.c\
  7. ./libmodbus/src/modbus.c \
  8. ./libmodbus/src/modbus-data.c \
  9. ./libmodbus/src/modbus-rtu.c \
  10. ./libmodbus/src/modbus-tcp.c \
  11. ./freemodbus/modbus/ascii/mbascii.c \
  12. ./freemodbus/modbus/functions/mbfunccoils.c \
  13. ./freemodbus/modbus/functions/mbfuncdiag.c \
  14. ./freemodbus/modbus/functions/mbfuncdisc.c \
  15. ./freemodbus/modbus/functions/mbfuncholding.c \
  16. ./freemodbus/modbus/functions/mbfuncinput.c \
  17. ./freemodbus/modbus/functions/mbfuncother.c \
  18. ./freemodbus/modbus/functions/mbutils.c \
  19. ./freemodbus/modbus/rtu/mbcrc.c \
  20. ./freemodbus/modbus/rtu/mbrtu.c \
  21. ./freemodbus/modbus/tcp/mbtcp.c \
  22. ./freemodbus/modbus/mb.c \
  23. ./freemodbus/port/portevent.c \
  24. ./freemodbus/port/portother.c \
  25. ./freemodbus/port/portserial.c \
  26. ./freemodbus/port/porttcp.c \
  27. ./freemodbus/port/porttimer.c \
  28. ./paho.mqtt.c-1.3.9/src/Base64.c \
  29. ./paho.mqtt.c-1.3.9/src/Clients.c \
  30. ./paho.mqtt.c-1.3.9/src/Heap.c \
  31. ./paho.mqtt.c-1.3.9/src/LinkedList.c \
  32. ./paho.mqtt.c-1.3.9/src/Log.c \
  33. ./paho.mqtt.c-1.3.9/src/Messages.c \
  34. ./paho.mqtt.c-1.3.9/src/MQTTClient.c \
  35. ./paho.mqtt.c-1.3.9/src/MQTTPacket.c \
  36. ./paho.mqtt.c-1.3.9/src/MQTTPacketOut.c \
  37. ./paho.mqtt.c-1.3.9/src/MQTTPersistence.c \
  38. ./paho.mqtt.c-1.3.9/src/MQTTPersistenceDefault.c \
  39. ./paho.mqtt.c-1.3.9/src/MQTTProperties.c \
  40. ./paho.mqtt.c-1.3.9/src/MQTTProtocolClient.c \
  41. ./paho.mqtt.c-1.3.9/src/MQTTProtocolOut.c \
  42. ./paho.mqtt.c-1.3.9/src/MQTTReasonCodes.c \
  43. ./paho.mqtt.c-1.3.9/src/MQTTTime.c \
  44. ./paho.mqtt.c-1.3.9/src/OsWrapper.c \
  45. ./paho.mqtt.c-1.3.9/src/SHA1.c \
  46. ./paho.mqtt.c-1.3.9/src/Socket.c \
  47. ./paho.mqtt.c-1.3.9/src/SocketBuffer.c \
  48. ./paho.mqtt.c-1.3.9/src/SSLSocket.c \
  49. ./paho.mqtt.c-1.3.9/src/StackTrace.c \
  50. ./paho.mqtt.c-1.3.9/src/Thread.c \
  51. ./paho.mqtt.c-1.3.9/src/Tree.c \
  52. ./paho.mqtt.c-1.3.9/src/utf-8.c \
  53. ./paho.mqtt.c-1.3.9/src/WebSocket.c
  54. CFLAGS = -w -g -I. -I./libmodbus -I./libmodbus/src -I./freemodbus/port -I./freemodbus/modbus/ascii -I./freemodbus/modbus/include -I./freemodbus/modbus/rtu -I./freemodbus/modbus/tcp -I./paho.mqtt.c-1.3.9/src
  55. CFLAGS_EXTRA = -lpthread
  56. NPX ?= npx
  57. # em-500
  58. CC=arm-linux-gnueabihf-gcc
  59. # HTNICE GT6517
  60. #CC=arm-linux-gcc -std=c99
  61. # Mongoose build options. See https://mongoose.ws/documentation/#build-options
  62. CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=0
  63. ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
  64. PROG = ctn2.exe # Use .exe suffix for the binary
  65. PACK = pack.exe # Packing executable
  66. CC = gcc # Use MinGW gcc compiler
  67. CFLAGS += -lws2_32 # Link against Winsock library
  68. DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
  69. GZIP = echo # No gzip on Windows
  70. endif
  71. # Default target. Build and run program
  72. all: $(PROG)
  73. # $(RUN) $(PROG) $(ARGS)
  74. # Build program from sources
  75. $(PROG): $(SOURCES)
  76. $(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
  77. # Cleanup. Delete built program and all build artifacts
  78. clean:
  79. $(DELETE) $(PROG) $(PACK) *.o *.obj *.exe *.dSYM mbedtls