From 3a73ab675a19e2ea29b4cb1385db0188ce4997f8 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 24 Aug 2024 11:26:42 +0200 Subject: Make algorithms optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'Makefile') 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 -- $@ -- cgit v1.2.3-70-g09d2