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
|
|
|
|
|
2015-07-01 13:12:16 +00:00
|
|
|
UNAME_SYS := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_SYS), Linux)
|
2016-02-03 15:17:31 +00:00
|
|
|
LDFLAGS += -luuid -lresolv -Wl,-Bsymbolic-functions -Wl,-z,relro
|
|
|
|
CFLAGS ?= -D_FORTIFY_SOURCE=2 -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fno-strict-aliasing
|
2017-02-05 14:18:56 +00:00
|
|
|
XMPPIPE_SANDBOX ?= XMPPIPE_SANDBOX_SECCOMP
|
2017-02-01 15:25:38 +00:00
|
|
|
XMPPIPE_SANDBOX_RLIMIT_NOFILE ?= 0
|
2017-02-04 14:00:49 +00:00
|
|
|
else ifeq ($(UNAME_SYS), FreeBSD)
|
|
|
|
XMPPIPE_SANDBOX ?= XMPPIPE_SANDBOX_CAPSICUM
|
2017-01-30 15:17:54 +00:00
|
|
|
else ifeq ($(UNAME_SYS), OpenBSD)
|
|
|
|
XMPPIPE_SANDBOX ?= XMPPIPE_SANDBOX_PLEDGE
|
2015-07-01 13:12:16 +00:00
|
|
|
else ifeq ($(UNAME_SYS), SunOS)
|
|
|
|
LDFLAGS += -luuid -lresolv
|
|
|
|
else ifeq ($(UNAME_SYS), Darwin)
|
|
|
|
LDFLAGS += -lresolv
|
|
|
|
endif
|
|
|
|
|
2017-02-05 14:18:56 +00:00
|
|
|
XMPPIPE_SANDBOX ?= XMPPIPE_SANDBOX_RLIMIT
|
2017-02-01 15:25:38 +00:00
|
|
|
XMPPIPE_SANDBOX_RLIMIT_NOFILE ?= -1
|
2017-02-03 14:47:12 +00:00
|
|
|
CFLAGS += -DXMPPIPE_SANDBOX=\"$(XMPPIPE_SANDBOX)\" -D$(XMPPIPE_SANDBOX) \
|
|
|
|
-DXMPPIPE_SANDBOX_RLIMIT_NOFILE=$(XMPPIPE_SANDBOX_RLIMIT_NOFILE)
|
2017-01-29 14:13:18 +00:00
|
|
|
|
2017-04-16 19:24:01 +00:00
|
|
|
all: $(PROG)
|
|
|
|
|
|
|
|
$(PROG):
|
2015-07-01 13:12:16 +00:00
|
|
|
$(CC) -g -Wall $(CFLAGS) -o xmppipe src/*.c $(LDFLAGS) -lstrophe
|
2015-05-25 14:20:04 +00:00
|
|
|
|
|
|
|
static:
|
2016-02-03 15:17:31 +00:00
|
|
|
$(CC) $(CFLAGS) -g -Wall -o xmppipe src/*.c -Wl,--no-as-needed -ldl -lz \
|
2015-05-25 14:20:04 +00:00
|
|
|
/usr/local/lib/libstrophe.a \
|
|
|
|
/usr/lib/*/libresolv.a \
|
|
|
|
/usr/lib/*/libssl.a \
|
|
|
|
/usr/lib/*/libcrypto.a \
|
|
|
|
/usr/lib/*/libexpat.a \
|
|
|
|
/usr/lib/*/libuuid.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
|