criu/arch/x86/Makefile
Cyrill Gorcunov ff328579bc make: arch -- Make sure the syscalls headers are generated before deps
In case if here is a fast cpu and make is done in parallel
we may have the following error

| GEN      arch/x86/sys-exec-tbl.c
| GEN      arch/x86/syscalls.S
| CC       arch/x86/crtools.o
| CC       arch/x86/cpu.o
| CC       arch/x86/syscalls.o
| LINK     arch/x86/syscalls.built-in.o
| In file included from include/restorer.h:12:0,
|                 from arch/x86/crtools.c:19:
| include/lock.h: In function ‘futex_set_and_wake’:
| include/lock.h:56:2: error: implicit declaration of function ‘sys_futex’ [-Werror=implicit-function-declaration]
| cc1: all warnings being treated as errors
| make[1]: *** [arch/x86/crtools.o] Error 1
| make: *** [arch/x86] Error 2

This is because crtools.c includes syscall.h but this header
is generated by a special script. So use $(deps-after) feature
provided by our make engine making sure the header is generated
before the deps are started to build.

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Tested-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-19 15:46:24 +04:00

55 lines
1.3 KiB
Makefile

targets += syscalls
targets += crtools
SYS-ASM := syscalls.S
syscalls-asm-y += $(SYS-ASM:.S=).o
crtools-obj-y += crtools.o
crtools-obj-y += cpu.o
SYS-DEF := syscall-x86-64.def
SYS-ASM-COMMON := syscall-common-x86-64.S
SYS-TYPES := include/syscall-types.h
SYS-CODES := include/syscall-codes.h
SYS-PROTO := include/syscall.h
SYS-GEN := syscalls-x86-64.sh
SYS-EXEC-TBL := sys-exec-tbl.c
syscalls-asm-y-asmflags := -fpie -Wstrict-prototypes -Wa,--noexecstack
syscalls-asm-y-asmflags += -nostdlib -fomit-frame-pointer -I$(obj)
ASMFLAGS += -D__ASSEMBLY__
$(obj)/$(SYS-ASM): $(obj)/$(SYS-GEN) $(obj)/$(SYS-DEF) $(obj)/$(SYS-ASM-COMMON) $(SYS-TYPES)
$(E) " GEN " $@
$(Q) $(SH) \
$(obj)/$(SYS-GEN) --asm \
$(obj)/$(SYS-DEF) \
$(SYS-CODES) \
$(SYS-PROTO) \
$(obj)/$(SYS-ASM) \
$(SYS-ASM-COMMON) \
$(SYS-TYPES)
$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
$(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN) $(obj)/$(SYS-DEF)
$(E) " GEN " $@
$(Q) $(SH) \
$(obj)/$(SYS-GEN) --exec \
$(obj)/$(SYS-DEF) \
$(obj)/$(SYS-EXEC-TBL)
_all += $(obj)/$(SYS-EXEC-TBL)
cleanup-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
cleanup-y += $(SYS-CODES)
cleanup-y += $(SYS-PROTO)
ifneq ($(MAKECMDGOALS),clean)
deps-after := $(obj)/$(SYS-ASM)
incdeps := y
endif