summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-31 17:14:32 -0400
committermidipix <writeonce@midipix.org>2016-10-31 18:58:23 -0400
commitf98ae1ccab437098f844ced551e07102a9f67073 (patch)
treeaa7e81c67a210560c548ef36f127e7e522adcf8e /project
parent8be3778f436d9e60d9e33bc7bbd07a1453ecd1f6 (diff)
downloadbfirm-f98ae1ccab437098f844ced551e07102a9f67073.tar.bz2
bfirm-f98ae1ccab437098f844ced551e07102a9f67073.tar.xz
build system: code generation: added the gen-ir build target.
Diffstat (limited to 'project')
-rw-r--r--project/codegen.mk46
-rw-r--r--project/common.mk3
-rw-r--r--project/extras.mk1
-rw-r--r--project/headers.mk4
-rw-r--r--project/tree.mk6
5 files changed, 60 insertions, 0 deletions
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