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

Setup build environment with Make. #2

Merged
merged 6 commits into from
Jan 17, 2022
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
salmon
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
TARGET_DIR := /usr/local/bin
BIN:= salmon

build:
@go mod tidy
@go build

static:
@go mod tidy
@go build -ldflags "-linkmode external -extldflags -static"

install:
@mkdir -p $(TARGET_DIR)
@cp ./$(BIN) $(TARGET_DIR)
@chmod +x $(TARGET_DIR)/$(BIN)

check:
@gofmt -w -s *.go
@go test

uninstall:
@rm $(TARGET_DIR)/$(BIN)

clean:
@go clean

.PHONY: build install check uninstall clean all
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,38 @@
Salmon is a music tracking server that connects with different sources to display a presence
</p>

## Dependencies:
+ `git` - To clone repo (optional).
+ `go` - Required the compile the binary (Required, Make Dependency).
+ `make` - Build system (Optional, Make Dependency).

## Installation

### Windows:
There are two ways to get salmon, you can either head to [releases](https://github.com/actualdankcoder/salmon/releases) and download the latest binary

**or**

Install the [go compiler](https://go.dev/dl/) and then run the following in the project directory
Compile the binary with the following commands:

```bash
git clone https://github.com/actualdankcoder/salmon
cd salmon
go mod tidy
go build
```
Launch the built binary "salmon.exe"
Once the binary is compiled, you can uninstall all dependencies and add salmon.exe to your PATH variable.

## Linux & MacOS:
Install Go and Make with your package manager and then run the following in the project directory:

+ `git clone https://github.com/actualdankcoder/salmon`
+ `cd salmon`
+ `make` for a dynamically linked binary.
+ `make static` for a statically linked binary.
+ `sudo make install`

Note: If you don't know the difference between dynamic & static linking then just use dynamic linker (`make`)

## Usage

Expand Down