Update Makefile

This commit is contained in:
2026-04-26 21:45:55 +03:00
parent 2bf960b085
commit 040daebafb
2 changed files with 18 additions and 8 deletions
+17 -7
View File
@@ -4,24 +4,34 @@ BINDIR ?= $(PREFIX)/bin
SYSCONFDIR := $(PREFIX)/etc
# Compilers and tools
GO ?= $(shell which go)
GO ?= go
# Compiler flags
GOOS ?= $(shell $(GO) env | grep '^GOOS' | cut -d'=' -f2 | tr -d "'")
GOARCH ?= $(shell $(GO) env | grep '^GOARCH' | cut -d'=' -f2 | tr -d "'")
LDFLAGS ?= -w
build:
mkdir -p build
cd src/; $(GO) build -ldflags "-w -X 'main.sysconfdir=$(SYSCONFDIR)'" -o ../build/typer
install -dm755 build
cd src/; GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build -ldflags "$(LDFLAGS) -X 'main.sysconfdir=$(SYSCONFDIR)'" -o ../build/
install: build/typer
# Create directories
install -dm755 $(DESTDIR)$(BINDIR)
# Install files
install -m755 build/typer* $(DESTDIR)$(BINDIR)/
install-config:
# Create directories
install -dm755 $(DESTDIR)$(SYSCONFDIR)
# Install files
install -Dm755 build/typer $(DESTDIR)$(BINDIR)/typer
cp -r config -T $(DESTDIR)$(SYSCONFDIR)/typer
uninstall:
rm $(DESTDIR)$(BINDIR)/typer
-rm -f $(DESTDIR)$(BINDIR)/typer
-rm -rf $(DESTDIR)$(SYSCONFDIR)/typer
clean:
rm -r build/
-rm -rf build/
.PHONY: build
.PHONY: build install install-config uninstall clean
+1 -1
View File
@@ -1,4 +1,4 @@
module Typer
module typer
go 1.24