From f98ae1ccab437098f844ced551e07102a9f67073 Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 31 Oct 2016 17:14:32 -0400 Subject: build system: code generation: added the gen-ir build target. --- project/codegen.mk | 46 ++++++++++++++++++++++++++++++++++++++++++++++ project/common.mk | 3 +++ project/extras.mk | 1 + project/headers.mk | 4 ++++ project/tree.mk | 6 ++++++ 5 files changed, 60 insertions(+) create mode 100644 project/codegen.mk (limited to 'project') diff --git a/project/codegen.mk b/project/codegen.mk new file mode 100644 index 0000000..fe1b610 --- /dev/null +++ b/project/codegen.mk @@ -0,0 +1,46 @@ +clean: clean-gen + +clean-gen: + rm -f gen.tag + rm -f $(GEN_IR_SRCS) + rm -f $(GEN_IR_HEADERS) + +GEN_ALL = $(GEN_IR_SRCS) \ + $(GEN_IR_HEADERS) \ + + +# gen-ir +GEN_IR_TOOL = $(SOURCE_DIR)/scripts/gen_ir.py +GEN_IR_SPEC = $(SOURCE_DIR)/scripts/ir_spec.py + + +build/gen/ir/ir/%.c: $(SOURCE_DIR)/scripts/templates/%.c \ + $(GEN_IR_TOOL) $(GEN_IR_SPEC) tree.tag + $(GEN_IR_TOOL) $(GEN_IR_SPEC) $< > $@ + + +build/gen/ir/ir/%.h: $(SOURCE_DIR)/scripts/templates/%.h \ + $(GEN_IR_TOOL) $(GEN_IR_SPEC) tree.tag + $(GEN_IR_TOOL) $(GEN_IR_SPEC) $< > $@ + + +build/gen/include/libfirm/nodes.h: $(SOURCE_DIR)/scripts/templates/nodes.h \ + $(GEN_IR_TOOL) $(GEN_IR_SPEC) tree.tag + $(GEN_IR_TOOL) $(GEN_IR_SPEC) $< > $@ + + + +# gen-all +gen-ir: $(GEN_IR_SRCS) $(GEN_IR_HEADERS) + +gen-all: gen-ir + +gen.tag: $(GEN_ALL) + touch gen.tag + +gen: gen.tag + + +.PHONY: clean-gen \ + gen gen-all \ + gen-ir diff --git a/project/common.mk b/project/common.mk index e69de29..a479c01 100644 --- a/project/common.mk +++ b/project/common.mk @@ -0,0 +1,3 @@ +GEN_IR_SRCS = \ + build/gen/ir/ir/gen_irio.c \ + build/gen/ir/ir/gen_irnode.c \ diff --git a/project/extras.mk b/project/extras.mk index e69de29..cc65b9d 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -0,0 +1 @@ +include $(PROJECT_DIR)/project/codegen.mk diff --git a/project/headers.mk b/project/headers.mk index e69de29..9649bf9 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -0,0 +1,4 @@ +GEN_IR_HEADERS = \ + build/gen/ir/ir/gen_irnode.h \ + build/gen/ir/ir/gen_proj_names.h \ + build/gen/include/libfirm/nodes.h \ diff --git a/project/tree.mk b/project/tree.mk index 52f79f7..2642cbd 100644 --- a/project/tree.mk +++ b/project/tree.mk @@ -1,2 +1,8 @@ tree.tag: + mkdir -p build + mkdir -p build/gen + mkdir -p build/gen/ir + mkdir -p build/gen/ir/ir + mkdir -p build/gen/include + mkdir -p build/gen/include/libfirm touch tree.tag -- cgit v1.2.3