diff --git a/Makefile.include b/Makefile.include index ad2a7f29ab..c1439114a5 100644 --- a/Makefile.include +++ b/Makefile.include @@ -448,3 +448,6 @@ ifneq (,$(filter iotlab-m3 wsn430-v1_3b wsn430-v1_4,$(BOARD))) include $(RIOTBASE)/dist/testbed-support/Makefile.iotlab endif endif + +# Include desvirt Makefile +include $(RIOTBASE)/dist/tools/desvirt/Makefile.desvirt diff --git a/dist/tools/desvirt/0001-add-example-topology.patch b/dist/tools/desvirt/0001-add-example-topology.patch deleted file mode 100644 index 8d2017ca5e..0000000000 Binary files a/dist/tools/desvirt/0001-add-example-topology.patch and /dev/null differ diff --git a/dist/tools/desvirt/Makefile b/dist/tools/desvirt/Makefile deleted file mode 100644 index 1739f176e6..0000000000 --- a/dist/tools/desvirt/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -PKG_NAME=desvirt -PKG_URL=https://github.com/des-testbed/desvirt.git -PKG_VERSION=master -PKG_DIR=$(CURDIR)/$(PKG_NAME) - -.PHONY: all clean patch distclean desvirtdefine - -all: clean $(PKG_NAME) patch desvirtdefine - -patch: - cd "$(PKG_DIR)" && git am --ignore-whitespace "$(CURDIR)"/*.patch - -desvirtdefine: patch - $(foreach topology,$(shell ls $(PKG_NAME)/.desvirt/*.xml), \ - cd $(PKG_NAME) && \ - ./vnet --define --name "$(basename $(notdir $(topology)))";) - -$(PKG_NAME): - # Get $(PKG_VERSION) of package from $(PKG_URL) - $(if $(wildcard $(PKG_NAME)),cd $(CURDIR)/$(PKG_NAME) && \ - git clean -x -f && \ - git reset --hard $(PKG_VERSION) \ - , git clone $(PKG_URL) $(PKG_NAME) && \ - cd $(PKG_NAME) && \ - git reset --hard $(PKG_VERSION)) - -clean:: - # Reset package to checkout state. - $(if $(wildcard $(PKG_NAME)),cd $(CURDIR)/$(PKG_NAME) && \ - git clean -x -f && \ - git reset --hard $(PKG_VERSION) \ - , ) - -distclean:: - rm -rf $(CURDIR)/$(PKG_NAME) diff --git a/dist/tools/desvirt/Makefile.desvirt b/dist/tools/desvirt/Makefile.desvirt new file mode 100644 index 0000000000..c43a31cf4f --- /dev/null +++ b/dist/tools/desvirt/Makefile.desvirt @@ -0,0 +1,57 @@ +TOOL_NAME=desvirt +TOOL_URL=https://github.com/des-testbed/desvirt.git +TOOL_VERSION=master +TOOL_DIR=$(RIOTBASE)/dist/tools/$(TOOL_NAME)/$(TOOL_NAME) + +.PHONY: desvirt-check desvirt-check-topo-file desvirt-check-topo-args desvirt-clean \ + desvirt-distclean desvirt-define desvirt-undefine desvirt-start desvirt-stop desvirt-list + +desvirt-check: + + ifeq ($(wildcard $(TOOL_DIR)),) + git clone $(TOOL_URL) $(TOOL_DIR) + cd $(TOOL_DIR) && git reset --hard $(TOOL_VERSION) + endif + +desvirt-check-topo-file: desvirt-check + + ifndef TOPO + $(error TOPO is not set) + endif + +desvirt-check-topo-args: desvirt-check + + ifndef TOPO_TYPE + $(error TOPO_TYPE is not set) + endif + ifndef TOPO_SIZE + $(error TOPO_SIZE is not set) + endif + +desvirt-define: desvirt-check-topo-file + cd $(TOOL_DIR) && ./vnet -d $(TOOL_DIR)/.desvirt/$(TOPO_FLE) -n $(basename $(TOPO)) + +desvirt-undefine: desvirt-check-topo-file + cd $(TOOL_DIR) && ./vnet -u $(TOOL_DIR)/.desvirt/$(TOPO_FLE) -n $(basename $(TOPO)) + +desvirt-start: desvirt-check-topo-file + cd $(TOOL_DIR) && ./vnet -s -n $(basename $(TOPO)) + +desvirt-stop: desvirt-check-topo-file + cd $(TOOL_DIR) && ./vnet -q -n $(basename $(TOPO)) + +desvirt-topology: desvirt-check-topo-args all + cd $(TOOL_DIR) && \ + ./topology_creator -e $(ELFFILE) -n riot_native -r ieee802154 -s$(TOPO_SIZE) -t$(TOPO_TYPE) -f $(TOPO_TYPE)$(TOPO_SIZE) + +desvirt-list: desvirt-check + cd $(TOOL_DIR) && ./vnet -l + +desvirt-clean:: + + ifneq ($(wildcard $(TOOL_DIR)),"") + cd $(TOOL_DIR) && git clean -x -f && git reset --hard $(TOOL_VERSION) + endif + +desvirt-distclean:: + rm -rf $(TOOL_DIR)