-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
54 lines (38 loc) · 1.81 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
CFLAGS :=
OS := $(shell uname -s | tr "[:upper:]" "[:lower:]")
ifeq (darwin,$(OS))
CFLAGS += -framework Security
endif
ifdef NDEBUG
CFLAGS += -DNDEBUG=${NDEBUG}
endif
ifdef NO_CXXEXCEPTIONS
CFLAGS += -DNO_CXXEXCEPTIONS=${NO_CXXEXCEPTIONS}
endif
all: examples/cpp.out
src/lib.h: src/lib.rs
cbindgen -o src/lib.h
examples/cpp.out: target/debug/libchallenge_bypass_ristretto_ffi.a examples/wrapper.o examples/cpp/main.cpp
g++ $(CFLAGS) -std=gnu++0x examples/cpp/main.cpp examples/wrapper.o ./target/debug/libchallenge_bypass_ristretto_ffi.a -I ./src -lpthread -ldl -o examples/cpp.out
examples/wrapper.o: src/lib.h src/wrapper.cpp src/wrapper.hpp
g++ $(CFLAGS) -std=gnu++0x src/wrapper.cpp -I src/ -c -o examples/wrapper.o
target/debug/libchallenge_bypass_ristretto_ffi.a: src/lib.rs Cargo.toml
cargo build
examples/golang.out: target/x86_64-unknown-linux-musl/debug/libchallenge_bypass_ristretto_ffi.a examples/golang/main.go lib.go src/lib.h
go build --ldflags '-extldflags "-static"' -o examples/golang.out examples/golang/main.go
examples/golang.dyn.out: target/x86_64-unknown-linux-musl/debug/libchallenge_bypass_ristretto_ffi.a examples/golang/main.go lib.go src/lib.h
go build -o examples/golang.dyn.out examples/golang/main.go
target/x86_64-unknown-linux-musl/debug/libchallenge_bypass_ristretto_ffi.a: src/lib.rs Cargo.toml
cargo build --target=x86_64-unknown-linux-musl
go-docker:
docker build -f examples/golang/Dockerfile -t challenge-bypass-ristretto-ffi-go .
go-docker-test: go-docker
docker run -i challenge-bypass-ristretto-ffi-go
go-lint:
golangci-lint run -E gofmt -E golint -D megacheck -D typecheck -D structcheck --exclude-use-default=false lib.go
golangci-lint run -E gofmt -E golint --exclude-use-default=false examples/golang/main.go
clean:
rm -rf target
lint: go-lint
cargo fmt -- --check
cargo clippy