Commit f7066d7d authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

make: Provide mandatory options in cflags-y variable

In case if CFLAGS is overriden from command line we don't
see our headers anymore. So provide mandatory options in
ccflags-y variable to fix that.

https://bugzilla.openvz.org/show_bug.cgi?id=2521Reported-by: 's avatarJan Engelhardt <jengelh@inai.de>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Tested-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent b8ebb4d2
...@@ -76,8 +76,10 @@ ARCH_DIR := arch/$(ARCH) ...@@ -76,8 +76,10 @@ ARCH_DIR := arch/$(ARCH)
$(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported")) $(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported"))
CFLAGS += -iquote include -iquote pie -iquote . -iquote $(ARCH_DIR) cflags-y += -iquote include -iquote pie -iquote .
CFLAGS += -iquote $(ARCH_DIR)/include -fno-strict-aliasing cflags-y += -iquote $(ARCH_DIR) -iquote $(ARCH_DIR)/include
cflags-y += -fno-strict-aliasing
export cflags-y
LIBS := -lrt -lpthread -lprotobuf-c LIBS := -lrt -lpthread -lprotobuf-c
...@@ -103,6 +105,7 @@ ARCH-LIB := arch/$(ARCH)/crtools.built-in.o ...@@ -103,6 +105,7 @@ ARCH-LIB := arch/$(ARCH)/crtools.built-in.o
export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
export cflags-y
include scripts/Makefile.version include scripts/Makefile.version
include scripts/Makefile.rules include scripts/Makefile.rules
......
...@@ -12,7 +12,7 @@ restorer-obj-y += restorer.o ...@@ -12,7 +12,7 @@ restorer-obj-y += restorer.o
restorer-obj-e += $(ARCH_DIR)/restorer.o restorer-obj-e += $(ARCH_DIR)/restorer.o
restorer-libs-e += $(SYSCALL-LIB) restorer-libs-e += $(SYSCALL-LIB)
CFLAGS += -fpie -Wa,--noexecstack -fno-strict-aliasing cflags-y += -fpie -Wa,--noexecstack -fno-strict-aliasing
ASMFLAGS += -D__ASSEMBLY__ ASMFLAGS += -D__ASSEMBLY__
GEN-OFFSETS := gen-offsets.sh GEN-OFFSETS := gen-offsets.sh
......
...@@ -5,43 +5,43 @@ ...@@ -5,43 +5,43 @@
define gen-rule-o-from-c-by-name define gen-rule-o-from-c-by-name
$(1).o: $(1).c $(1).o: $(1).c
$$(E) " CC " $$@ $$(E) " CC " $$@
$$(Q) $$(CC) -c $$(CFLAGS) $(2) $$< -o $$@ $$(Q) $$(CC) -c $$(CFLAGS) $$(cflags-y) $(2) $$< -o $$@
endef endef
define gen-rule-i-from-c-by-name define gen-rule-i-from-c-by-name
$(1).i: $(1).c $(1).i: $(1).c
$$(E) " CC " $$@ $$(E) " CC " $$@
$$(Q) $$(CC) -E $$(CFLAGS) $(2) $$< -o $$@ $$(Q) $$(CC) -E $$(CFLAGS) $$(cflags-y) $(2) $$< -o $$@
endef endef
define gen-rule-s-from-c-by-name define gen-rule-s-from-c-by-name
$(1).s: $(1).c $(1).s: $(1).c
$$(E) " CC " $$@ $$(E) " CC " $$@
$$(Q) $$(CC) -S $$(CFLAGS) $(2) -fverbose-asm $$< -o $$@ $$(Q) $$(CC) -S $$(CFLAGS) $$(cflags-y) $(2) -fverbose-asm $$< -o $$@
endef endef
define gen-rule-o-from-S-by-name define gen-rule-o-from-S-by-name
$(1).o: $(1).S $(1).o: $(1).S
$$(E) " CC " $$@ $$(E) " CC " $$@
$$(Q) $$(CC) -c $$(CFLAGS) $(2) $$(ASMFLAGS) $(3) $$< -o $$@ $$(Q) $$(CC) -c $$(CFLAGS) $$(cflags-y) $(2) $$(ASMFLAGS) $(3) $$< -o $$@
endef endef
define gen-rule-d-from-c-by-name define gen-rule-d-from-c-by-name
$(1).d: $(1).c $(1).d: $(1).c
$$(E) " DEP " $$@ $$(E) " DEP " $$@
$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(CFLAGS) $(2) $$< -o $$@ $$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(CFLAGS) $$(cflags-y) $(2) $$< -o $$@
endef endef
define gen-rule-d-from-S-by-name define gen-rule-d-from-S-by-name
$(1).d: $(1).S $(1).d: $(1).S
$$(E) " DEP " $$@ $$(E) " DEP " $$@
$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(CFLAGS) $(2) $$< -o $$@ $$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(CFLAGS) $$(cflags-y) $(2) $$< -o $$@
endef endef
define gen-rule-i-from-S-by-name define gen-rule-i-from-S-by-name
$(1).i: $(1).S $(1).i: $(1).S
$$(E) " CC " $$@ $$(E) " CC " $$@
$$(Q) $$(CC) -E $$(CFLAGS) $(2) $$< -o $$@ $$(Q) $$(CC) -E $$(CFLAGS) $$(cflags-y) $(2) $$< -o $$@
endef endef
## ##
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment