forked from fac/auth-script-openvpn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (31 loc) · 978 Bytes
/
Makefile
File metadata and controls
40 lines (31 loc) · 978 Bytes
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
CC ?= cc
CFLAGS ?= -O -Wall -Wextra -Wformat-security -D_FORTIFY_SOURCE=2
CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809L
LDFLAGS += -fPIC -shared
# FreeBSD puts the openvpn header in a different location unknown to clang
IPATH_FREEBSD = /usr/local/include/
# Add OS Specific build flags
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),FreeBSD)
# Add the include path for openvpn-plugin.h
CFLAGS += -I$(IPATH_FREEBSD)
# Ensure the signals we need are visible
CFLAGS += -D_XOPEN_SOURCE=600
# BSD uses Clang - we need to check for stack-protector-strong flag
STACK_PROTECT := $(shell $(CC) --help | grep stack-protector-strong)
ifneq ($(filter %stack-protector-strong, $(STACK_PROTECT)),)
CFLAGS += -fstack-protector-strong
endif
else
CFLAGS += -fstack-protector-strong
endif
$(info Building for $(UNAME_S))
# Output Files
SRC = $(wildcard *.c)
OUT = $(SRC:%.c=%.so)
%.so: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
all: plugin
plugin: $(OUT)
clean:
rm -f *.so