From 040daebafba8d446aefdd0d3db84e22f9cb0ca8c Mon Sep 17 00:00:00 2001 From: EnumDev Date: Sun, 26 Apr 2026 21:45:55 +0300 Subject: [PATCH] Update Makefile --- Makefile | 24 +++++++++++++++++------- src/go.mod | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 59b2538..dc3d5d0 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/go.mod b/src/go.mod index f18e453..4799408 100644 --- a/src/go.mod +++ b/src/go.mod @@ -1,4 +1,4 @@ -module Typer +module typer go 1.24