forked from WMFO/Rivendell-Spinitron-Update
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (36 loc) · 902 Bytes
/
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
#Makefile for Rivendell - Spinitron Update
#Suggested usage: git pull
# sudo make install
#
#Compile without installing: make all
INSTALLDIR=/opt/wmfo/rlm_spinitron
OWNER = root
MOD = 755
FILE = rlm_spinitron
CREDS = credentials.h
CREDSMOD = 600
.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: $(INSTALLDIR)/$(FILE).rlm
$(INSTALLDIR)/$(FILE).rlm: $(FILE).rlm
@mkdir -p $(INSTALLDIR)
@if [ -f $@ ] ; \
then \
cp $@ [email protected] ; \
fi;
@cp $< $@
@chown $(OWNER) $@
@chmod $(MOD) $@
uninstall:
@$(RM) $(INSTALLDIR)/$(FILE).rlm
@if [ -f $(INSTALLDIR)/$(FILE).rlm.bak ] ; \
then \
cp $(INSTALLDIR)/$(FILE).rlm.bak $(INSTALLDIR)/$(FILE).rlm ; \
$(RM) $(INSTALLDIR)/$(FILE).rlm.bak ; \
fi;