summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorXuqiang Chen <chenxuqiang3@hisilicon.com>2023-08-16 23:52:43 +0800
committerGitHub <noreply@github.com>2023-08-16 17:52:43 +0200
commitffaacccda0f647a99806160fe90db4b012219603 (patch)
treee1da68a882dbecf894ede11e09f5d814825cd3ab /Makefile
parent67d25c13e3d82579180d893b1835d43fc222fa45 (diff)
murmurhash: add dynamic library build process (#3)
Signed-off-by: chenxuqiang <cxq507@foxmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 14 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 64a54f1..7dcc77e 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,13 @@ CFLAGS += -std=c99 -Wall -I.
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)
@@ -12,13 +19,19 @@ $(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)
+install: $(BIN) $(LIB)
install $(BIN) $(PREFIX)/bin
+ install $(LIB) $(PREFIX)/lib
+ install $(INCLUDE) $(PREFIX)/include
install man/*.1 $(MANPREFIX)/man1
docs: $(MAN_FILES)