-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (49 loc) · 1.37 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
.DEFAULT_GOAL := help
BUILD_DIR=build
DIST_DIR=dist
SRC_DIR=src
SRCS=$(wildcard src/*.v)
ALL_V=$(shell find . -name *.v -type f -print)
VERSION=0.1.0
NAME=hashsum
build: $(patsubst src/%.v, $(BUILD_DIR)/%, $(SRCS))
$(BUILD_DIR)/%: src/%.v
@mkdir -p $(@D)
v fmt -diff $<
v -o $@ $<
dist: $(patsubst src/%.v, $(DIST_DIR)/%, $(SRCS))
$(DIST_DIR)/%: src/%.v
@mkdir -p $(@D)
v -prod -o $@ $<
strip $@
upx $@
clean:
@echo "Cleaning..."
rm -rf $(BUILD_DIR)
rm -rf $(DIST_DIR)
rm -rf tests/.pytest_cache
rm -rf tests/__pycache__
rm $(NAME)*.tar.gz 2> /dev/null || true
fmt: $(ALL_V)
@v fmt -l $^
release: clean dist
mkdir $(NAME)
cp dist/* $(NAME)
tar cvzf "$(NAME).$(VERSION).tar.gz" $(NAME)
rm -rf $(NAME)
all-test: test pytest
test:
v test $(SRC_DIR)/
pytest:
pytest -v tests
help:
@echo 'Makefile for Hashsum'
@echo
@echo 'Usage:'
@echo ' make build Compile the hashsum tools into folder build'
@echo ' make clean Delete all binaries and temporary files'
@echo ' make dist Build a distribution with the release binaries (requires UPX)'
@echo ' make fmt Format all source file using the V formatter'
@echo ' make test Execute the V unit-tests'
@echo ' make pytest Execute CLI tests using pytest (requires Python and PyTest)'
@echo ' make all-test Execute the unit-tests and the CLI tests'