-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·50 lines (33 loc) · 1.51 KB
/
configure
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
#!/bin/bash
# check system and prepare env variables
eval $(manabuild -no-build)
cat > Makefile <<EOF
# Makefile content generated by configure
VERSION=\`git describe --tags\`
BUILD=\`date +%FT%T%z\`
HASH=\`git rev-parse --short HEAD\`
LDFLAGS=-ldflags "-w -s -X main.version=\${VERSION} -X main.buildDate=\${BUILD} -X main.gitCommit=\${HASH}"
.PHONY: all clean
all: test-and-build
build:
@CGO_CXXFLAGS="${CGO_CXXFLAGS}" CGO_CPPFLAGS="${CGO_CPPFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go build \${LDFLAGS} -o masm3
test-and-build:
@CGO_CXXFLAGS="${CGO_CXXFLAGS}" CGO_CPPFLAGS="${CGO_CPPFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go test $(go list ./... | grep -v "github.com/czcorpus/mquery-sru/cmd/testing" | tr '\n' ' ')
@CGO_CXXFLAGS="${CGO_CXXFLAGS}" CGO_CPPFLAGS="${CGO_CPPFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go build \${LDFLAGS} -o masm3
tools:
@go install github.com/czcorpus/manabuild@latest
generate:
@go generate ./masm.go
install:
# TODO
@cp ./mquery-sru /usr/local/bin
clean:
@rm mquery-sru
test:
@go test $(go list ./... | grep -v "github.com/czcorpus/mquery-sru/cmd/testing" | tr '\n' ' ')
rtest:
@CGO_CXXFLAGS="${CGO_CXXFLAGS}" CGO_CPPFLAGS="${CGO_CPPFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go test -race $(go list ./... | grep -v "github.com/czcorpus/mquery-sru/cmd/testing" | tr '\n' ' ')
itest:
@CGO_CXXFLAGS="${CGO_CXXFLAGS}" CGO_CPPFLAGS="${CGO_CPPFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go test -v ./cmd/testing --args http://localhost:8989/
EOF
echo "Configuration successful. Run make to build the project."