-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
64 lines (44 loc) · 1.27 KB
/
makefile
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
programName=emb-tamper
confDir=etc/$(programName)
systemdServiceDir=etc/systemd/system
systemPath=/usr/local/bin
logPath=/var/log/$(programName)
#Macro to check the exit code of a make expression and possibly not fail on warnings
RC := test $$? -lt 100
build: compile
restart: serviceEnable
install: build configure perlDeploy scriptsLink serviceEnable
perlDeploy:
./Build installdeps
./Build install
compile:
#Build Perl modules
perl Build.PL
./Build
test:
prove -Ilib -I. t/*.t
configure:
mkdir -p /$(confDir)
cp --backup=numbered $(confDir)/daemon.conf /$(confDir)/daemon.conf
cp --backup=numbered $(confDir)/log4perl.conf /$(confDir)/log4perl.conf
cp $(systemdServiceDir)/$(programName).service /$(systemdServiceDir)/$(programName).service
mkdir -p $(logPath)
chown -R toveri:toveri $(logPath)
unconfigure:
rm -r /$(confDir) || $(RC)
rm -r $(logPath) || $(RC)
serviceEnable:
systemctl daemon-reload
systemctl enable $(programName)
systemctl restart $(programName)
serviceDisable:
systemctl stop $(programName)
rm /$(systemdServiceDir)/$(programName).service
systemctl daemon-reload
scriptsLink:
cp scripts/tamper $(systemPath)/
scriptsUnlink:
rm $(systemPath)/tamper
clean:
./Build realclean
uninstall: serviceDisable unconfigure scriptsUnlink clean