Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ DEST ?= /opt/osctrl

OUTPUT = bin

.PHONY: build clean tls admin cli api
STATIC_ARGS = -ldflags "-linkmode external -extldflags -static"

.PHONY: build static clean tls admin cli api

# Build code according to caller OS and architecture
build:
Expand All @@ -31,22 +33,45 @@ build:
make api
make cli

# Build everything statically
static:
make tls-static
make admin-static
make api-static
make cli-static

# Build TLS endpoint
tls:
go build -o $(OUTPUT)/$(TLS_NAME) $(TLS_CODE)

# Build TLS endpoint statically
tls-static:
go build $(STATIC_ARGS) -o $(OUTPUT)/$(TLS_NAME) -a $(TLS_CODE)

# Build Admin UI
admin:
go build -o $(OUTPUT)/$(ADMIN_NAME) $(ADMIN_CODE)

# Build Admin UI statically
admin-static:
go build $(STATIC_ARGS) -o $(OUTPUT)/$(ADMIN_NAME) -a $(ADMIN_CODE)

# Build API
api:
go build -o $(OUTPUT)/$(API_NAME) $(API_CODE)

# Build API statically
api-static:
go build $(STATIC_ARGS) -o $(OUTPUT)/$(API_NAME) -a $(API_CODE)

# Build the CLI
cli:
go build -o $(OUTPUT)/$(CLI_NAME) $(CLI_CODE)

# Build the CLI statically
cli-static:
go build $(STATIC_ARGS) -o $(OUTPUT)/$(CLI_NAME) -a $(CLI_CODE)

# Delete all compiled binaries
clean:
rm -rf $(OUTPUT)/$(TLS_NAME)
Expand Down