-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
92 lines (70 loc) · 2.55 KB
/
GNUmakefile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
include ./opinionated.mk
GOSRC=$(shell find . -iname "*.go" )
PREFIX=/usr/local
BUILD_MAN_PAGES=build/man/man3/mlpx.3 build/man/man5/mlpx.5 build/man/man1/mlpx.1 build/man/man1/mlpx-new.1 build/man/man1/mlpx-validate.1 build/man/man1/mlpx-diff.1 build/man/man1/mlpx-summarize.1 build/man/man1/mlpx-plot-bias.1
BUILD_BINARIES=build/bin/mlpx build/bin/mlpx-config
BUILD_INCLUDES=build/include/mlpx/mlpx.h
BUILD_LIBS=build/lib/libmlpx.so build/lib/libmlpx.a
BUILD_EVERYTHING=$(BUILD_MAN_PAGES) $(BUILD_BINARIES) $(BUILD_INCLUDES) $(BUILD_LIBS)
test:
> $(MAKE) -C ./go test
> $(MAKE) -C ./c test
.PHONY: test
lint:
> $(MAKE) -C ./go lint
.PHONY: lint
builddirs:
> mkdir -p ./build/bin
> mkdir -p ./build/man/man1
> mkdir -p ./build/man/man3
> mkdir -p ./build/man/man5
> mkdir -p ./build/lib
> mkdir -p ./build/include/mlpx
.PHONY: builddirs
build/bin/mlpx: $(GOSRC) go.mod builddirs
> go build -o $@ ./cmd/mlpx/main.go
build/bin/mlpx-config: ./cmd/mlpx-config/mlpx-config
> cp $< $@
> chmod +x $@
.PHONY: build/bin/mlpx-config
build/man/man3/%.3: doc/3/%.md builddirs
> ronn < $< > $@
build/man/man5/%.5: doc/5/%.md builddirs
> ronn < $< > $@
build/man/man1/mlpx.1: ./build/bin/mlpx builddirs
> help2man --include=include.txt --no-info --no-discard-stderr $< > "$@"
build/man/man1/mlpx-new.1: ./build/bin/mlpx builddirs
> help2man --include=include.txt --no-info --no-discard-stderr "$< new" > "$@"
build/man/man1/mlpx-diff.1: ./build/bin/mlpx builddirs
> help2man --include=include.txt --no-info --no-discard-stderr "$< diff" > "$@"
build/man/man1/mlpx-validate.1: ./build/bin/mlpx builddirs
> help2man --include=include.txt --no-info --no-discard-stderr "$< validate" > "$@"
build/man/man1/mlpx-summarize.1: ./build/bin/mlpx builddirs
> help2man --include=include.txt --no-info --no-discard-stderr "$< summarize " > "$@"
build/man/man1/mlpx-plot-bias.1: ./build/bin/mlpx builddirs
> help2man --include=include.txt --no-info --no-discard-stderr "$< plot-bias" > "$@"
build/lib/libmlpx.so: builddirs
> $(MAKE) -C ./c mlpx.so
> cp ./c/mlpx.so $@
.PHONY: build/lib/libmlpx.so
build/lib/libmlpx.a: builddirs
> $(MAKE) -C ./c mlpx.a
> cp ./c/mlpx.a $@
.PHONY: build/lib/libmlpx.a
build/include/mlpx/mlpx.h: builddirs
> $(MAKE) -C ./c mlpx.h
> cp ./c/mlpx.h $@
.PHONY: build/lib.mlpx.h
build: $(BUILD_EVERYTHING)
.PHONY: build
install: build
> cp -r ./build/bin/* $(PREFIX)/bin/
> cp -r ./build/man/* $(PREFIX)/man/
> cp -r ./build/lib/* $(PREFIX)/lib/
> cp -r ./build/include/* $(PREFIX)/include/
.PHONY: install
clean:
> $(MAKE) -C ./go clean
> $(MAKE) -C ./c clean
> rm -rf ./build
.PHONY: clean