Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Makefile in the project root directory #1386

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
default:
cd src/ && $(MAKE)

cc:
cd src/ && $(MAKE) cc

run:
cd src/ && $(MAKE) run

runwithport:
cd src/ && $(MAKE) runwithport $(PORT)

prod:
cd src/ && $(MAKE) prod

clean:
cd src/ && $(MAKE) clean

swag swagger:
cd src/ && $(MAKE) swag
18 changes: 16 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
default:
go build -o cb-tumblebug

cc:
GOOS=linux GOARCH=arm go build -o cb-tumblebug-arm
swag swagger:
~/go/bin/swag i -o ./api/rest/docs

run:
./cb-tumblebug

runwithport:
@echo "Running on port $(PORT) (Usage: make runwithport PORT=8080)"
./cb-tumblebug --port=$(PORT)

prod:
@echo "Build for production"
# Note - Using cgo write normal Go code that imports a pseudo-package "C". I may not need on cross-compiling.
# Note - You can find possible platforms by 'go tool dist list' for GOOS and GOARCH
# Note - Using the -ldflags parameter can help set variable values at compile time.
# Note - Using the -s and -w linker flags can strip the debugging information.
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-s -w' -o cb-tumblebug

clean:
rm -v cb-tumblebug cb-tumblebug-arm

swag swagger:
~/go/bin/swag i -o ./api/rest/docs