Skip to content

Commit adbf4a2

Browse files
committed
Fix build error on redefined _FORTIFY_SOURCE
Leave it for the package builder to define, according to the policy of specific distribution. And also, do not fight with provided environment, try to play along instead - drop "override" and custom variables. This also avoids including $(CFLAGS) twice. This rollback some of the changes in b883dcb "Makefile improvements" QubesOS/qubes-builder-archlinux#73 (comment)
1 parent 89c450b commit adbf4a2

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

agent/Makefile

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ DESTDIR ?= /
55
VCHAN_PKG = $(if $(BACKEND_VMM),vchan-$(BACKEND_VMM),vchan)
66
HAVE_PAM_APPL = $(or $(and $(wildcard /usr/include/security/pam_appl.h),1),)
77
.SUFFIXES:
8-
override os := $(shell lsb_release -is)
9-
override QUBES_CFLAGS := -I. -I../libqrexec -g -O2 -Wall -Wextra -Werror \
10-
$(shell pkg-config --cflags $(VCHAN_PKG)) -fstack-protector \
11-
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIC -std=gnu11 -D_POSIX_C_SOURCE=200809L \
12-
-D_GNU_SOURCE $(CFLAGS) $(if $(HAVE_PAM_APPL),-DHAVE_PAM,-UHAVE_PAM) \
8+
os := $(shell lsb_release -is)
9+
CFLAGS += -I. -I../libqrexec -g -O2 -Wall -Wextra -Werror \
10+
$(shell pkg-config --cflags $(VCHAN_PKG)) -fstack-protector \
11+
-fstack-protector-strong -fPIC -std=gnu11 -D_POSIX_C_SOURCE=200809L \
12+
-D_GNU_SOURCE $(if $(HAVE_PAM_APPL),-DHAVE_PAM,-UHAVE_PAM) \
1313
-Wstrict-prototypes -Wold-style-definition -Wmissing-declarations -Werror=vla
14-
override LDFLAGS += -pie -Wl,-z,relro,-z,now -L../libqrexec
15-
override LDLIBS=-lqrexec-utils $(shell pkg-config --libs $(VCHAN_PKG)) $(if $(HAVE_PAM_APPL),-lpam,)
14+
LDFLAGS += -pie -Wl,-z,relro,-z,now -L../libqrexec
15+
LDLIBS += -lqrexec-utils $(shell pkg-config --libs $(VCHAN_PKG)) $(if $(HAVE_PAM_APPL),-lpam,)
1616

1717
.PHONY: all clean install
1818

19-
override remove_generated := \
19+
remove_generated := \
2020
rm -f -- *.o *~ qrexec-agent qrexec-client-vm *.o.dep *.gcda *.gcno
2121

2222
all: qrexec-agent qrexec-client-vm qrexec-fork-server qrexec-client-vm.1.gz
@@ -64,6 +64,6 @@ endif
6464
$(CC) $(LDFLAGS) -pie -g -o $@ $^ $(LDLIBS)
6565

6666
%.o: %.c
67-
$(CC) $< -c -o $@ $(QUBES_CFLAGS) $(CFLAGS) -MD -MP -MF $@.dep
67+
$(CC) $< -c -o $@ $(CFLAGS) -MD -MP -MF $@.dep
6868

6969
-include *.o.dep

daemon/Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
CC ?=gcc
22
VCHAN_PKG = $(if $(BACKEND_VMM),vchan-$(BACKEND_VMM),vchan)
3-
override QUBES_CFLAGS:=-I../libqrexec -g -O2 -Wall -Wextra -Werror -fPIC \
3+
CFLAGS += -I../libqrexec -g -O2 -Wall -Wextra -Werror -fPIC \
44
$(shell pkg-config --cflags $(VCHAN_PKG)) -fstack-protector \
5-
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -std=gnu11 -D_POSIX_C_SOURCE=200809L \
6-
-D_GNU_SOURCE $(CFLAGS) \
5+
-fstack-protector-strong -std=gnu11 -D_POSIX_C_SOURCE=200809L \
6+
-D_GNU_SOURCE \
77
-Wstrict-prototypes -Wold-style-definition -Wmissing-declarations \
88
-fvisibility=hidden -fno-strict-aliasing -Wvla
9-
override LDFLAGS += -pie -Wl,-z,relro,-z,now -L../libqrexec
10-
override LDLIBS += $(shell pkg-config --libs $(VCHAN_PKG)) -lqrexec-utils
9+
LDFLAGS += -pie -Wl,-z,relro,-z,now -L../libqrexec
10+
LDLIBS += $(shell pkg-config --libs $(VCHAN_PKG)) -lqrexec-utils
1111

1212
MAKEFLAGS := -r
1313
.SUFFIXES:
@@ -27,6 +27,6 @@ qrexec-daemon qrexec-client: %: %.o qrexec-daemon-common.o
2727
$(CC) $(LDFLAGS) -pie -g -o $@ $^ $(LDLIBS)
2828

2929
%.o: %.c
30-
$(CC) $< -c -o $@ $(QUBES_CFLAGS) -MD -MP -MF $@.dep
30+
$(CC) $< -c -o $@ $(CFLAGS) -MD -MP -MF $@.dep
3131

3232
-include *.o.dep

libqrexec/Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
CC ?=gcc
22
VCHAN_PKG = $(if $(BACKEND_VMM),vchan-$(BACKEND_VMM),vchan)
3-
override QUBES_CFLAGS := -I. -I../libqrexec -g -O2 -Wall -Wextra -Werror \
3+
CFLAGS += -I. -I../libqrexec -g -O2 -Wall -Wextra -Werror \
44
$(shell pkg-config --cflags $(VCHAN_PKG)) -fstack-protector \
5-
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIC -std=gnu11 -D_POSIX_C_SOURCE=200809L \
6-
-D_GNU_SOURCE $(CFLAGS) \
5+
-fstack-protector-strong -fPIC -std=gnu11 -D_POSIX_C_SOURCE=200809L \
6+
-D_GNU_SOURCE \
77
-Wstrict-prototypes -Wold-style-definition -Wmissing-declarations \
88
-fno-delete-null-pointer-checks -fvisibility=hidden \
99
-Wvla -Wformat=2
1010

11-
override LDFLAGS += -pie -Wl,-z,relro,-z,now -shared
11+
LDFLAGS += -pie -Wl,-z,relro,-z,now -shared
1212

13-
override SO_VER=3
14-
override VCHANLIBS := $(shell pkg-config --libs vchan)
13+
SO_VER=3
14+
VCHANLIBS := $(shell pkg-config --libs vchan)
1515
LIBDIR ?= /usr/lib
1616
INCLUDEDIR ?= /usr/include
1717

@@ -42,6 +42,6 @@ install:
4242
install -m 0644 qrexec.h $(DESTDIR)$(INCLUDEDIR)
4343

4444
%.o: %.c
45-
$(CC) $< -c -o $@ $(QUBES_CFLAGS) $(CFLAGS) -MD -MP -MF $@.dep
45+
$(CC) $< -c -o $@ $(CFLAGS) -MD -MP -MF $@.dep
4646

4747
-include *.o.dep

0 commit comments

Comments
 (0)