eclipse/Makefile

69 lines
2.1 KiB
Makefile
Raw Normal View History

2024-01-11 00:13:14 +00:00
# Copyright (C) 2023-2024 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
2024-01-17 21:00:28 +00:00
all: build
.PHONY: all
2024-01-13 02:55:28 +00:00
go_build_flags = -trimpath -tags=libsqlite3
2024-01-17 21:00:28 +00:00
go_programs := $(sort $(patsubst cmd/%/,%,$(wildcard cmd/*/)))
.DELETE_ON_ERROR:
.NOTINTERMEDIATE:
# Generate #####################################################################
2024-01-11 00:13:14 +00:00
generate/files = COPYING.txt
COPYING.txt:
curl https://www.gnu.org/licenses/agpl-3.0.txt >$@
generate: $(generate/files)
generate-clean:
rm -f -- $(generate/files)
.PHONY: generate generate-clean
2024-01-17 21:00:28 +00:00
# Build ########################################################################
build: $(addprefix bin/,$(go_programs))
.PHONY: build
bin:
mkdir $@
$(foreach p,$(go_programs),bin/.$p.stamp): bin/.%.stamp: cmd/% generate
go build $(go_build_flags) -o $@ ./$<
$(foreach p,$(go_programs),bin/$p): bin/%: bin/.%.stamp
@if cmp -s $< $@; then echo $@: already up to date; else PS4=; set -x; cp -f $< $@; fi
# Install ######################################################################
DESTDIR ?=
prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
libdir ?= $(exec_prefix)/lib
systemdunitdir ?= $(libdir)/systemd/system
sysusersdir ?= $(libdir)/sysusers.d
install/files = $(addprefix $(DESTDIR)$(bindir)/,$(go_programs))
2024-01-17 21:52:40 +00:00
install/files += $(DESTDIR)$(systemdunitdir)/eclipse-httpd.socket
install/files += $(DESTDIR)$(systemdunitdir)/eclipse-httpd.service
2024-01-17 21:00:28 +00:00
install/files += $(DESTDIR)$(systemdunitdir)/eclipse-trigger.timer
install/files += $(DESTDIR)$(systemdunitdir)/eclipse-trigger.service
install/files += $(DESTDIR)$(sysusersdir)/eclipse.conf
install: $(install/files)
uninstall:
rm -f -- $(install/files)
.PHONY: install uninstall
$(addprefix $(DESTDIR)$(bindir)/,$(go_programs)): $(DESTDIR)$(bindir)/%: bin/%
install -Dm755 $< $@
$(DESTDIR)$(sysusersdir)/eclipse.conf: etc/sysusers.conf
install -Dm644 $< $@
$(DESTDIR)$(systemdunitdir)/%.socket: etc/%.socket
install -Dm644 $< $@
$(DESTDIR)$(systemdunitdir)/%.timer: etc/%.timer
install -Dm644 $< $@
$(DESTDIR)$(systemdunitdir)/%.service: etc/%.service
<$< sed 's|@bindir@|$(bindir)|g' | install -Dm644 /dev/stdin $@