summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBen Murray <ben@duosecurity.com>2014-05-20 19:09:46 -0400
committerBen Murray <ben@duosecurity.com>2014-05-21 19:35:45 -0400
commit4d3727c5aac0aa4e1053da4a15b798d1cd63614c (patch)
tree18b3f0162c969ae1218fa7dccd9d48b9d4370a37 /Makefile
parentf52a357d560a17a279cdc550a2893d925fbd6246 (diff)
downloadopenvpn-duo-plugin-4d3727c5aac0aa4e1053da4a15b798d1cd63614c.tar.gz
openvpn-duo-plugin-4d3727c5aac0aa4e1053da4a15b798d1cd63614c.zip
`make PREFIX=/a/b install` (un)installs somewhere other than /opt/duo
Running "make all" and "make install" with different PREFIXES will produce a non-working installation. However, "make all" can be skipped. DESTDIR is also controllable for making packages.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 16 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 24ebb6d..2481c83 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@
+PREFIX=/opt/duo
+CFLAGS += -DPREFIX='"$(PREFIX)"'
+
ifdef USE_PERL
-CFLAGS=-DUSE_PERL
+CFLAGS += -DUSE_PERL
SCRIPT_NAME=duo_openvpn.pl
else
SCRIPT_NAME=duo_openvpn.py
@@ -8,29 +11,27 @@ endif
all: duo_openvpn.so
duo_openvpn.o: duo_openvpn.c
- cc $(CFLAGS) -fPIC -c duo_openvpn.c
+ $(CC) $(CFLAGS) -fPIC -c duo_openvpn.c
duo_openvpn.so: duo_openvpn.o
- cc -fPIC -shared -Wl,-soname,duo_openvpn.so -o duo_openvpn.so duo_openvpn.o -lc
+ $(CC) -fPIC -shared -Wl,-soname,duo_openvpn.so -o duo_openvpn.so duo_openvpn.o -lc
install: duo_openvpn.so
- mkdir -p /opt/duo
- cp duo_openvpn.so /opt/duo
- chmod 755 /opt/duo/duo_openvpn.so
- cp ca_certs.pem /opt/duo
- chmod 644 /opt/duo/ca_certs.pem
+ mkdir -p $(DESTDIR)$(PREFIX)
+ install -c duo_openvpn.so -m 755 $(DESTDIR)$(PREFIX)
+ install -c ca_certs.pem -m 644 $(DESTDIR)$(PREFIX)
ifdef USE_PERL
- cp duo_openvpn.pl /opt/duo
- chmod 755 /opt/duo/duo_openvpn.pl
+ install -c duo_openvpn.pl -m 755 $(DESTDIR)$(PREFIX)
else
- cp duo_openvpn.py /opt/duo
- cp https_wrapper.py /opt/duo
- chmod 755 /opt/duo/duo_openvpn.py
- chmod 644 /opt/duo/https_wrapper.py
+ install -c duo_openvpn.py https_wrapper.py -m 755 $(DESTDIR)$(PREFIX)
endif
uninstall:
- rm -rf /opt/duo
+ rm -f $(DESTDIR)$(PREFIX)/duo_openvpn.so
+ rm -f $(DESTDIR)$(PREFIX)/ca_certs.pem
+ rm -f $(DESTDIR)$(PREFIX)/duo_openvpn.pl
+ rm -f $(DESTDIR)$(PREFIX)/duo_openvpn.py
+ rm -f $(DESTDIR)$(PREFIX)/https_wrapper.py
clean:
rm -f *.so *.o