diff options
-rw-r--r-- | config.mk.in | 7 | ||||
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | src/prog.mk | 11 | ||||
-rw-r--r-- | src/so.mk | 8 |
5 files changed, 33 insertions, 15 deletions
diff --git a/config.mk.in b/config.mk.in index 9973b7eaa..cfef6b8d3 100644 --- a/config.mk.in +++ b/config.mk.in | |||
@@ -51,8 +51,15 @@ HAVE_ONLY_SYSCFG_PROFILES=@HAVE_ONLY_SYSCFG_PROFILES@ | |||
51 | 51 | ||
52 | MANFLAGS = $(HAVE_LTS) $(HAVE_OUTPUT) $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_IDS) $(HAVE_OVERLAYFS) $(HAVE_USERTMPFS) $(HAVE_DBUSPROXY) $(HAVE_FIRETUNNEL) $(HAVE_GLOBALCFG) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_FILE_TRANSFER) $(HAVE_SELINUX) $(HAVE_SUID) $(HAVE_FORCE_NONEWPRIVS) $(HAVE_ONLY_SYSCFG_PROFILES) | 52 | MANFLAGS = $(HAVE_LTS) $(HAVE_OUTPUT) $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_IDS) $(HAVE_OVERLAYFS) $(HAVE_USERTMPFS) $(HAVE_DBUSPROXY) $(HAVE_FIRETUNNEL) $(HAVE_GLOBALCFG) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_FILE_TRANSFER) $(HAVE_SELINUX) $(HAVE_SUID) $(HAVE_FORCE_NONEWPRIVS) $(HAVE_ONLY_SYSCFG_PROFILES) |
53 | 53 | ||
54 | # User variables - should not be modified in the code (as they are reserved for | ||
55 | # the user building the package); see the following for details: | ||
56 | # https://www.gnu.org/software/automake/manual/1.16.5/html_node/User-Variables.html | ||
54 | CC=@CC@ | 57 | CC=@CC@ |
55 | CFLAGS=@CFLAGS@ | 58 | CFLAGS=@CFLAGS@ |
59 | LDFLAGS=@LDFLAGS@ | ||
60 | |||
61 | # Project variables | ||
62 | LIBS=@LIBS@ | ||
56 | 63 | ||
57 | ifdef NO_EXTRA_CFLAGS | 64 | ifdef NO_EXTRA_CFLAGS |
58 | else | 65 | else |
@@ -3334,7 +3334,7 @@ else | |||
3334 | $as_echo "yes" >&6; } | 3334 | $as_echo "yes" >&6; } |
3335 | 3335 | ||
3336 | EXTRA_CFLAGS="$EXTRA_CFLAGS $AA_CFLAGS" | 3336 | EXTRA_CFLAGS="$EXTRA_CFLAGS $AA_CFLAGS" |
3337 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $AA_LIBS" | 3337 | LIBS="$LIBS $AA_LIBS" |
3338 | 3338 | ||
3339 | fi | 3339 | fi |
3340 | 3340 | ||
@@ -3350,7 +3350,7 @@ fi | |||
3350 | if test "x$enable_selinux" = "xyes"; then : | 3350 | if test "x$enable_selinux" = "xyes"; then : |
3351 | 3351 | ||
3352 | HAVE_SELINUX="-DHAVE_SELINUX" | 3352 | HAVE_SELINUX="-DHAVE_SELINUX" |
3353 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lselinux" | 3353 | LIBS="$LIBS -lselinux" |
3354 | 3354 | ||
3355 | fi | 3355 | fi |
3356 | 3356 | ||
@@ -3612,7 +3612,8 @@ fi | |||
3612 | if test "x$enable_gcov" = "xyes"; then : | 3612 | if test "x$enable_gcov" = "xyes"; then : |
3613 | 3613 | ||
3614 | HAVE_GCOV="--coverage -DHAVE_GCOV" | 3614 | HAVE_GCOV="--coverage -DHAVE_GCOV" |
3615 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgcov --coverage" | 3615 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS --coverage" |
3616 | LIBS="$LIBS -lgcov" | ||
3616 | 3617 | ||
3617 | fi | 3618 | fi |
3618 | 3619 | ||
@@ -5258,8 +5259,12 @@ fi | |||
5258 | cat <<EOF | 5259 | cat <<EOF |
5259 | 5260 | ||
5260 | Compile options: | 5261 | Compile options: |
5262 | CC: $CC | ||
5263 | CFLAGS: $CFLAGS | ||
5264 | LDFLAGS: $LDFLAGS | ||
5261 | EXTRA_CFLAGS: $EXTRA_CFLAGS | 5265 | EXTRA_CFLAGS: $EXTRA_CFLAGS |
5262 | EXTRA_LDFLAGS: $EXTRA_LDFLAGS | 5266 | EXTRA_LDFLAGS: $EXTRA_LDFLAGS |
5267 | LIBS: $LIBS | ||
5263 | fatal warnings: $HAVE_FATAL_WARNINGS | 5268 | fatal warnings: $HAVE_FATAL_WARNINGS |
5264 | gcov instrumentation: $HAVE_GCOV | 5269 | gcov instrumentation: $HAVE_GCOV |
5265 | install as a SUID executable: $HAVE_SUID | 5270 | install as a SUID executable: $HAVE_SUID |
diff --git a/configure.ac b/configure.ac index e418b72bc..556019232 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -72,7 +72,7 @@ AS_IF([test "x$enable_apparmor" = "xyes"], [ | |||
72 | HAVE_APPARMOR="-DHAVE_APPARMOR" | 72 | HAVE_APPARMOR="-DHAVE_APPARMOR" |
73 | PKG_CHECK_MODULES([AA], [libapparmor], [ | 73 | PKG_CHECK_MODULES([AA], [libapparmor], [ |
74 | EXTRA_CFLAGS="$EXTRA_CFLAGS $AA_CFLAGS" | 74 | EXTRA_CFLAGS="$EXTRA_CFLAGS $AA_CFLAGS" |
75 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $AA_LIBS" | 75 | LIBS="$LIBS $AA_LIBS" |
76 | ]) | 76 | ]) |
77 | ]) | 77 | ]) |
78 | 78 | ||
@@ -82,7 +82,7 @@ AC_ARG_ENABLE([selinux], | |||
82 | [AS_HELP_STRING([--enable-selinux], [SELinux labeling support])]) | 82 | [AS_HELP_STRING([--enable-selinux], [SELinux labeling support])]) |
83 | AS_IF([test "x$enable_selinux" = "xyes"], [ | 83 | AS_IF([test "x$enable_selinux" = "xyes"], [ |
84 | HAVE_SELINUX="-DHAVE_SELINUX" | 84 | HAVE_SELINUX="-DHAVE_SELINUX" |
85 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lselinux" | 85 | LIBS="$LIBS -lselinux" |
86 | ]) | 86 | ]) |
87 | 87 | ||
88 | AC_SUBST([EXTRA_CFLAGS]) | 88 | AC_SUBST([EXTRA_CFLAGS]) |
@@ -226,7 +226,8 @@ AC_ARG_ENABLE([gcov], | |||
226 | [AS_HELP_STRING([--enable-gcov], [Gcov instrumentation])]) | 226 | [AS_HELP_STRING([--enable-gcov], [Gcov instrumentation])]) |
227 | AS_IF([test "x$enable_gcov" = "xyes"], [ | 227 | AS_IF([test "x$enable_gcov" = "xyes"], [ |
228 | HAVE_GCOV="--coverage -DHAVE_GCOV" | 228 | HAVE_GCOV="--coverage -DHAVE_GCOV" |
229 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgcov --coverage" | 229 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS --coverage" |
230 | LIBS="$LIBS -lgcov" | ||
230 | ]) | 231 | ]) |
231 | 232 | ||
232 | HAVE_CONTRIB_INSTALL="yes" | 233 | HAVE_CONTRIB_INSTALL="yes" |
@@ -291,8 +292,12 @@ AC_OUTPUT | |||
291 | cat <<EOF | 292 | cat <<EOF |
292 | 293 | ||
293 | Compile options: | 294 | Compile options: |
295 | CC: $CC | ||
296 | CFLAGS: $CFLAGS | ||
297 | LDFLAGS: $LDFLAGS | ||
294 | EXTRA_CFLAGS: $EXTRA_CFLAGS | 298 | EXTRA_CFLAGS: $EXTRA_CFLAGS |
295 | EXTRA_LDFLAGS: $EXTRA_LDFLAGS | 299 | EXTRA_LDFLAGS: $EXTRA_LDFLAGS |
300 | LIBS: $LIBS | ||
296 | fatal warnings: $HAVE_FATAL_WARNINGS | 301 | fatal warnings: $HAVE_FATAL_WARNINGS |
297 | gcov instrumentation: $HAVE_GCOV | 302 | gcov instrumentation: $HAVE_GCOV |
298 | install as a SUID executable: $HAVE_SUID | 303 | install as a SUID executable: $HAVE_SUID |
diff --git a/src/prog.mk b/src/prog.mk index 84f43142d..b2ccf6147 100644 --- a/src/prog.mk +++ b/src/prog.mk | |||
@@ -9,25 +9,26 @@ HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS) | |||
9 | SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) | 9 | SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) |
10 | OBJS := $(SRCS:.c=.o) $(MOD_OBJS) | 10 | OBJS := $(SRCS:.c=.o) $(MOD_OBJS) |
11 | 11 | ||
12 | CFLAGS += \ | 12 | PROG_CFLAGS = \ |
13 | -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' \ | 13 | -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' \ |
14 | -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security \ | 14 | -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security \ |
15 | -fPIE \ | 15 | -fPIE \ |
16 | -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' \ | 16 | -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' \ |
17 | -DLIBDIR='"$(libdir)"' -DBINDIR='"$(bindir)"' \ | 17 | -DLIBDIR='"$(libdir)"' -DBINDIR='"$(bindir)"' \ |
18 | -DVARDIR='"/var/lib/firejail"' \ | 18 | -DVARDIR='"/var/lib/firejail"' \ |
19 | $(HAVE_GCOV) $(MANFLAGS) | 19 | $(HAVE_GCOV) $(MANFLAGS) \ |
20 | $(EXTRA_CFLAGS) | ||
20 | 21 | ||
21 | LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now | 22 | PROG_LDFLAGS = -pie -fPIE -Wl,-z,relro -Wl,-z,now $(EXTRA_LDFLAGS) |
22 | 23 | ||
23 | .PHONY: all | 24 | .PHONY: all |
24 | all: $(TARGET) | 25 | all: $(TARGET) |
25 | 26 | ||
26 | %.o : %.c $(HDRS) $(ROOT)/config.mk | 27 | %.o : %.c $(HDRS) $(ROOT)/config.mk |
27 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ | 28 | $(CC) $(PROG_CFLAGS) $(CFLAGS) $(INCLUDE) -c $< -o $@ |
28 | 29 | ||
29 | $(PROG): $(OBJS) $(ROOT)/config.mk | 30 | $(PROG): $(OBJS) $(ROOT)/config.mk |
30 | $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) | 31 | $(CC) $(PROG_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) |
31 | 32 | ||
32 | .PHONY: clean | 33 | .PHONY: clean |
33 | clean:; rm -fr *.o $(PROG) *.gcov *.gcda *.gcno *.plist $(TOCLEAN) | 34 | clean:; rm -fr *.o $(PROG) *.gcov *.gcda *.gcno *.plist $(TOCLEAN) |
@@ -9,21 +9,21 @@ HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS) | |||
9 | SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) | 9 | SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) |
10 | OBJS := $(SRCS:.c=.o) $(MOD_OBJS) | 10 | OBJS := $(SRCS:.c=.o) $(MOD_OBJS) |
11 | 11 | ||
12 | CFLAGS += \ | 12 | SO_CFLAGS = \ |
13 | -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' \ | 13 | -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' \ |
14 | -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security \ | 14 | -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security \ |
15 | -fPIC | 15 | -fPIC |
16 | 16 | ||
17 | LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now | 17 | SO_LDFLAGS = -pie -fPIE -Wl,-z,relro -Wl,-z,now |
18 | 18 | ||
19 | .PHONY: all | 19 | .PHONY: all |
20 | all: $(TARGET) | 20 | all: $(TARGET) |
21 | 21 | ||
22 | %.o : %.c $(HDRS) $(ROOT)/config.mk | 22 | %.o : %.c $(HDRS) $(ROOT)/config.mk |
23 | $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ | 23 | $(CC) $(SO_CFLAGS) $(CFLAGS) $(INCLUDE) -c $< -o $@ |
24 | 24 | ||
25 | $(SO): $(OBJS) $(ROOT)/config.mk | 25 | $(SO): $(OBJS) $(ROOT)/config.mk |
26 | $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl | 26 | $(CC) $(SO_LDFLAGS) -shared -fPIC -z relro $(LDFLAGS) -o $@ $(OBJS) -ldl |
27 | 27 | ||
28 | .PHONY: clean | 28 | .PHONY: clean |
29 | clean:; rm -fr $(OBJS) $(SO) *.plist $(TOCLEAN) | 29 | clean:; rm -fr $(OBJS) $(SO) *.plist $(TOCLEAN) |