summaryrefslogtreecommitdiff
path: root/Makefile
blob: d1db3899af8fd7aa5336cf2fb7bfa71f1af5ea72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#   Copyright (c) 2012-2014, 2016-2019 Luke Shumaker <lukeshu@parabola.nu>
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

PACKAGE = parabolaweb-utils
VERSION = 20180326.1

# override gnuconf defaults
prefix      = /usr
sbindir     = $(bindir)
libexecdir  = $(exec_prefix)/lib
sysconfdir  = /etc/conf.d

# non-standard directories
systemddir    = $(prefix)/lib/systemd/system
uwsgidir      = /etc/uwsgi
pkglibexecdir = $(libexecdir)/parabolaweb-utils
pkgconffile   = $(sysconfdir)/parabolaweb
sudoersdir    = /etc/sudoers.d

webuser = parabolaweb

CFLAGS += -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter
CPPFLAGS += -DSCRIPT_LOCATION='"$(pkglibexecdir)/parabolaweb-changepassword.real"'

topoutdir ?= .
topsrcdir ?= .
include $(topsrcdir)/build-aux/Makefile.head.mk

targets = \
	$(sbindir)/parabolaweb-changepassword \
	$(sbindir)/parabolaweb-reporead-inotify \
	$(sbindir)/parabolaweb-reporead-rsync \
	$(sbindir)/parabolaweb-update \
	$(pkglibexecdir)/parabolaweb-changepassword.real \
	$(systemddir)/parabolaweb-reporead-inotify.service \
	$(systemddir)/parabolaweb-reporead-rsync.service \
	$(systemddir)/parabolaweb-reporead-rsync.timer \
	$(uwsgidir)/parabolaweb.ini \
	$(sudoersdir)/10-parabolaweb

files.out.all = depends.txt $(filter-out $(files.src.src),$(notdir $(patsubst $(sudoersdir)/%,%.sudoers,$(targets))))
files.sys.all = $(targets) $(pkgconffile)

# Pattern rules

%: %.in .var.sbindir .var.pkgconffile .var.webuser
	sed $(foreach v,$(patsubst .var.%,%,$(filter .var.%,$^)), -e 's|@$v@|$($v)|' ) < $< > $@

%: %.c .var.LINK.c
	$(LINK.c) $(filter-out .var.%,$^) -o $@

$(DESTDIR)$(sbindir)/%: %
	install -Dm755 $< $@

$(DESTDIR)$(pkglibexecdir)/%: %
	install -Dm755 $< $@

$(DESTDIR)$(systemddir)/%.service: %.service
	install -Dm644 $< $@

$(DESTDIR)$(systemddir)/%.timer: %.timer
	install -Dm644 $< $@

$(DESTDIR)$(uwsgidir)/%: %
	install -Dm644 $< $@

$(DESTDIR)$(sudoersdir)/%: %.sudoers | $(DESTDIR)$(sudoersdir)
	install -Dm644 $< $@

$(DESTDIR)$(sudoersdir):
	install -dm750 $@

# Specific rules

depends.txt: list-depends depends_static.txt
	./$< > $@

$(DESTDIR)$(sbindir)/parabolaweb-changepassword: parabolaweb-changepassword
	install -Dm4755 $< $@

$(DESTDIR)$(pkgconffile): parabolaweb.conf
	install -Dm644 $< $@

.DELETE_ON_ERROR:
.SECONDARY:
.SUFFIXES:

include $(topsrcdir)/build-aux/Makefile.tail.mk