aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-24 11:26:42 +0200
committerMattias Andrée <maandree@kth.se>2024-08-24 11:26:42 +0200
commit3a73ab675a19e2ea29b4cb1385db0188ce4997f8 (patch)
treeb010de454a833b01fe2ed469fd4f0fd699c59e50 /Makefile
parentTest partial byte support in SHA1 and SHA-224 (diff)
downloadlibhashsum-3a73ab675a19e2ea29b4cb1385db0188ce4997f8.tar.gz
libhashsum-3a73ab675a19e2ea29b4cb1385db0188ce4997f8.tar.bz2
libhashsum-3a73ab675a19e2ea29b4cb1385db0188ce4997f8.tar.xz
Make algorithms optional
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile53
1 files changed, 49 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index f1cfb34..eb9004c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,21 @@
.POSIX:
+
+# This are overwritten in $(CONFIGFILE), however they
+# are added so that they are always defined even if
+# the use has an out of date version of config.mk
+DEFAULT_SUPPORT = yes
+SUPPORT_SHA1 = $(DEFAULT_SUPPORT)
+SUPPORT_SHA2 = $(DEFAULT_SUPPORT)
+SUPPORT_MD2 = $(DEFAULT_SUPPORT)
+SUPPORT_MD4 = $(DEFAULT_SUPPORT)
+SUPPORT_MD5 = $(DEFAULT_SUPPORT)
+SUPPORT_RIPEMD_128 = $(DEFAULT_SUPPORT)
+SUPPORT_RIPEMD_160 = $(DEFAULT_SUPPORT)
+SUPPORT_RIPEMD_256 = $(DEFAULT_SUPPORT)
+SUPPORT_RIPEMD_320 = $(DEFAULT_SUPPORT)
+
+
CONFIGFILE = config.mk
include $(CONFIGFILE)
@@ -16,6 +32,35 @@ LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
LIB_NAME = hashsum
+include mk/md2=$(SUPPORT_MD2).mk
+include mk/md4=$(SUPPORT_MD4).mk
+include mk/md5=$(SUPPORT_MD5).mk
+include mk/ripemd-128=$(SUPPORT_RIPEMD_128).mk
+include mk/ripemd-160=$(SUPPORT_RIPEMD_160).mk
+include mk/ripemd-256=$(SUPPORT_RIPEMD_256).mk
+include mk/ripemd-320=$(SUPPORT_RIPEMD_320).mk
+include mk/sha1=$(SUPPORT_SHA1).mk
+include mk/sha2=$(SUPPORT_SHA2).mk
+
+
+CPPFLAGS_FULL =\
+ $(CPPFLAGS)\
+ $(CPPFLAGS_MD2)\
+ $(CPPFLAGS_MD4)\
+ $(CPPFLAGS_MD5)\
+ $(CPPFLAGS_RIPEMD_128)\
+ $(CPPFLAGS_RIPEMD_160)\
+ $(CPPFLAGS_RIPEMD_256)\
+ $(CPPFLAGS_RIPEMD_320)\
+ $(CPPFLAGS_SHA1)\
+ $(CPPFLAGS_SHA2)
+
+LDFLAGS_FULL =\
+ $(LDFLAGS)\
+ $(LDFLAGS_SHA1)\
+ $(LDFLAGS_SHA2)
+
+
OBJ =\
libhashsum_init_hasher.o\
libhashsum_init_md2_hasher.o\
@@ -68,16 +113,16 @@ $(TOBJ): $(HDR)
$(TEST): libhashsum.a
.c.o:
- $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+ $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS_FULL)
.c.lo:
- $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+ $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS_FULL)
.c.t:
- $(CC) -o $@ $< libhashsum.a $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+ $(CC) -o $@ $< libhashsum.a $(CFLAGS) $(CPPFLAGS_FULL) $(LDFLAGS_FULL)
.o.t:
- $(CC) -o $@ $< libhashsum.a $(LDFLAGS)
+ $(CC) -o $@ $< libhashsum.a $(LDFLAGS_FULL)
libhashsum.a: $(OBJ)
@rm -f -- $@