forked from OpenCHAMI/configurator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (45 loc) · 1.39 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
# Unless set otherwise, the container runtime is Docker
DOCKER ?= docker
prog ?= configurator
git_tag := $(shell git describe --abbrev=0 --tags --always)
sources := main.go $(wildcard cmd/*.go)
plugin_source_prefix := pkg/generator/plugins
plugin_sources := $(filter-out %_test.go,$(wildcard $(plugin_source_prefix)/*/*.go))
plugin_binaries := $(addprefix lib/,$(patsubst %.go,%.so,$(notdir $(plugin_sources))))
# build everything at once
.PHONY: all
all: plugins exe test
# build the main executable to make configs
.PHONY: main driver binaries exe
main: exe
driver: exe
binaries: exe plugins
exe: $(prog)
# build named executable from go sources
$(prog): $(sources)
go build --tags=all -o $(prog)
.PHONY: container
container: binaries
$(DOCKER) build . --build-arg --no-cache --pull --tag '$(prog):$(git_tag)-dirty'
.PHONY: container-testing
container-testing: binaries
$(DOCKER) build . --tag $(prog):testing
# build all of the generators into plugins
.PHONY: plugins
plugins: $(plugin_binaries)
# how to make each plugin
lib/%.so: pkg/generator/plugins/%/*.go
mkdir -p lib
go build -buildmode=plugin -o $@ $<
docs:
go doc github.com/OpenCHAMI/cmd
go doc github.com/OpenCHAMI/pkg/configurator
# remove executable and all built plugins
.PHONY: clean
clean:
rm -f configurator
rm -f lib/*
# run all of the unit tests
.PHONY: test
test: $(prog) $(plugin_binaries)
go test ./tests/generate_test.go --tags=all