-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
39 lines (30 loc) · 864 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
.PHONY: all clean test
PROG= totp
SRCS= totp.c \
hmac/hmac_sha1.c \
sha/sha1.c
UNAME_SYS := $(shell uname -s)
ifeq ($(UNAME_SYS), Linux)
RESTRICT_PROCESS ?= seccomp
else ifeq ($(UNAME_SYS), OpenBSD)
CFLAGS ?= -DHAVE_STRTONUM
RESTRICT_PROCESS ?= pledge
else ifeq ($(UNAME_SYS), FreeBSD)
CFLAGS ?= -DHAVE_STRTONUM
RESTRICT_PROCESS ?= capsicum
endif
RESTRICT_PROCESS ?= rlimit
TOTP_CFLAGS ?= -g -Wall -Wextra -fwrapv -pedantic -pie -fPIE
CFLAGS += $(TOTP_CFLAGS) \
-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong \
-Wformat -Werror=format-security \
-fno-strict-aliasing \
-DRESTRICT_PROCESS_$(RESTRICT_PROCESS)
LDFLAGS ?= -Wl,-z,relro,-z,now -Wl,-z,noexecstack -I. $(TOTP_LDFLAGS)
all: $(PROG)
$(PROG):
$(CC) $(CFLAGS) -o $(PROG) $(SRCS) $(LDFLAGS)
clean:
-@rm $(PROG)
test:
@PATH=.:$(PATH) bats test