Skip to content

Commit

Permalink
Add make commands to build pre-install binary
Browse files Browse the repository at this point in the history
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
  • Loading branch information
buraksekili committed Sep 1, 2023
1 parent 6973562 commit 202cff0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@ GO_ARG_LINUX=GOOS=linux GOARCH=amd64

SRC_PATH?=$(shell pwd)
BIN_PATH?=$(SRC_PATH)/bin

BOOTSTRAP_APP_PREINSTALL_NAME=bootstrapapp-pre-install
BOOTSTRAP_APP_POST_NAME=bootstrapapp-post
BOOTSTRAP_APP_PREDELETE_NAME=bootstrapapp-pre-delete

BOOTSTRAP_CMD_PREINSTALL_PATH=./cmd/bootstrap-pre-install
BOOTSTRAP_CMD_POST_PATH=./cmd/bootstrap-post
BOOTSTRAP_CMD_PREDELETE_PATH=./cmd/bootstrap-pre-delete

build-bootstrap-pre-install:
@echo "\n Building bootstrap-pre-install binary"
env $(GO_ARG_LINUX) CGO_ENABLED=0 go build -o "$(BIN_PATH)/$(BOOTSTRAP_APP_PREINSTALL_NAME)" -ldflags \
"-X main.version=$(MAIN_VERSION)" "$(BOOTSTRAP_CMD_PREINSTALL_PATH)"

build-bootstrap-post:
@echo "\n Building bootstrap binary"
env $(GO_ARG_LINUX) CGO_ENABLED=0 go build -v -o "$(BIN_PATH)/$(BOOTSTRAP_APP_PATH)$(BOOTSTRAP_APP_POST_NAME)" -ldflags \
@echo "\n Building bootstrapapp-post binary"
env $(GO_ARG_LINUX) CGO_ENABLED=0 go build -o "$(BIN_PATH)/$(BOOTSTRAP_APP_POST_NAME)" -ldflags \
"-X main.version=$(MAIN_VERSION)" "$(BOOTSTRAP_CMD_POST_PATH)"

build-bootstrap-pre-delete:
@echo "\n Building bootstrap binary"
env $(GO_ARG_LINUX) CGO_ENABLED=0 go build -v -o "$(BIN_PATH)/$(BOOTSTRAP_APP_PATH)$(BOOTSTRAP_APP_PREDELETE_NAME)" -ldflags \
@echo "\n Building bootstrapapp-pre-delete binary"
env $(GO_ARG_LINUX) CGO_ENABLED=0 go build -o "$(BIN_PATH)/$(BOOTSTRAP_APP_PREDELETE_NAME)" -ldflags \
"-X main.version=$(MAIN_VERSION)" "$(BOOTSTRAP_CMD_PREDELETE_PATH)"

build-all: build-bootstrap-post build-bootstrap-pre-delete
build-all: build-bootstrap-post build-bootstrap-pre-delete build-bootstrap-pre-install

0 comments on commit 202cff0

Please sign in to comment.