You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
1.8 KiB

  1. LIBDIR:=$(DIR)/lib
  2. CLEAN += $(DIR)/lib/.libs
  3. CTRL_BLOCKS :=
  4. CTRL_BLOCK_LIBS :=
  5. CTRL_TESTS :=
  6. CTRL_TRIGGERS :=
  7. CTRL_TRIGGER_LIBS :=
  8. $(eval $(call SUBDIR,controller))
  9. $(eval $(call SUBDIR,shell))
  10. $(eval $(call SUBDIR,block))
  11. $(eval $(call SUBDIR,trigger))
  12. ifdef BUILD_ETHERCAT
  13. $(eval $(call SUBDIR,ec))
  14. endif
  15. $(eval $(call SUBDIR,packet))
  16. ifdef BUILD_TEST
  17. $(eval $(call SUBDIR,test))
  18. endif
  19. ifdef BUILD_VESP
  20. $(eval $(call SUBDIR,vesp))
  21. endif
  22. ifdef BUILD_AM335X
  23. $(eval $(call SUBDIR,am335x))
  24. endif
  25. ifdef BUILD_ATSAMX70
  26. $(eval $(call SUBDIR,atsamx70))
  27. endif
  28. DT_CTRL_TARGETS += $(DIR)/dt_ctrl
  29. DT_CTRL_SRCS := $(DIR)/dt_ctrl.c
  30. DT_CTRL_OBJS := $(DT_CTRL_SRCS:.c=.o)
  31. ifdef BUILD_EMBEDDED
  32. DT_CTRL_OBJS += $(DIR)/ctrl_embedded.o
  33. endif
  34. , := ,
  35. BLOCKS := $(addprefix -Wl$(,)-u -Wl$(,)block_,$(addsuffix _create_struct,$(CTRL_BLOCKS)))
  36. BLOCKS += $(addprefix -Wl$(,)-u -Wl$(,)block_,$(addsuffix _create,$(CTRL_BLOCKS)))
  37. BLOCKS += $(subst .la,,$(subst lib,-l,$(CTRL_BLOCK_LIBS)))
  38. TRIGGERS := $(addprefix -Wl$(,)-u -Wl$(,)trigger_,$(addsuffix _create_struct,$(CTRL_TRIGGERS)))
  39. TRIGGERS += $(subst .la,,$(subst lib,-l,$(CTRL_TRIGGER_LIBS)))
  40. $(DIR)/dt_ctrl: \
  41. libcontroller.la \
  42. liblog.la \
  43. $(CTRL_BLOCK_LIBS) \
  44. $(CTRL_TRIGGER_LIBS)
  45. $(DIR)/dt_ctrl_CFLAGS += -Wall -O3
  46. $(DIR)/dt_ctrl_LDFLAGS += \
  47. -Wl,-E \
  48. -lcontroller \
  49. -llog \
  50. $(BLOCKS) \
  51. $(TRIGGERS)
  52. $(DIR)/dt_ctrl: $(DT_CTRL_OBJS)
  53. ifdef BUILD_TCP
  54. $(DIR)/dt_ctrl: \
  55. libshell.la
  56. $(DIR)/dt_ctrl_LDFLAGS += \
  57. -lshell
  58. endif
  59. # Make test reports as part of the test target
  60. DT_CTRL_TESTS := $(CTRL_TESTS)
  61. DT_CTRL := $(DIR)/dt_ctrl
  62. test: $(DIR)/test.output
  63. $(DIR)/test.output: $(DT_CTRL_TESTS)
  64. $(DT_CTRL_TESTS): $(DT_CTRL)
  65. %.test.output: %.test.ctrl
  66. @echo "DT_CTRL $<"
  67. @$(DT_CTRL) $< >$@ || (rm $@ && false)
  68. SRCS += $(DT_CTRL_SRCS)
  69. TARGETS += $(DT_CTRL_TARGETS)
  70. CLEAN += $(DT_CTRL_TARGETS) $(DT_CTRL_OBJS) $(DT_CTRL_TESTS)