Makefile 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ### Environment constants
  2. ARCH := arm
  3. #CROSS_COMPILE := ../../buildroot-at91-2018.02-at91/output/host/bin/arm-linux-
  4. #CROSS_COMPILE := /home/logan/EmbeddedProject/RTU/buildroot/buildroot-at91-2018.02-at91/output/host/bin/arm-linux-
  5. OBJDIR = obj
  6. INCLUDES = $(wildcard inc/*.h)
  7. ### External constant definitions
  8. # must get library build option to know if mpsse must be linked or not
  9. ### Constant symbols
  10. #CC := $(CROSS_COMPILE)gcc
  11. #AR := $(CROSS_COMPILE)ar
  12. CC := $(CROSS_COMPILE)gcc
  13. AR := $(CROSS_COMPILE)ar
  14. RANLIB := $(CROSS_COMPILE)ranlib
  15. CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I.
  16. # List the library sub-modules that are used by the application
  17. ### Linking options
  18. LIBS := -lmosquitto -lsqlite3 -ljson-c -lrt -lpthread -lm
  19. ### General build targets
  20. all: get_device.cgi set_device.cgi add_device.cgi del_device.cgi get_system.cgi \
  21. get_user.cgi get_platform.cgi set_platform.cgi login.cgi logout.cgi
  22. clean:
  23. rm -f *.o
  24. rm -f get_device.cgi set_device.cgi add_device.cgi del_device.cgi get_system.cgi \
  25. get_user.cgi get_platform.cgi set_platform.cgi login.cgi logout.cgi
  26. ### Sub-modules compilation
  27. libcgic.a: cgic.o cgic.h
  28. rm -f libcgic.a
  29. $(AR) rc libcgic.a cgic.o
  30. $(RANLIB) libcgic.a
  31. %.o: %.c
  32. $(CC) $(CFLAGS) -c $< -o $@
  33. get_device.cgi:get_device.o common.o command.o
  34. $(CC) $^ -o $@ $(LIBS)
  35. set_device.cgi:set_device.o common.o command.o
  36. $(CC) $^ -o $@ $(LIBS)
  37. add_device.cgi:add_device.o common.o command.o
  38. $(CC) $^ -o $@ $(LIBS)
  39. del_device.cgi:del_device.o common.o command.o
  40. $(CC) $^ -o $@ $(LIBS)
  41. get_system.cgi:get_system.o common.o command.o
  42. $(CC) $^ -o $@ $(LIBS)
  43. get_user.cgi:get_user.o common.o command.o
  44. $(CC) $^ -o $@ $(LIBS)
  45. get_platform.cgi:get_platform.o common.o command.o
  46. $(CC) $^ -o $@ $(LIBS)
  47. set_platform.cgi:set_platform.o common.o command.o
  48. $(CC) $^ -o $@ $(LIBS)
  49. login.cgi:login.o common.o command.o
  50. $(CC) $^ -o $@ $(LIBS)
  51. logout.cgi:logout.o common.o command.o
  52. $(CC) $^ -o $@ $(LIBS)
  53. install:
  54. echo "install"
  55. cp -rf ../dist/index.html /var/www/
  56. cp -rf ../dist/static /var/www/
  57. cp -rf cookie /var/www/cgi-bin/
  58. cp *.cgi /var/www/cgi-bin/
  59. ### EOF