.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) SUPPORT_KECCAK = $(DEFAULT_SUPPORT) SUPPORT_SHA3 = $(DEFAULT_SUPPORT) SUPPORT_SHAKE = $(DEFAULT_SUPPORT) SUPPORT_RAWSHAKE = $(DEFAULT_SUPPORT) SUPPORT_BLAKE224 = $(DEFAULT_SUPPORT) SUPPORT_BLAKE256 = $(DEFAULT_SUPPORT) SUPPORT_BLAKE384 = $(DEFAULT_SUPPORT) SUPPORT_BLAKE512 = $(DEFAULT_SUPPORT) CONFIGFILE = config.mk include $(CONFIGFILE) OS = linux # Linux: linux # Mac OS: macos # Windows: windows include mk/$(OS).mk LIB_MAJOR = 1 LIB_MINOR = 0 LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) LIB_NAME = hashsum CPPFLAGS_LIBKECCAK_IF_SUPPORTED = LDFLAGS_LIBKECCAK_IF_SUPPORTED = CPPFLAGS_LIBBLAKE_IF_SUPPORTED = LDFLAGS_LIBBLAKE_IF_SUPPORTED = 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 include mk/keccak=$(SUPPORT_KECCAK).mk include mk/sha3=$(SUPPORT_SHA3).mk include mk/shake=$(SUPPORT_SHAKE).mk include mk/rawshake=$(SUPPORT_RAWSHAKE).mk include mk/blake224=$(SUPPORT_SHA3).mk include mk/blake256=$(SUPPORT_SHA3).mk include mk/blake384=$(SUPPORT_SHA3).mk include mk/blake512=$(SUPPORT_SHA3).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)\ $(CPPFLAGS_LIBKECCAK_IF_SUPPORTED)\ $(CPPFLAGS_KECCAK)\ $(CPPFLAGS_SHA3)\ $(CPPFLAGS_SHAKE)\ $(CPPFLAGS_RAWSHAKE)\ $(CPPFLAGS_LIBBLAKE_IF_SUPPORTED)\ $(CPPFLAGS_BLAKE224)\ $(CPPFLAGS_BLAKE256)\ $(CPPFLAGS_BLAKE384)\ $(CPPFLAGS_BLAKE512) LDFLAGS_FULL =\ $(LDFLAGS)\ $(LDFLAGS_SHA1)\ $(LDFLAGS_SHA2)\ $(LDFLAGS_LIBKECCAK_IF_SUPPORTED)\ $(LDFLAGS_LIBBLAKE_IF_SUPPORTED) OBJ =\ libhashsum_init_hasher.o\ libhashsum_init_hasher_from_string.o\ libhashsum_init_md2_hasher.o\ libhashsum_init_md4_hasher.o\ libhashsum_init_md5_hasher.o\ libhashsum_init_ripemd_128_hasher.o\ libhashsum_init_ripemd_160_hasher.o\ libhashsum_init_ripemd_256_hasher.o\ libhashsum_init_ripemd_320_hasher.o\ libhashsum_init_sha0_hasher.o\ libhashsum_init_sha1_hasher.o\ libhashsum_init_sha_224_hasher.o\ libhashsum_init_sha_256_hasher.o\ libhashsum_init_sha_384_hasher.o\ libhashsum_init_sha_512_hasher.o\ libhashsum_init_sha_512_224_hasher.o\ libhashsum_init_sha_512_256_hasher.o\ libhashsum_init_sha2_hasher.o\ libhashsum_init_keccak_224_hasher.o\ libhashsum_init_keccak_256_hasher.o\ libhashsum_init_keccak_384_hasher.o\ libhashsum_init_keccak_512_hasher.o\ libhashsum_init_keccak_hasher.o\ libhashsum_init_sha3_224_hasher.o\ libhashsum_init_sha3_256_hasher.o\ libhashsum_init_sha3_384_hasher.o\ libhashsum_init_sha3_512_hasher.o\ libhashsum_init_sha3_hasher.o\ libhashsum_init_shake128_hasher.o\ libhashsum_init_shake256_hasher.o\ libhashsum_init_shake512_hasher.o\ libhashsum_init_shake_hasher.o\ libhashsum_init_rawshake128_hasher.o\ libhashsum_init_rawshake256_hasher.o\ libhashsum_init_rawshake512_hasher.o\ libhashsum_init_rawshake_hasher.o\ libhashsum_init_blake224_hasher.o\ libhashsum_init_blake256_hasher.o\ libhashsum_init_blakes_hasher.o\ libhashsum_init_blake384_hasher.o\ libhashsum_init_blake512_hasher.o\ libhashsum_init_blakeb_hasher.o\ libhashsum_init_blake_hasher.o\ libhashsum_reverse_byte__.o\ libhashsum_init_keccak__.o HDR =\ libhashsum.h\ common.h TEST =\ md2.t\ md4.t\ md5.t\ ripemd-128.t\ ripemd-160.t\ ripemd-256.t\ ripemd-320.t\ sha0.t\ sha1.t\ sha_224.t\ sha_256.t\ sha_384.t\ sha_512.t\ sha_512_224.t\ sha_512_256.t\ keccak_224.t\ keccak_256.t\ keccak_384.t\ keccak_512.t\ sha3_224.t\ sha3_256.t\ sha3_384.t\ sha3_512.t\ blake224.t\ blake256.t\ blake384.t\ blake512.t LOBJ = $(OBJ:.o=.lo) TOBJ = $(TEST:.t=.o) all: libhashsum.a libhashsum.$(LIBEXT) $(TEST) $(OBJ): $(HDR) $(LOBJ): $(HDR) $(TOBJ): $(HDR) $(TEST): libhashsum.a .c.o: $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS_FULL) .c.lo: $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS_FULL) .c.t: $(CC) -o $@ $< libhashsum.a $(CFLAGS) $(CPPFLAGS_FULL) $(LDFLAGS_FULL) .o.t: $(CC) -o $@ $< libhashsum.a $(LDFLAGS_FULL) libhashsum.a: $(OBJ) @rm -f -- $@ $(AR) rc $@ $(OBJ) $(AR) ts $@ > /dev/null libhashsum.$(LIBEXT): $(LOBJ) $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) check: $(TEST) @set -e;\ for t in $(TEST); do\ printf '%s\n' ./$$t;\ $(CHECK_PREFIX) ./$$t;\ done install: libhashsum.a libhashsum.$(LIBEXT) mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" mkdir -p -- "$(DESTDIR)$(PREFIX)/include" cp -- libhashsum.a "$(DESTDIR)$(PREFIX)/lib/" cp -- libhashsum.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMINOREXT)" $(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMINOREXT)" ln -sf -- libhashsum.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMAJOREXT)" ln -sf -- libhashsum.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBEXT)" cp -- libhashsum.h "$(DESTDIR)$(PREFIX)/include/" uninstall: -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libhashsum.a" -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMAJOREXT)" -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMINOREXT)" -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBEXT)" -rm -f -- "$(DESTDIR)$(PREFIX)/include/libhashsum.h" clean: -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib *.t -rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT) .SUFFIXES: .SUFFIXES: .lo .o .c .t .PHONY: all check install uninstall clean