mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-15 23:46:12 +00:00
Separate monitor detection code into different program
This commit is contained in:
@@ -1,24 +1,44 @@
|
||||
# Installation paths
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
LIBEXECDIR ?= $(PREFIX)/libexec
|
||||
SYSCONFDIR := $(PREFIX)/etc
|
||||
|
||||
# Compilers and tools
|
||||
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-time variables
|
||||
VERSION ?= $(shell git describe --tags --dirty)
|
||||
|
||||
build:
|
||||
mkdir -p build
|
||||
cd src; $(GO) build -ldflags "-w -X 'main.StormfetchVersion=$(VERSION)' -X 'main.SystemConfigDir=$(SYSCONFDIR)'" -o ../build/stormfetch stormfetch
|
||||
build: build-stormfetch build-stormfetch-monitor-detection
|
||||
|
||||
install: build/stormfetch config/
|
||||
# Create directoriy
|
||||
build-stormfetch:
|
||||
install -d build
|
||||
cd src/stormfetch; GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build -ldflags "$(LDFLAGS) -X 'main.StormfetchVersion=$(VERSION)' -X 'main.SystemConfigDir=$(SYSCONFDIR)' -X 'main.LibexecDir=$(LIBEXECDIR)'" -o ../../build/stormfetch
|
||||
|
||||
build-stormfetch-monitor-detection:
|
||||
install -d build
|
||||
cd src/stormfetch-monitor-detection; GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build -ldflags "$(LDFLAGS)" -o ../../build/stormfetch-monitor-detection
|
||||
|
||||
install: install-stormfetch install-stormfetch-monitor-detection install-config
|
||||
|
||||
install-stormfetch: build/stormfetch
|
||||
# Create directory
|
||||
install -dm755 $(DESTDIR)$(BINDIR)
|
||||
# Install binary
|
||||
install -m755 build/stormfetch $(DESTDIR)$(BINDIR)/stormfetch
|
||||
|
||||
install-stormfetch-monitor-detection: build/stormfetch-monitor-detection
|
||||
# Create directory
|
||||
install -dm755 $(DESTDIR)$(LIBEXECDIR)
|
||||
# Install binary
|
||||
install -m755 build/stormfetch-monitor-detection $(DESTDIR)$(LIBEXECDIR)/stormfetch-monitor-detection
|
||||
|
||||
install-config:
|
||||
# Create directory
|
||||
install -dm755 $(DESTDIR)$(SYSCONFDIR)
|
||||
@@ -27,9 +47,10 @@ install-config:
|
||||
|
||||
uninstall:
|
||||
-rm -f $(DESTDIR)$(BINDIR)/stormfetch
|
||||
-rm -f $(DESTDIR)$(LIBEXEDIR)/stormfetch-monitor-detection
|
||||
-rm -rf $(DESTDIR)$(SYSCONFDIR)/stormfetch
|
||||
|
||||
clean:
|
||||
rm -r build/
|
||||
|
||||
.PHONY: build install install-config uninstall clean
|
||||
.PHONY: build build-stormfetch build-stormfetch-monitor-detection install install-config uninstall clean
|
||||
|
||||
Reference in New Issue
Block a user