summaryrefslogtreecommitdiffhomepage
path: root/digital/ucoolib
diff options
context:
space:
mode:
Diffstat (limited to 'digital/ucoolib')
-rw-r--r--digital/ucoolib/build/arch.mk8
-rwxr-xr-xdigital/ucoolib/build/tools/crc13
-rw-r--r--digital/ucoolib/build/top.mk3
3 files changed, 21 insertions, 3 deletions
diff --git a/digital/ucoolib/build/arch.mk b/digital/ucoolib/build/arch.mk
index 62f0687c..99f0c5f2 100644
--- a/digital/ucoolib/build/arch.mk
+++ b/digital/ucoolib/build/arch.mk
@@ -88,16 +88,17 @@ define arch_bin_rules
hex: hex.$1
srec: srec.$1
bin: bin.$1
+crc: crc.$1
all.$1: hex.$1
ifneq ($$(wildcard *.$1.srec),)
all.$1: srec.$1
endif
ifneq ($$(wildcard *.$1.bin),)
-all.$1: bin.$1
+all.$1: bin.$1 crc.$1
endif
-.PHONY: hex.$1 srec.$1 bin.$1
+.PHONY: hex.$1 srec.$1 bin.$1 crc.$1
hex.$1: $$($1_PROGS:%=%.$1.hex)
srec.$1: $$($1_PROGS:%=%.$1.srec)
@@ -113,6 +114,9 @@ bin.$1: $$($1_PROGS:%=%.$1.bin)
@echo "BIN [$1] $$@"
$$Q$$($1_OBJCOPY) -O binary $$< $$@
+crc.$1: $$($1_PROGS:%=%.$1.bin)
+ $Q$$(BASE)/build/tools/crc $$^
+
$1_EXTRA_CLEAN += $$($1_PROGS:%=%.$1.hex) \
$$($1_PROGS:%=%.$1.srec) \
$$($1_PROGS:%=%.$1.bin)
diff --git a/digital/ucoolib/build/tools/crc b/digital/ucoolib/build/tools/crc
new file mode 100755
index 00000000..cb85a7ff
--- /dev/null
+++ b/digital/ucoolib/build/tools/crc
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+"""Output CRC32 of files."""
+import optparse
+import zlib
+
+parser = optparse.OptionParser(usage='%prog [options] files...')
+options, args = parser.parse_args()
+
+for f in args:
+ with open(f) as fd:
+ content = fd.read()
+ crc = zlib.crc32(content) & 0xffffffff
+ print '%08x %s' % (crc, f)
diff --git a/digital/ucoolib/build/top.mk b/digital/ucoolib/build/top.mk
index d4f53fe4..5d87aa65 100644
--- a/digital/ucoolib/build/top.mk
+++ b/digital/ucoolib/build/top.mk
@@ -33,11 +33,12 @@ size:
hex:
srec:
bin:
+crc:
clean:
rmdir $(OBJDIR) 2> /dev/null || true
-.PHONY: all lst size hex srec bin clean
+.PHONY: all lst size hex srec bin crc clean
# Modules and sources setup.