summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorNicolas Schodet2010-02-03 16:33:25 +0100
committerNicolas Schodet2011-08-03 11:08:51 +0200
commit8a7a4c0fb7c16f2d988c18ea9640a49f805584b9 (patch)
treea8539cddeb80b74bb33b5110b568bf49949530c8 /cesar/cp
parent7edb1c82c2eb55c87a3f7616b67622606e4db2ee (diff)
cesar: adapt Module files for multiple inclusion
Module files are now included several times by the build system. Also, there can be several build types other than host and target.
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/fsm/Module44
1 files changed, 21 insertions, 23 deletions
diff --git a/cesar/cp/fsm/Module b/cesar/cp/fsm/Module
index a72f9d91b6..d93ecce9d8 100644
--- a/cesar/cp/fsm/Module
+++ b/cesar/cp/fsm/Module
@@ -1,39 +1,37 @@
SOURCES := tables.c fsm.c events.c
-cp_fsm_defs_h = $(OBJ_DIR)/inc/cp_fsm_defs.h
-cp_fsm_tables_h = $(OBJ_DIR)/inc/cp_fsm_tables.h
+ifndef $(MODULE_VAR)_ONCE
+$(MODULE_VAR)_ONCE := 1$(CONFIG_CP_FSM_DEF)
+
+cp_fsm_defs_h := $(OBJ_INC_DIR)/cp_fsm_defs.h
+cp_fsm_tables_h = $(OBJ_INC_DIR)/cp_fsm_tables.h
CLEAN_FILES += $(cp_fsm_defs_h) $(cp_fsm_tables_h)
-$(call src2obj,cp/fsm/src/tables.c,host): $(cp_fsm_tables_h)
-$(call src2obj,cp/fsm/src/tables.c,target): $(cp_fsm_tables_h)
COMPILE_DEPS += $(cp_fsm_defs_h)
-vpath %.fsm $(BASE)
-vpath %.conf $(BASE)
-vpath %_defs.h $(BASE)
-vpath %_tables.h $(BASE)
-
cp_fsm_deps = $(CONFIG_CP_FSM_DEF:"%"=%) \
$(call src2src,cp.conf template_defs.h \
- template_tables.h,cp/fsm/src/fsm)
-
-dfagen = $(TOOLS_DIR)/dfagen/dfagen.py
-
-$(dfagen): $(TOOLS_DIR)/dfagen/dfagen/parser.py
+ template_tables.h,$(MODULE)/src/fsm)
-$(TOOLS_DIR)/dfagen/dfagen/parser.py:: $(TOOLS_DIR)/dfagen/dfagen/parser.g
- yapps $<
-
-$(cp_fsm_defs_h) $(cp_fsm_tables_h): $(cp_fsm_deps) $(dfagen) \
+$(cp_fsm_defs_h) $(cp_fsm_tables_h): $(cp_fsm_deps) $(DFAGEN) \
$(OBJ_INC_DIR_STAMP)
- python $(dfagen) -O $(OBJ_INC_DIR) \
+ python $(DFAGEN) -O $(OBJ_INC_DIR) \
-o c -d $< -c $(filter %.conf,$^) -p cp_fsm
CLEAN_FILES += $(OBJ_DIR)/cp_fsm.png $(OBJ_DIR)/cp_fsm.dot
-$(OBJ_DIR)/cp_fsm.png: $(OBJ_DIR)/cp_fsm.dot
+$(OBJ_DIR)/cp_fsm.png: $(OBJ_DIR)/cp_fsm.dot $(OBJ_DIR_STAMP)
dot -Tpng -o $@ $<
-$(OBJ_DIR)/cp_fsm.dot: $(cp_fsm_deps)
- python $(TOOLS_DIR)/dfagen/dfagen.py -O $(OBJ_DIR) \
- -o dot -d $< -p cp_fsm
+$(OBJ_DIR)/cp_fsm.dot: $(cp_fsm_deps) $(DFAGEN) $(OBJ_DIR_STAMP)
+ python $(DFAGEN) -O $(OBJ_DIR) -o dot -d $< -p cp_fsm
+
+$(call src2obj,cp/fsm/src/tables.c,target): $(cp_fsm_tables_h)
+
+else
+# This module rules depend on a configuration item, it need work to be used in
+# several build type.
+ifneq ($($(MODULE_VAR)_ONCE),1$(CONFIG_CP_FSM_DEF))
+$(error Module not safe for multiple build types)
+endif
+endif