2
0
mirror of https://github.com/msantos/xmppipe synced 2024-11-16 00:12:59 +00:00
xmppipe/Makefile

71 lines
1.8 KiB
Makefile
Raw Normal View History

2017-02-17 14:57:32 +00:00
.PHONY: all static clean test
2017-04-16 19:24:01 +00:00
PROG=xmppipe
2015-05-11 19:19:35 +00:00
RM=rm
UNAME_SYS := $(shell uname -s)
ifeq ($(UNAME_SYS), Linux)
2017-11-02 14:19:19 +00:00
CFLAGS ?= -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong \
-Wformat -Werror=format-security \
2018-12-30 12:57:52 +00:00
-pie -fPIE \
2017-04-23 13:55:09 +00:00
-fno-strict-aliasing
XMPPIPE_SANDBOX ?= seccomp
XMPPIPE_SANDBOX_RLIMIT_NOFILE ?= 0
2018-12-30 12:57:52 +00:00
LDFLAGS ?= -Wl,-z,relro,-z,now -Wl,-z,noexecstack
else ifeq ($(UNAME_SYS), FreeBSD)
2017-05-18 13:55:45 +00:00
CFLAGS ?= -DHAVE_STRTONUM \
2017-11-02 14:19:19 +00:00
-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong \
-Wformat -Werror=format-security \
2018-12-30 12:57:52 +00:00
-pie -fPIE \
2017-04-23 13:55:09 +00:00
-fno-strict-aliasing
XMPPIPE_SANDBOX ?= capsicum
2018-12-30 12:57:52 +00:00
LDFLAGS ?= -Wl,-z,relro,-z,now -Wl,-z,noexecstack
else ifeq ($(UNAME_SYS), OpenBSD)
2017-05-18 13:55:45 +00:00
CFLAGS ?= -DHAVE_STRTONUM \
2017-11-02 14:19:19 +00:00
-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong \
-Wformat -Werror=format-security \
2018-12-30 12:57:52 +00:00
-pie -fPIE \
2017-04-23 13:55:09 +00:00
-fno-strict-aliasing
XMPPIPE_SANDBOX ?= pledge
2018-12-30 12:57:52 +00:00
LDFLAGS ?= -Wl,-z,relro,-z,now -Wl,-z,noexecstack
else ifeq ($(UNAME_SYS), SunOS)
else ifeq ($(UNAME_SYS), Darwin)
2018-04-13 11:32:46 +00:00
CFLAGS ?= -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong \
-Wformat -Werror=format-security \
2018-12-30 12:57:52 +00:00
-pie -fPIE \
2018-04-13 11:32:46 +00:00
-fno-strict-aliasing
endif
XMPPIPE_SANDBOX ?= rlimit
XMPPIPE_SANDBOX_RLIMIT_NOFILE ?= -1
XMPPIPE_CFLAGS ?= -g -Wall
CFLAGS += $(XMPPIPE_CFLAGS) \
-fwrapv \
-DXMPPIPE_SANDBOX=\"$(XMPPIPE_SANDBOX)\" \
-DXMPPIPE_SANDBOX_$(XMPPIPE_SANDBOX) \
-DXMPPIPE_SANDBOX_RLIMIT_NOFILE=$(XMPPIPE_SANDBOX_RLIMIT_NOFILE)
LDFLAGS += $(XMPPIPE_LDFLAGS)
2017-04-16 19:24:01 +00:00
all: $(PROG)
$(PROG):
$(CC) $(CFLAGS) -o xmppipe src/*.c $(LDFLAGS) -lstrophe
static:
2019-01-09 15:20:23 +00:00
$(CC) $(CFLAGS) \
-no-pie -fno-PIE \
$(XMPPIPE_CFLAGS) \
-o xmppipe src/*.c -Wl,--no-as-needed \
$(LDFLAGS) -ldl -lz -lresolv \
2017-10-31 14:09:01 +00:00
-l:libstrophe.a \
-l:libssl.a -l:libcrypto.a \
-l:libexpat.a
2015-05-11 19:19:35 +00:00
clean:
2017-04-16 19:24:01 +00:00
-@$(RM) $(PROG)
2017-02-17 14:57:32 +00:00
2017-04-16 19:24:01 +00:00
test: $(PROG)
2017-02-18 14:56:22 +00:00
-@PATH=.:$$PATH bats test