You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.2 KiB

4 years ago
INSTALL:= /usr/lib64
INSTALL-BIN:= /usr/bin
INSTALL-INCLUDE:=/usr/include
4 years ago
CLI:= cli
4 years ago
4 years ago
PROJECT=khash
4 years ago
BUILD =target/release
DEBUG =target/debug
4 years ago
.PHONY: release
release: $(BUILD)/lib$(PROJECT).so
.PHONY: debug
debug: $(DEBUG)/lib$(PROJECT).so
.PHONY: $(PROJECT)
$(PROJECT): $(BUILD)/lib$(PROJECT).so
4 years ago
$(BUILD)/lib$(PROJECT).so: RUSTFLAGS?= -C target-cpu=native
$(BUILD)/lib$(PROJECT).so:
RUSTFLAGS="$(RUSTFLAGS)" cargo build --release
strip $@
cd $(CLI) && $(MAKE) release
$(DEBUG)/lib$(PROJECT).so:
RUSTFLAGS="$(RUSTFLAGS)" cargo build
cd $(CLI) && $(MAKE) debug
.PHONY: khash-nonative
4 years ago
khash-nonative:
4 years ago
$(MAKE) RUSTFLAGS="" $(BUILD)/libkhash.so
.PHONY: test
test: RUSTFLAGS+= -C target-cpu=native -C opt-level=3
test: | clean
RUSTFLAGS="$(RUSTFLAGS)" cargo test
RUSTFLAGS="$(RUSTFLAGS)" cargo bench
cd $(CLI) && $(MAKE) test
4 years ago
4 years ago
clean:
rm -f {$(BUILD),$(DEBUG)}/lib*
4 years ago
cd $(CLI) && make clean
4 years ago
install:
4 years ago
cp -f ./target/release/libkhash.so $(INSTALL)/libkhash.so
cp -f ./target/release/libkhash.a $(INSTALL)/libkhash.a
4 years ago
cp -f $(CLI)/build/kana-hash $(INSTALL-BIN)/kana-hash
cp -f include/khash.h $(INSTALL-INCLUDE)/khash.h
4 years ago
uninstall:
rm -f $(INSTALL)/libkhash.so
rm -f $(INSTALL)/libkhash.a
4 years ago
rm -f $(INSTALL-BIN)/kana-hash
rm -f $(INSTALL-INCLUDE)/khash.h