2 ## Copyright 2017 Marc Stevens <marc@marc-stevens.nl>, Dan Shumow (danshu@microsoft.com)
3 ## Distributed under the MIT Software License.
4 ## See accompanying file LICENSE.txt or copy at
5 ## https://opensource.org/licenses/MIT
8 # dynamic library compatibility
9 # 1. If the library source code has changed at all since the last update,
10 # then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
11 # 2. If any interfaces have been added, removed, or changed since the last update,
12 # increment current, and set revision to 0.
13 # 3. If any interfaces have been added since the last public release, then increment age.
14 # 4. If any interfaces have been removed or changed since the last public release,
21 INCLUDEDIR
=$(PREFIX
)/include/sha1dc
27 ifeq ($(shell uname
),Darwin
)
36 CFLAGS
=-O2
-Wall
-Werror
-Wextra
-pedantic
-std
=c90
-Ilib
39 LT_CC
:=$(LIBTOOL
) --tag
=CC
--mode
=compile
$(CC
)
41 LT_LD
:=$(LIBTOOL
) --tag
=CC
--mode
=link
$(CC
)
42 LT_INSTALL
:=$(LIBTOOL
) --tag
=CC
--mode
=install $(INSTALL
)
46 ifneq (, $(shell which
$(LIBTOOL
) 2>/dev
/null
))
55 LT_INSTALL
:=$(INSTALL
)
58 CFLAGS
+=$(TARGETCFLAGS
)
59 LDFLAGS
+=$(TARGETLDFLAGS
)
69 FS_LIB
=$(wildcard $(LIB_DIR
)/*.c
)
70 FS_SRC
=$(wildcard $(SRC_DIR
)/*.c
)
71 FS_OBJ_LIB
=$(FS_LIB
:$(LIB_DIR
)/%.c
=$(LIB_OBJ_DIR
)/%.lo
)
72 FS_OBJ_SRC
=$(FS_SRC
:$(SRC_DIR
)/%.c
=$(SRC_OBJ_DIR
)/%.lo
)
73 FS_OBJ
=$(FS_OBJ_SRC
) $(FS_OBJ_LIB
)
74 FS_DEP_LIB
=$(FS_LIB
:$(LIB_DIR
)/%.c
=$(LIB_DEP_DIR
)/%.d
)
75 FS_DEP_SRC
=$(FS_SRC
:$(SRC_DIR
)/%.c
=$(SRC_DEP_DIR
)/%.d
)
76 FS_DEP
=$(FS_DEP_SRC
) $(FS_DEP_LIB
)
85 $(LT_INSTALL
) -d
$(LIBDIR
) $(BINDIR
) $(INCLUDEDIR
)
86 $(LT_INSTALL
) bin
/libsha1detectcoll.
$(LIB_EXT
) $(LIBDIR
)/libsha1detectcoll.
$(LIB_EXT
)
87 $(LT_INSTALL
) lib
/sha1.h
$(INCLUDEDIR
)/sha1.h
88 $(LT_INSTALL
) bin
/sha1dcsum
$(BINDIR
)/sha1dcsum
89 $(LT_INSTALL
) bin
/sha1dcsum_partialcoll
$(BINDIR
)/sha1dcsum_partialcoll
93 -$(RM
) $(BINDIR
)/sha1dcsum
94 -$(RM
) $(BINDIR
)/sha1dcsum_partialcoll
95 -$(RM
) $(INCLUDEDIR
)/sha1.h
96 -$(RM
) $(LIBDIR
)/libsha1detectcoll.
$(LIB_EXT
)
100 -find .
-type f
-name
'*.a' -print -delete
101 -find .
-type f
-name
'*.d' -print -delete
102 -find .
-type f
-name
'*.o' -print -delete
103 -find .
-type f
-name
'*.la' -print -delete
104 -find .
-type f
-name
'*.lo' -print -delete
105 -find .
-type f
-name
'*.so' -print -delete
106 -find .
-type d
-name
'.libs' -print | xargs
rm -rv
112 bin
/sha1dcsum_partialcoll
test/*
118 tools
: sha1dcsum sha1dcsum_partialcoll
121 sha1dcsum
: bin
/sha1dcsum
123 .PHONY
: sha1dcsum_partialcoll
124 sha1dcsum_partialcoll
: bin
/sha1dcsum_partialcoll
128 library
: bin
/libsha1detectcoll.
$(LIB_EXT
)
130 bin
/libsha1detectcoll.la
: $(FS_OBJ_LIB
)
131 $(MKDIR
) $(shell dirname
$@
) && $(LDLIB
) $(LDFLAGS
) $(FS_OBJ_LIB
) -rpath
$(LIBDIR
) -version-info
$(LIBCOMPAT
) -o bin
/libsha1detectcoll.la
133 bin
/libsha1detectcoll.a
: $(FS_OBJ_LIB
)
134 $(MKDIR
) $(shell dirname
$@
) && $(AR
) cru bin
/libsha1detectcoll.a
$(FS_OBJ_LIB
)
136 bin
/sha1dcsum
: $(FS_OBJ_SRC
) bin
/libsha1detectcoll.
$(LIB_EXT
)
137 $(LD
) $(LDFLAGS
) $(FS_OBJ_SRC
) -Lbin
-lsha1detectcoll
-o bin
/sha1dcsum
139 bin
/sha1dcsum_partialcoll
: $(FS_OBJ_SRC
) bin
/libsha1detectcoll.
$(LIB_EXT
)
140 $(LD
) $(LDFLAGS
) $(FS_OBJ_SRC
) -Lbin
-lsha1detectcoll
-o bin
/sha1dcsum_partialcoll
143 $(SRC_DEP_DIR
)/%.d
: $(SRC_DIR
)/%.c
144 $(MKDIR
) $(shell dirname
$@
) && $(CC_DEP
) $(CFLAGS
) -M
-MF
$@
$<
146 $(SRC_OBJ_DIR
)/%.lo
${SRC_OBJ_DIR}/%.o
: ${SRC_DIR}/%.c
${SRC_DEP_DIR}/%.d
147 $(MKDIR
) $(shell dirname
$@
) && $(CC
) $(CFLAGS
) -o
$@
-c
$<
150 $(LIB_DEP_DIR
)/%.d
: $(LIB_DIR
)/%.c
151 $(MKDIR
) $(shell dirname
$@
) && $(CC_DEP
) $(CFLAGS
) -M
-MF
$@
$<
153 $(LIB_OBJ_DIR
)/%.lo
$(LIB_OBJ_DIR
)/%.o
: $(LIB_DIR
)/%.c
$(LIB_DEP_DIR
)/%.d
154 $(MKDIR
) $(shell dirname
$@
) && $(CC
) $(CFLAGS
) -o
$@
-c
$<