1 LT_CC=libtool --mode=compile gcc
3 LT_LD=libtool --mode=link gcc
11 CFLAGS=-O3 -g -flto -Wall -Werror -Wextra -pedantic -std=c11 -Ilib
19 FS_LIB=$(wildcard ${LIB_DIR}/*.c)
20 FS_SRC=$(wildcard ${SRC_DIR}/*.c)
21 FS_OBJ_LIB=$(FS_LIB:${LIB_DIR}/%.c=${OBJ_DIR}/%.lo)
22 FS_OBJ_SRC=$(FS_SRC:${SRC_DIR}/%.c=${OBJ_DIR}/%.lo)
23 FS_OBJ=$(FS_OBJ_SRC) $(FS_OBJ_LIB)
24 FS_DEP_LIB=$(FS_LIB:${LIB_DIR}/%.c=${DEP_DIR}/%.d)
25 FS_DEP_SRC=$(FS_SRC:${SRC_DIR}/%.c=${DEP_DIR}/%.d)
26 FS_DEP=$(FS_DEP_SRC) $(FS_DEP_LIB)
31 all: library tools test
35 -find . -type f -name '*.a' -print -delete
36 -find . -type f -name '*.d' -print -delete
37 -find . -type f -name '*.o' -print -delete
38 -find . -type f -name '*.la' -print -delete
39 -find . -type f -name '*.lo' -print -delete
40 -find . -type f -name '*.so' -print -delete
41 -find . -type d -name '.libs' -print | xargs rm -rv
46 bin/detectcoll_verbose tests/*
49 tools: detectcoll detectcoll_verbose detectcoll_reducedsha
51 .PHONY: detectcoll_verbose
52 detectcoll_verbose: bin/detectcoll_verbose
55 detectcoll: bin/detectcoll
57 .PHONY: detectcoll_reducedsha
58 detectcoll_reducedsha: bin/detectcoll_reducedsha
61 library: bin/libdetectcoll.la
63 bin/libdetectcoll.la: $(FS_OBJ_LIB)
64 ${LD} ${CFLAGS} $(FS_OBJ_LIB) -o bin/libdetectcoll.la
66 bin/detectcoll: $(FS_SRC) $(FS_LIB)
67 ${LD} ${CFLAGS} $(FS_SRC) $(FS_LIB) -o bin/detectcoll
69 bin/detectcoll_verbose: $(FS_SRC) $(FS_LIB)
70 ${LD} ${CFLAGS} -DVERBOSE_COLLDETECT $(FS_SRC) $(FS_LIB) -o bin/detectcoll_verbose
72 bin/detectcoll_reducedsha: $(FS_SRC) $(FS_LIB)
73 ${LD} ${CFLAGS} -DVERBOSE_COLLDETECT -DDETECT_REDUCED_SHA_COLLISION $(FS_SRC) $(FS_LIB) -o bin/detectcoll_reducedsha
75 ${DEP_DIR}/%.d: ${LIB_DIR}/%.c
76 ${MKDIR} $(shell dirname $@) && $(CC_DEP) $(CFLAGS) -M -MF $@ $<
78 ${OBJ_DIR}/%.lo ${OBJ_DIR}/%.o: ${LIB_DIR}/%.c ${DEP_DIR}/%.d
79 ${MKDIR} $(shell dirname $@) && $(CC) $(CFLAGS) -o $@ -c $<