aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
blob: e18bb979a8ce309b3a852c123db4af667a8a5262 (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
# Makefile for ctct
#
# Copyright 2015, 2016, 2018 Einhard Leichtfuß
#
# This file is part of ctct.
#
# ctct is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# ctct 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with ctct.  If not, see <https://www.gnu.org/licenses/>.
#

TARGET = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@

# for some reason, autoconf references to ${PACKAGE_TARNAME} in docdir
PACKAGE_TARNAME = @PACKAGE_TARNAME@

SRCS = @PACKAGE_NAME@.c
DOCS = COPYING README CHANGELOG

# If there were more than one, a separate confdir should be created.
CONFIG = ctct_config

INSTALL = install
INSTALL_PROGRAM = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -d -m 755
RM = rm

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
datarootdir = @datarootdir@
sysconfdir = @sysconfdir@
docdir = @docdir@
bash_completion_dir = @bash_completion_dir@
mandir = @mandir@
man1dir = $(mandir)/man1
man5dir = $(mandir)/man5
man1ext = .1
man5ext = .5

all: $(TARGET)

install: installdirs
	$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(bindir)/
	$(INSTALL_DATA) $(CONFIG) $(DESTDIR)$(sysconfdir)/
	$(INSTALL_DATA) $(DOCS) $(DESTDIR)$(docdir)/
	$(INSTALL_DATA) bash_completion \
		$(DESTDIR)$(bash_completion_dir)/$(TARGET)
	$(INSTALL_DATA) $(TARGET)$(man1ext) $(DESTDIR)$(man1dir)/
	$(INSTALL_DATA) $(CONFIG)$(man5ext) $(DESTDIR)$(man5dir)/

installdirs:
	$(INSTALL_DIR) $(DESTDIR)$(bindir)
	$(INSTALL_DIR) $(DESTDIR)$(sysconfdir)
	$(INSTALL_DIR) $(DESTDIR)$(docdir)
	$(INSTALL_DIR) $(DESTDIR)$(bash_completion_dir)
	$(INSTALL_DIR) $(DESTDIR)$(man1dir)
	$(INSTALL_DIR) $(DESTDIR)$(man5dir)

uninstall:
	$(RM) $(DESTDIR)$(bindir)/$(TARGET)
	# Only remove configuration file if unchanged.
	if cmp $(CONFIG) $(DESTDIR)$(sysconfdir)/$(CONFIG); \
	then \
		$(RM) $(DESTDIR)$(sysconfdir)/$(CONFIG); \
	fi
	for file in $(DOCS); \
	do \
		$(RM) $(DESTDIR)$(docdir)/$$file; \
	done
	-$(RM) -d $(DESTDIR)$(docdir)
	$(RM) $(DESTDIR)$(bash_completion_dir)/$(TARGET)
	$(RM) $(DESTDIR)$(man1dir)/$(TARGET)$(man1ext)
	$(RM) $(DESTDIR)$(man5dir)/$(CONFIG)$(man5ext)

.PHONY: install installdirs uninstall

# vi: ts=2 sw=2