Skip to content

Commit

Permalink
feat(Makefile): added web build task
Browse files Browse the repository at this point in the history
  • Loading branch information
Wittano committed Apr 12, 2024
1 parent f7d3d64 commit dc13d38
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DEST_DIR = /opt/komputer
ARCH = $(shell uname -m)
OUTPUT_DIR=./build

ifeq ($(ARCH), x86_64)
GOARCH="amd64"
Expand All @@ -8,10 +9,13 @@ else
endif

dev:
CGO_ENABLED=1 GOOS=linux GOARCH=$(GOARCH) go build -tags dev -o ./build/komputer ./cmd/komputer/main.go
CGO_ENABLED=1 GOOS=linux GOARCH=$(GOARCH) go build -tags dev -o $(OUTPUT_DIR)/komputer ./cmd/komputer/main.go

prod:
CGO_ENABLED=1 GOOS=linux GOARCH=$(GOARCH) go build -o ./build/komputer ./cmd/komputer/main.go
CGO_ENABLED=1 GOOS=linux GOARCH=$(GOARCH) go build -o $(OUTPUT_DIR)/komputer ./cmd/komputer/main.go

api:
GOARCH=$(GOARCH) go build -o $(OUTPUT_DIR)/api ./cmd/web/main.go

test-bot:
go test ./bot/...
Expand All @@ -31,10 +35,14 @@ endif
install: prod
mkdir -p $(DEST_DIR)
cp -r assets $(DEST_DIR)
cp build/komputer $(DEST_DIR)
cp $(OUTPUT_DIR)/komputer $(DEST_DIR)

uninstall:
ifneq ("$(wildcard $(DEST_DIR))", "")
rm -r $(DEST_DIR)
endif

clean:
rm -r build
ifneq ("$(wildcard $(OUTPUT_DIR))", "")
rm -r build
endif

0 comments on commit dc13d38

Please sign in to comment.