-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
68 lines (53 loc) · 1.74 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#
# For out-of-tree builds:
# make -f /path/to/src/Makefile CFLAGS=... configure
#
ifeq ($(srcdir),)
srcdir = $(dir $(MAKEFILE_LIST))
CFLAGS += -O2 -std=c99 -D_XOPEN_SOURCE=700
CFLAGS += -Wall -W -Wno-pointer-sign -fdiagnostics-color=auto -g
PREFIX ?= /usr/local
endif
# Set configuration varialbes here if needed
#CFLAGS += -I/opt/openssl/include
#LDFLAGS += -L/opt/openssl/lib
#LIBS =
#PREFIX = /opt/multihash
OBJECTS =
OBJECTS += multihash.o
OBJECTS += cache.o
OBJECTS += formatter.o
OBJECTS += parhash.o
OBJECTS += treewalk.o
OBJECTS += archive.o
multihash: $(OBJECTS)
$(CC) $(LDFLAGS) -pthread -o $@ $(OBJECTS) -lcrypto -ldb $(LIBS)
$(OBJECTS): %.o: $(srcdir)%.c
$(CC) $(CFLAGS) $(CFLAGS_SRC) -pthread -c -o $@ $<
multihash.o cache.o: $(srcdir)cache.h
multihash.o formatter.o: $(srcdir)formatter.h
multihash.o parhash.o: $(srcdir)parhash.h
multihash.o treewalk.o: $(srcdir)treewalk.h
multihash.o archive.o: $(srcdir)archive.h
VERSION = $$(git --git-dir $(srcdir)/.git log -n 1 --date=format:%Y%m%d --format=%ad-%h)
multihash.o: CFLAGS_SRC += -DVERSION=\"$(VERSION)\"
multihash.o: $(srcdir).git/logs/HEAD
.PHONY: configure install clean
configure:
@if [ -e Makefile ]; then echo "Makefile is in the way"; false; fi
@{ \
printf "srcdir = %s\n" $(srcdir) ; \
printf "CFLAGS = %s\n" "$(CFLAGS)" ; \
printf "LDFLAGS = %s\n" "$(LDFLAGS)" ; \
printf "LIBS = %s\n" "$(LIBS)" ; \
printf "PREFIX = %s\n" "$(PREFIX)" ; \
printf "include \$$(srcdir)Makefile\n" ; \
} > Makefile
test: multihash
rm -rf tests
perl $(srcdir)selftest.plx
install: multihash
install -D -m 755 multihash $(DESTDIR)$(PREFIX)/bin/multihash
install -D -m 644 $(srcdir)multihash.1 $(DESTDIR)$(PREFIX)/share/man/man1/multihash.1
clean:
-rm -f multihash $(OBJECTS)