From 390b3a0e012f6bd666f5d941cee1116b95de4800 Mon Sep 17 00:00:00 2001 From: Tobias Langer Date: Thu, 6 Oct 2016 16:30:32 +0200 Subject: [PATCH] Support for multiple templates. --- generate.py | 6 +++--- template/Makefile | 23 ----------------------- template/defines.h | 38 -------------------------------------- template/experiment.cpp | 0 templates/normal/Makefile | 23 +++++++++++++++++++++++ templates/normal/defines.h | 38 ++++++++++++++++++++++++++++++++++++++ templates/normal/experiment.cpp | 0 7 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 template/Makefile delete mode 100644 template/defines.h delete mode 100644 template/experiment.cpp create mode 100644 templates/normal/Makefile create mode 100644 templates/normal/defines.h create mode 100644 templates/normal/experiment.cpp diff --git a/generate.py b/generate.py index a701d5c..660289d 100755 --- a/generate.py +++ b/generate.py @@ -73,9 +73,9 @@ def main(): parser = argparse.ArgumentParser(description='Generate experiment data.') parser.add_argument('description', type=str, nargs='+', help='file containing the taskset description.') - parser.add_argument('--header', dest='header', type=str, nargs='?', default='./template/defines.h', help='path to optional custom header file.') - parser.add_argument('--makefile', dest='makefile', type=str, nargs='?', default='./template/Makefile', help='path to optional custom makefile.') - parser.add_argument('--cpp', dest='cpp', type=str, nargs='*', default='./template/experiment.cpp', help='path to optional custom c++ implementation.') + parser.add_argument('--header', dest='header', type=str, nargs='?', default='./templates/normal/defines.h', help='path to optional custom header file.') + parser.add_argument('--makefile', dest='makefile', type=str, nargs='?', default='./templates/normal/Makefile', help='path to optional custom makefile.') + parser.add_argument('--cpp', dest='cpp', type=str, nargs='*', default='./templates/normal/experiment.cpp', help='path to optional custom c++ implementation.') args = parser.parse_args() cwd = os.getcwd() diff --git a/template/Makefile b/template/Makefile deleted file mode 100644 index d48482a..0000000 --- a/template/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -NAME=$(notdir $(CURDIR)) - -CXX=clang++ -LD=clang++ -EMBB_PATH=/home/lat39910/promotion/code/embb_build -LDFLAGS=-L$(EMBB_PATH)/lib -pthread -LIBS= -lembb_dataflow_cpp -lembb_algorithms_cpp -lembb_containers_cpp -lembb_mtapi_cpp -lembb_mtapi_c -lembb_base_cpp -lembb_base_c -CXXFLAGS=-Wall -Werror -O3 -std=c++11 -g -INCLUDE=-I$(EMBB_PATH)/include -SRC=$(wildcard *.cpp) -OBJ=$(patsubst %.cpp,%.o,$(SRC)) - -.PHONY: all clean - -$(NAME): $(OBJ) - $(LD) -o $@ $(LDFLAGS) $^ $(LIBS) - -%.o: %.cpp - $(CXX) -c $(CXXFLAGS) $(INCLUDE) $^ - -clean: - rm -f $(NAME) - rm -f $(OBJ) diff --git a/template/defines.h b/template/defines.h deleted file mode 100644 index 7190368..0000000 --- a/template/defines.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Automatically generated declarations for the experiment. - * Plese don't modify manually, but use the generator.py script. - */ - -{{#includes}} -#include {{{name}}} -{{/includes}} - -{{#data_description}} -struct {{name}} { - {{#fields}} - {{type}} {{name}}; - {{/fields}} -}; - -{{/data_description}} -{{#data}} -{{type}} {{name}}[] = { -{{#elem}} - { - .offset = {{offset}}, - .wcet = {{wcet}}, - .period = {{period}}, - .deadline = {{deadline}}, - .periodical = {{periodical}}, - }, -{{/elem}} -}; -const int {{name}}_length = sizeof({{name}}) / sizeof({{type}}); - -{{/data}} -{{#executions}} -const int NUM_EXECUTIONS = {{executions}}; -{{/executions}} -{{^executions}} -const int NUM_EXECUTIONS = 1; -{{/executions}} diff --git a/template/experiment.cpp b/template/experiment.cpp deleted file mode 100644 index e69de29..0000000 --- a/template/experiment.cpp +++ /dev/null diff --git a/templates/normal/Makefile b/templates/normal/Makefile new file mode 100644 index 0000000..d48482a --- /dev/null +++ b/templates/normal/Makefile @@ -0,0 +1,23 @@ +NAME=$(notdir $(CURDIR)) + +CXX=clang++ +LD=clang++ +EMBB_PATH=/home/lat39910/promotion/code/embb_build +LDFLAGS=-L$(EMBB_PATH)/lib -pthread +LIBS= -lembb_dataflow_cpp -lembb_algorithms_cpp -lembb_containers_cpp -lembb_mtapi_cpp -lembb_mtapi_c -lembb_base_cpp -lembb_base_c +CXXFLAGS=-Wall -Werror -O3 -std=c++11 -g +INCLUDE=-I$(EMBB_PATH)/include +SRC=$(wildcard *.cpp) +OBJ=$(patsubst %.cpp,%.o,$(SRC)) + +.PHONY: all clean + +$(NAME): $(OBJ) + $(LD) -o $@ $(LDFLAGS) $^ $(LIBS) + +%.o: %.cpp + $(CXX) -c $(CXXFLAGS) $(INCLUDE) $^ + +clean: + rm -f $(NAME) + rm -f $(OBJ) diff --git a/templates/normal/defines.h b/templates/normal/defines.h new file mode 100644 index 0000000..7190368 --- /dev/null +++ b/templates/normal/defines.h @@ -0,0 +1,38 @@ +/** + * Automatically generated declarations for the experiment. + * Plese don't modify manually, but use the generator.py script. + */ + +{{#includes}} +#include {{{name}}} +{{/includes}} + +{{#data_description}} +struct {{name}} { + {{#fields}} + {{type}} {{name}}; + {{/fields}} +}; + +{{/data_description}} +{{#data}} +{{type}} {{name}}[] = { +{{#elem}} + { + .offset = {{offset}}, + .wcet = {{wcet}}, + .period = {{period}}, + .deadline = {{deadline}}, + .periodical = {{periodical}}, + }, +{{/elem}} +}; +const int {{name}}_length = sizeof({{name}}) / sizeof({{type}}); + +{{/data}} +{{#executions}} +const int NUM_EXECUTIONS = {{executions}}; +{{/executions}} +{{^executions}} +const int NUM_EXECUTIONS = 1; +{{/executions}} diff --git a/templates/normal/experiment.cpp b/templates/normal/experiment.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/templates/normal/experiment.cpp -- libgit2 0.26.0