forked from openshift/ols-load-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (41 loc) · 1.65 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
.PHONY: build help images push
ARCH ?= amd64
BIN_NAME = ols-load-generator
BIN_DIR = bin
BIN_PATH = $(BIN_DIR)/$(ARCH)/$(BIN_NAME)
VERSION ?= $(shell git describe --tags --always)
CGO = 0
SOURCES := $(shell find . -type f -name "*.go")
# Containers
ENGINE ?= podman
REGISTRY = quay.io
ORG ?= vchalla
CONTAINER_NAME_ARCH = $(REGISTRY)/$(ORG)/ols-load-generator:$(ARCH)
all: lint build images push
help:
@echo "Commands for $(BIN_PATH):"
@echo
@echo 'Usage:'
@echo ' make clean Clean the compiled binaries'
@echo ' [ARCH=arch] make build Compile the project for arch, default amd64'
@echo ' [ARCH=arch] make install Installs ols-load-generator binary in the system, default amd64'
@echo ' [ARCH=arch] make images Build images for arch, default amd64'
@echo ' [ARCH=arch] make push Push images for arch, default amd64'
@echo ' make help Show this message'
build: $(BIN_PATH)
$(BIN_PATH): $(SOURCES)
@echo -e "\033[2mBuilding $(BIN_PATH)\033[0m"
@echo "GOPATH=$(GOPATH)"
GOARCH=$(ARCH) CGO_ENABLED=$(CGO) go build -v -o $(BIN_PATH) -ldflags "-X main.Version=$(VERSION)" ./cmd/ols-load-generator
lint:
find . -name '*.go' -type f -exec go fmt {} \;
install:
cp $(BIN_PATH) /usr/bin/$(BIN_NAME)
images:
@echo -e "\033[2mBuilding container $(CONTAINER_NAME_ARCH)\033[0m"
mkdir -p $(BIN_DIR)/$(ARCH)/assets/profiles
cp -r attacker/assets/profiles/ $(BIN_DIR)/$(ARCH)/assets/profiles
$(ENGINE) build --arch=$(ARCH) -f Containerfile $(BIN_DIR)/$(ARCH)/ -t $(CONTAINER_NAME_ARCH)
push:
@echo -e "\033[2mPushing container $(CONTAINER_NAME_ARCH)\033[0m"
$(ENGINE) push $(CONTAINER_NAME_ARCH)