-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
49 lines (41 loc) · 1.07 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
#Makefile for Rivendell - Spinitron Update
#Suggested usage: git pull
# sudo make install
#
#Compile without installing: make all
BASE=/opt/wmfo
INSTALLDIR=rlm_spinitron
OWNER = root
MOD = 755
FILE = rlm_spinitron
CREDS = credentials.h
CREDSMOD = 600
SCRIPTDIR=macro_sh
.PHONY: all install uninstall
all: $(FILE).rlm $(CREDS)
@chown $(OWNER) $(CREDS)
@chmod $(CREDSMOD) $(CREDS)
$(FILE).rlm: $(FILE).c
@gcc -shared -o $@ $< -Wall -Wextra -Werror -fPIC
@chown $(OWNER) $@
@chmod $(MOD) $@
install: $(BASE)/$(INSTALLDIR)/$(FILE).rlm
@chmod $(MOD) $(SCRIPTDIR)/*
@mkdir -p $(BASE)/$(SCRIPTDIR)
@cp $(SCRIPTDIR)/* $(BASE)/$(SCRIPTDIR)
$(BASE)/$(INSTALLDIR)/$(FILE).rlm: $(FILE).rlm
@mkdir -p $(BASE)/$(INSTALLDIR)
@if [ -f $@ ] ; \
then \
cp $@ $@.bak ; \
fi;
@cp $< $@
@chown $(OWNER) $@
@chmod $(MOD) $@
uninstall:
@$(RM) $(BASE)/$(INSTALLDIR)/$(FILE).rlm
@if [ -f $(BASE)/$(INSTALLDIR)/$(FILE).rlm.bak ] ; \
then \
cp $(BASE)/$(INSTALLDIR)/$(FILE).rlm.bak $(BASE)/$(INSTALLDIR)/$(FILE).rlm ; \
$(RM) $(BASE)/$(INSTALLDIR)/$(FILE).rlm.bak ; \
fi;