rework makefile

master
Avril 4 years ago
parent 2c942f2fff
commit 5a6368ef4b
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -3,20 +3,44 @@ INSTALL-BIN:= /usr/bin
INSTALL-INCLUDE:=/usr/include
CLI:= cli
PROJECT=khash
khash:
RUSTFLAGS="-C target-cpu=native" cargo build --release
strip ./target/release/libkhash.so
cd $(CLI) && $(MAKE) kana-hash
BUILD:=./target/release
DEBUG:=./target/debug
.PHONY: $(PROJECT)
$(PROJECT): release
.PHONY: release
release: $(BUILD)/lib$(PROJECT).so
.PHONY: debug
debug: $(DEBUG)/lib$(PROJECT).so
$(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
khash-nonative:
cargo build --release
cd $(CLI) && $(MAKE) kana-hash
$(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
test:
RUSTFLAGS="-C target-cpu=native -C opt-level=3" cargo test
RUSTFLAGS="-C target-cpu=native -C opt-level=3" cargo bench
cd $(CLI) && $(MAKE)
clean:
rm -f $(BUILD)/lib
cd $(CLI) && make clean
install:
cp -f ./target/release/libkhash.so $(INSTALL)/libkhash.so

@ -3,7 +3,9 @@ INCLUDE =include/
BUILD:=build
RELEASE_CFLAGS?= -O3 -flto -fgraphite
OPT_FLAGS+= -fgraphite -fno-strict-aliasing
RELEASE_CFLAGS?= -O3 -flto $(OPT_FLAGS) -march=native
RELEASE_LDFLAGS?= -O3 -flto
DEBUG_CFLAGS?= -g -O0
@ -15,7 +17,7 @@ CFLAGS+= $(addprefix -I,$(INCLUDE)) -Wall -pedantic --std=gnu11
LDFLAGS+= $(addprefix -L,$(LIB)) -lkhash
PROJECT = kana-hash
OBJ = $(addprefix ./obj/$(SRC:.c=.o))
OBJ = $(addprefix ./obj/,$(SRC:.c=.o))
OUTPUT = $(BUILD)/$(PROJECT)
.PHONY: release

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save