github.com/noriah/catnip@v1.8.5/Makefile (about)

     1  BUILD_TAG = devel
     2  ARCH ?= $(shell uname -m)
     3  BIN := catnip
     4  DESTDIR :=
     5  GO ?= go
     6  PKGNAME := catnip
     7  PREFIX := /usr/local
     8  
     9  MAJORVERSION := 1
    10  MINORVERSION := 8
    11  PATCHVERSION := 5
    12  VERSION ?= ${MAJORVERSION}.${MINORVERSION}.${PATCHVERSION}
    13  
    14  MAIN_DIR := ./cmd/catnip
    15  
    16  LDFLAGS :=  -ldflags "\
    17  	-X main.version=${VERSION} \
    18  	-linkmode=external \
    19  	"
    20  
    21  SOURCES ?= $(shell find . -name "*.go" -type f)
    22  
    23  
    24  build: $(BIN)
    25  
    26  clean:
    27  	rm $(BIN)
    28  
    29  .PHONY: clean
    30  
    31  all: build
    32  
    33  .PHONY: install
    34  install: build
    35  	install -Dm755 ${BIN} $(DESTDIR)$(PREFIX)/bin/${BIN}
    36  
    37  .PHONY: uninstall
    38  uninstall:
    39  	rm -f $(DESTDIR)$(PREFIX)/bin/${BIN}
    40  
    41  $(BIN): $(SOURCES)
    42  	$(GO) build $(FLAGS) $(LDFLAGS) -o $@ $(EXTRA_FLAGS) $(MAIN_DIR)