File: Makefile.config

package info (click to toggle)
criu 3.11-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 8,004 kB
  • sloc: ansic: 106,666; python: 5,295; sh: 2,679; makefile: 1,949; asm: 1,108; perl: 103; exp: 45; java: 16
file content (64 lines) | stat: -rw-r--r-- 1,957 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
include $(__nmk_dir)utils.mk
include $(__nmk_dir)msg.mk
include scripts/feature-tests.mak

ifeq ($(call try-cc,$(FEATURE_TEST_LIBBSD_DEV),-lbsd),true)
        LIBS_FEATURES	+= -lbsd
        FEATURE_DEFINES	+= -DCONFIG_HAS_LIBBSD
endif

ifeq ($(call pkg-config-check,libselinux),y)
        LIBS_FEATURES	+= -lselinux
        FEATURE_DEFINES	+= -DCONFIG_HAS_SELINUX
endif

export LIBS += $(LIBS_FEATURES)

CONFIG_FILE = .config

$(CONFIG_FILE):
	touch $(CONFIG_FILE)

ifeq ($(SRCARCH),x86)
# CONFIG_COMPAT is only for x86 now, no need for compile-test other archs
ifeq ($(call try-asm,$(FEATURE_TEST_X86_COMPAT)),true)
        export CONFIG_COMPAT := y
        FEATURE_DEFINES	+= -DCONFIG_COMPAT
else
        $(info Note: Building without ia32 C/R, missed ia32 support in gcc)
        $(info $(info)      That may be related to missing gcc-multilib in your)
        $(info $(info)      distribution or you may have Debian with buggy toolchain)
        $(info $(info)      (issue https://github.com/xemul/criu/issues/315))
endif
endif

export DEFINES += $(FEATURE_DEFINES)
export CFLAGS += $(FEATURE_DEFINES)

FEATURES_LIST	:= TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \
	SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW

# $1 - config name
define gen-feature-test
ifeq ($$(call try-cc,$$(FEATURE_TEST_$(1)),$$(LIBS_FEATURES),$$(DEFINES)),true)
	$(Q) @echo '#define CONFIG_HAS_$(1)' >> $$@
	$(Q) @echo '' >> $$@
endif
endef

define config-header-rule
$(CONFIG_HEADER): scripts/feature-tests.mak $(CONFIG_FILE)
	$$(call msg-gen, $$@)
	$(Q) @echo '#ifndef __CR_CONFIG_H__'				> $$@
	$(Q) @echo '#define __CR_CONFIG_H__'				>> $$@
	$(Q) @echo ''							>> $$@
$(call map,gen-feature-test,$(FEATURES_LIST))
	$(Q) @cat $(CONFIG_FILE) | sed -n -e '/^[^#]/s/^/#define CONFIG_/p' >> $$@
ifeq ($$(VDSO),y)
	$(Q) @echo '#define CONFIG_VDSO'				>> $$@
	$(Q) @echo ''							>> $$@
endif
	$(Q) @echo '#endif /* __CR_CONFIG_H__ */'			>> $$@
endef

$(eval $(config-header-rule))