summaryrefslogtreecommitdiff
path: root/project/codegen.mk
diff options
context:
space:
mode:
Diffstat (limited to 'project/codegen.mk')
-rw-r--r--project/codegen.mk76
1 files changed, 74 insertions, 2 deletions
diff --git a/project/codegen.mk b/project/codegen.mk
index fe1b610..a7430af 100644
--- a/project/codegen.mk
+++ b/project/codegen.mk
@@ -4,9 +4,32 @@ clean-gen:
rm -f gen.tag
rm -f $(GEN_IR_SRCS)
rm -f $(GEN_IR_HEADERS)
+ rm -f $(GEN_EMITTER_SRCS)
+ rm -f $(GEN_EMITTER_HEADERS)
+ rm -f $(GEN_BE_DIR_ARM)/emitter.tag
+ rm -f $(GEN_BE_DIR_AMD64)/emitter.tag
+ rm -f $(GEN_BE_DIR_IA32)/emitter.tag
+ rm -f $(GEN_BE_DIR_SPARC)/emitter.tag
+ rm -f $(GEN_BE_DIR_TEMPLATE)/emitter.tag
GEN_ALL = $(GEN_IR_SRCS) \
$(GEN_IR_HEADERS) \
+ $(GEN_EMITTER_SRCS) \
+ $(GEN_EMITTER_HEADERS) \
+
+
+# build/gen/ir/be
+GEN_BE_DIR_ARM = build/gen/ir/be/arm
+GEN_BE_DIR_AMD64 = build/gen/ir/be/amd64
+GEN_BE_DIR_IA32 = build/gen/ir/be/ia32
+GEN_BE_DIR_SPARC = build/gen/ir/be/sparc
+GEN_BE_DIR_TEMPLATE = build/gen/ir/be/TEMPLATE
+
+GEN_SPEC_ARM = $(SOURCE_DIR)/ir/be/arm/arm_spec.pl
+GEN_SPEC_AMD64 = $(SOURCE_DIR)/ir/be/amd64/amd64_spec.pl
+GEN_SPEC_IA32 = $(SOURCE_DIR)/ir/be/ia32/ia32_spec.pl
+GEN_SPEC_SPARC = $(SOURCE_DIR)/ir/be/sparc/sparc_spec.pl
+GEN_SPEC_TEMPLATE = $(SOURCE_DIR)/ir/be/TEMPLATE/TEMPLATE_spec.pl
# gen-ir
@@ -30,10 +53,59 @@ build/gen/include/libfirm/nodes.h: $(SOURCE_DIR)/scripts/templates/nodes.h \
+# gen-emitter
+GEN_EMITTER_TOOL = $(SOURCE_DIR)/ir/be/scripts/generate_emitter.pl
+
+
+$(GEN_BE_DIR_ARM)/emitter.tag: $(GEN_EMITTER_TOOL) $(GEN_SPEC_ARM)
+ $(GEN_EMITTER_TOOL) $(GEN_SPEC_ARM) $(GEN_BE_DIR_ARM)
+ touch $@
+
+
+$(GEN_BE_DIR_AMD64)/emitter.tag: $(GEN_EMITTER_TOOL) $(GEN_SPEC_AMD64)
+ $(GEN_EMITTER_TOOL) $(GEN_SPEC_AMD64) $(GEN_BE_DIR_AMD64)
+ touch $@
+
+
+$(GEN_BE_DIR_IA32)/emitter.tag: $(GEN_EMITTER_TOOL) $(GEN_SPEC_IA32)
+ $(GEN_EMITTER_TOOL) $(GEN_SPEC_IA32) $(GEN_BE_DIR_IA32)
+ touch $@
+
+
+$(GEN_BE_DIR_SPARC)/emitter.tag: $(GEN_EMITTER_TOOL) $(GEN_SPEC_SPARC)
+ $(GEN_EMITTER_TOOL) $(GEN_SPEC_SPARC) $(GEN_BE_DIR_SPARC)
+ touch $@
+
+
+$(GEN_BE_DIR_TEMPLATE)/emitter.tag: $(GEN_EMITTER_TOOL) $(GEN_SPEC_TEMPLATE)
+ $(GEN_EMITTER_TOOL) $(GEN_SPEC_TEMPLATE) $(GEN_BE_DIR_TEMPLATE)
+ touch $@
+
+
+
+$(GEN_BE_DIR_ARM)/gen_arm_emitter.c: $(GEN_BE_DIR_ARM)/emitter.tag
+$(GEN_BE_DIR_ARM)/gen_arm_emitter.h: $(GEN_BE_DIR_ARM)/emitter.tag
+
+$(GEN_BE_DIR_AMD64)/gen_amd64_emitter.c: $(GEN_BE_DIR_AMD64)/emitter.tag
+$(GEN_BE_DIR_AMD64)/gen_amd64_emitter.h: $(GEN_BE_DIR_AMD64)/emitter.tag
+
+$(GEN_BE_DIR_IA32)/gen_ia32_emitter.c: $(GEN_BE_DIR_IA32)/emitter.tag
+$(GEN_BE_DIR_IA32)/gen_ia32_emitter.h: $(GEN_BE_DIR_IA32)/emitter.tag
+
+$(GEN_BE_DIR_SPARC)/gen_sparc_emitter.c: $(GEN_BE_DIR_SPARC)/emitter.tag
+$(GEN_BE_DIR_SPARC)/gen_sparc_emitter.h: $(GEN_BE_DIR_SPARC)/emitter.tag
+
+$(GEN_BE_DIR_TEMPLATE)/gen_TEMPLATE_emitter.c: $(GEN_BE_DIR_TEMPLATE)/emitter.tag
+$(GEN_BE_DIR_TEMPLATE)/gen_TEMPLATE_emitter.h: $(GEN_BE_DIR_TEMPLATE)/emitter.tag
+
+
+
# gen-all
gen-ir: $(GEN_IR_SRCS) $(GEN_IR_HEADERS)
-gen-all: gen-ir
+gen-emitter: $(GEN_EMITTER_SRCS) $(GEN_EMITTER_HEADERS)
+
+gen-all: gen-ir gen-emitter
gen.tag: $(GEN_ALL)
touch gen.tag
@@ -43,4 +115,4 @@ gen: gen.tag
.PHONY: clean-gen \
gen gen-all \
- gen-ir
+ gen-ir gen-emitter