-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
68 lines (56 loc) · 1.77 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
64
65
66
67
68
PACKAGE := openvpn_defer_auth
PROGRAM := $(PACKAGE).so
CC := gcc
PREFIX := /usr
INSTALL := install
CFLAGS := -fPIC
# RPM info
VERSION := 1.4.0
GIT_VERSION := $(shell git rev-parse HEAD)
RPM_ITERATION := 1
FPM_DIR := fpm_tmp_build_dir
LICENSE := GPLv2
UPSTREAM_URL := https://github.com/mozilla-it/openvpn_defer_auth
SUMMARY := OpenVPN plugin to handle deferred authentication requests
DESCRIPTION := Allows authentications for openvpn to be a nonblocking operation\nThis package is built upon commit $(GIT_VERSION)\n
src = $(wildcard *.c)
obj = $(src:.c=.o)
# OSX does a different linker
linker_Darwin = -install_name,$(PROGRAM)
linker_Linux = -soname,$(PROGRAM)
LDFLAGS = -shared -Wl,$(linker_$(shell uname -s))
# OSX calls it lib no matter what
libdir_Darwin = lib
libdir_Linux_x86_64 = lib64
libdir_Linux_i686 = lib
libdir_Linux = $(libdir_Linux_$(shell uname -i))
LIBDIR = $(PREFIX)/$(libdir_$(shell uname -s))
.DEFAULT: all
.PHONY: clean all install installdirs install-strip uninstall rpm
all:
$(MAKE) $(PROGRAM)
$(PROGRAM): $(obj)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
clean:
rm -f $(obj) $(PROGRAM)
rm -f *.rpm
rm -rf $(FPM_DIR)
installdirs:
mkdir -p $(DESTDIR)$(LIBDIR)/openvpn/plugins
install: $(PROGRAM)
@$(MAKE) installdirs
$(INSTALL) -m755 $(PROGRAM) $(DESTDIR)$(LIBDIR)/openvpn/plugins
uninstall:
rm -f $(DESTDIR)$(LIBDIR)/openvpn/plugins/$(PROGRAM)
install-strip:
@$(MAKE) INSTALL='$(INSTALL) -s' install
rpm:
rm -rf $(FPM_DIR)
@$(MAKE) DESTDIR=$(FPM_DIR) install-strip
fpm -f -s dir -t rpm -d openvpn \
--rpm-dist "$(shell rpmbuild -E '%{?dist}' | sed -e 's#^\.##')" \
-n $(PACKAGE) -v $(VERSION) --iteration $(RPM_ITERATION) \
--license $(LICENSE) --url $(UPSTREAM_URL) \
--rpm-summary "$(SUMMARY)" \
--description "$$(printf "$(DESCRIPTION)")" \
-C $(FPM_DIR) usr