Check for gcc in Makefile

This commit is contained in:
Jagger 2016-03-09 00:56:20 +01:00
parent 09e08a2c1f
commit a71371e327
2 changed files with 8 additions and 4 deletions

View File

@ -24,16 +24,20 @@ CFLAGS += -O2 -g -ggdb -c -std=gnu11 \
-fstack-protector-all -Wformat -Wformat=2 -Wformat-security -fPIE \ -fstack-protector-all -Wformat -Wformat=2 -Wformat-security -fPIE \
-Wall -Wextra -Werror -Wall -Wextra -Werror
LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie -Wa,--noexecstack LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
COMPILER_CLANG = $(shell $(CC) -v 2>&1 | grep "clang version" | grep -o "clang") COMPILER_CLANG = $(shell $(CC) -v 2>&1 | grep "clang version" | grep -o "clang")
COMPILER_GCC = $(shell $(CC) -v 2>&1 | grep "gcc version" | grep -o "gcc")
ifeq ($(COMPILER_CLANG),clang) ifeq ($(COMPILER_CLANG),clang)
CFLAGS += -fblocks CFLAGS += -fblocks
LDFLAGS += -lBlocksRuntime LDFLAGS += -lBlocksRuntime
endif endif
ifeq ($(COMPILER_CLANG),gcc)
LDFLAGS += -Wa,--noexecstack
endif
SRCS = nsjail.c cmdline.c contain.c log.c net.c mount.c user.c subproc.c sandbox.c util.c uts.c seccomp/bpf-helper.c SRCS = nsjail.c cmdline.c contain.c log.c mount.c net.c sandbox.c subproc.c user.c util.c uts.c seccomp/bpf-helper.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)
BIN = nsjail BIN = nsjail

View File

@ -350,7 +350,7 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
{{"tmpfs_size", required_argument, NULL, 0x0602}, "Number of bytes to allocate for tmpfsmounts (default: 4194304)"}, {{"tmpfs_size", required_argument, NULL, 0x0602}, "Number of bytes to allocate for tmpfsmounts (default: 4194304)"},
{{"disable_proc", no_argument, NULL, 0x0603}, "Disable mounting /proc in the jail"}, {{"disable_proc", no_argument, NULL, 0x0603}, "Disable mounting /proc in the jail"},
{{"iface_no_lo", no_argument, NULL, 0x700}, "Don't bring up the 'lo' interface"}, {{"iface_no_lo", no_argument, NULL, 0x700}, "Don't bring up the 'lo' interface"},
{{"iface", required_argument, NULL, 'I'}, "Interface which will be cloned (MACVTAP) and put inside the subprocess' namespace as 'vs'"}, {{"iface", required_argument, NULL, 'I'}, "Interface which will be cloned (MACVLAN) and put inside the subprocess' namespace as 'vs'"},
{{"iface_vs_ip", required_argument, NULL, 0x701}, "IP of the 'vs' interface"}, {{"iface_vs_ip", required_argument, NULL, 0x701}, "IP of the 'vs' interface"},
{{"iface_vs_nm", required_argument, NULL, 0x702}, "Netmask of the 'vs' interface"}, {{"iface_vs_nm", required_argument, NULL, 0x702}, "Netmask of the 'vs' interface"},
{{"iface_vs_gw", required_argument, NULL, 0x703}, "Default GW for the 'vs' interface"}, {{"iface_vs_gw", required_argument, NULL, 0x703}, "Default GW for the 'vs' interface"},