summaryrefslogtreecommitdiff
path: root/Makefile
blob: 720af44ddecb5af8a0ff2c8a3d6c5ac67acb67fc (plain)
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

BIN ?= murmur
SRC = murmurhash.c
CFLAGS += -std=c99 -Wall -I. -DMURMURHASH_WANTS_HTOLE32=1
PREFIX ?= /usr/local
MANPREFIX ?= $(PREFIX)/share/man
MAN_FILES = $(wildcard man/*.md)
LIB ?= libmurmurhash.so
INCLUDE ?= murmurhash.h

all: $(LIB) $(BIN)

$(LIB):
	$(CC) -shared $(SRC) $(CFLAGS) -o $(LIB)

$(BIN):
	$(CC) main.c $(SRC) $(CFLAGS) -o $(BIN)

clean:
	rm -f test
	rm -f $(BIN)
	rm -f $(LIB)

example:
	$(CC) murmurhash_example.c -lmurmurhash -o murmurhash_example

test:
	$(CC) test.c $(SRC) $(CFLAGS) -o test
	./test

install: $(BIN) $(LIB)
	install $(BIN) $(PREFIX)/bin
	install $(LIB) $(PREFIX)/lib
	install $(INCLUDE) $(PREFIX)/include
	install man/*.1 $(MANPREFIX)/man1

docs: $(MAN_FILES)

$(MAN_FILES):
	curl -# -F page=@$(@) -o $(@:%.md=%) http://mantastic.herokuapp.com

.PHONY: test $(MAN_FILES)