summaryrefslogtreecommitdiff
path: root/digital/io/src/Makefile
diff options
context:
space:
mode:
authorNicolas Schodet2008-03-31 13:04:31 +0200
committerNicolas Schodet2008-03-31 13:04:31 +0200
commitf116d65d4310bf443ab6590a3328d1387094a730 (patch)
treecd041978274bdf3a78de003ed0fd694a9420bd5d /digital/io/src/Makefile
parent9d3573134462335051e46b990e97e1d32bef4b29 (diff)
* digital/io/src:
- added callback function file merge strategies.
Diffstat (limited to 'digital/io/src/Makefile')
-rw-r--r--digital/io/src/Makefile40
1 files changed, 38 insertions, 2 deletions
diff --git a/digital/io/src/Makefile b/digital/io/src/Makefile
index 35a58a6a..e263479b 100644
--- a/digital/io/src/Makefile
+++ b/digital/io/src/Makefile
@@ -18,6 +18,17 @@ include $(BASE)/make/Makefile.gen
# The %_cb.c file can not be auto-generated. When the %_cb_skel.c is changed,
# user should check if they still are synchronised using a merge program, like
# vimdiff.
+#
+# To help user, the user can define the CB variable to request a particular
+# behaviour.
+#
+# If CB=touch, ignore the auto-generation and touch the %_cb.c file.
+#
+# If CB=vimdiff, use vimdiff to merge differences.
+#
+# If CB=merge, try to merge automatically. In this case, it uses a old copy
+# of %_cb_skel.c to merge. This will fail the first time if no old copy is
+# available.
# If templates are modified, files should be rebuilt.
FSM_TEMPLATES := template_cb.h template_cb_decl.h template_cb_impl.c \
@@ -39,9 +50,34 @@ DFAGEN = python $(BASE)/../../tools/dfagen/dfagen.py
%_fsm.h %_fsm.c %_cb.h %_cb_skel.c: %.fsm fsm.conf $(FSM_TEMPLATES)
$(DFAGEN) -o c -d $< -c fsm.conf -p $(<:%.fsm=%)
+ifndef CB
%_cb.c: %_cb_skel.c
- echo "Please update $@"
- false
+ @echo "Please update $@"
+ @false
+else ifeq ($(CB),touch)
+%_cb.c: %_cb_skel.c
+ @echo "Updating $@ blindly"
+ cp $< .$<.old
+ touch $@
+else ifeq ($(CB),merge)
+%_cb.c: %_cb_skel.c
+ @echo "Try to merge $@..."
+ @if [ -r .$<.old ]; then \
+ merge $@ .$<.old $<; \
+ RET=$$?; \
+ else \
+ echo "No history, cannot merge"; \
+ RET=1; \
+ fi; \
+ cp $< .$<.old; \
+ exit $$RET
+else
+%_cb.c: %_cb_skel.c
+ @echo "Using $(CB) to update $@"
+ cp $< .$<.old
+ $(CB) $@ $<
+endif
+
png: getsamples.png gutter.png