Makefile - fingered - Fingerd protocol daemon, allowing custom responses.
 (HTM) git clone git://jay.scot/fingered
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       Makefile (1348B)
       ---
            1 # Makefile
            2 
            3 .PHONY: all fmt lint test build clean install
            4 
            5 BIN := bin
            6 NAME := fingered
            7 VER := 0.1.0
            8 
            9 BUILD_FLAGS := -ldflags="-s -w"
           10 
           11 # List of target platforms
           12 PLATFORMS := \
           13         linux_amd64 \
           14         linux_386 \
           15         darwin_amd64 \
           16         freebsd_amd64 \
           17         freebsd_386 \
           18         openbsd_amd64 \
           19         openbsd_386
           20 
           21 # Generate binary paths
           22 BINS := $(addprefix $(BIN)/$(NAME)_$(VER)_,$(PLATFORMS))
           23 
           24 # Installation path
           25 INSTALL_PATH := /usr/local/bin
           26 
           27 # Detect current platform and architecture
           28 GOOS := $(shell go env GOOS)
           29 GOARCH := $(shell go env GOARCH)
           30 
           31 # Default target: format, lint, build
           32 all: fmt lint build
           33 
           34 fmt:
           35         @echo "Formatting code..."
           36         go fmt ./...
           37 
           38 lint:
           39         @echo "Running linters..."
           40         golangci-lint run
           41 
           42 test:
           43         @echo "Running tests..."
           44         go test ./tests
           45 
           46 # Build binaries for target platforms
           47 build: $(BINS)
           48 
           49 $(BIN)/$(NAME)_$(VER)_%: main.go
           50         @echo "Building for $*..."
           51         GOARCH=$(word 2,$(subst _, ,$*)) GOOS=$(word 1,$(subst _, ,$*)) go build ${BUILD_FLAGS} -o $@ main.go
           52 
           53 # Clean up artifacts
           54 clean:
           55         go clean
           56         rm -f $(BINS)
           57 
           58 # Install the binary for the current platform and architecture
           59 install: $(BIN)/$(NAME)_$(VER)_$(GOOS)_$(GOARCH)
           60         @echo "Installing binary to $(INSTALL_PATH)..."
           61         mkdir -p $(INSTALL_PATH)
           62         cp -f $(BIN)/$(NAME)_$(VER)_$(GOOS)_$(GOARCH) $(INSTALL_PATH)/$(NAME)
           63         chmod +x $(INSTALL_PATH)/$(NAME)
           64 
           65 run: build
           66         ./$(BIN)/$(NAME)_$(VER)_linux_amd64