[CRIU] [PATCH 8/8] build: Move everything criu related into crtools directory
Cyrill Gorcunov
gorcunov at openvz.org
Fri Feb 5 01:01:20 PST 2016
Here we move criu building into crtools directory and built criu there.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
.gitignore | 29 +-
.travis.yml | 2 +-
Documentation/Makefile | 18 +-
Makefile | 402 ++++++---------------
Makefile.crtools | 94 -----
Makefile.inc | 18 -
Makefile.install | 31 ++
crtools | 1 -
crtools/Makefile | 164 +++++++++
Makefile.config => crtools/Makefile.config | 41 ++-
crtools/Makefile.crtools | 95 +++++
{scripts => crtools}/Makefile.version | 23 +-
action-scripts.c => crtools/action-scripts.c | 0
aio.c => crtools/aio.c | 0
{arch => crtools/arch}/aarch64/Makefile | 0
{arch/arm => crtools/arch/aarch64}/cpu.c | 0
{arch => crtools/arch}/aarch64/crtools.c | 0
.../arch}/aarch64/include/asm/atomic.h | 0
.../arch/aarch64}/include/asm/bitops.h | 0
.../arch/aarch64}/include/asm/bitsperlong.h | 0
.../arch/aarch64}/include/asm/cpu.h | 0
{arch => crtools/arch}/aarch64/include/asm/dump.h | 0
.../arch/aarch64}/include/asm/fpu.h | 0
.../x86 => crtools/arch/aarch64}/include/asm/int.h | 0
.../arch/aarch64}/include/asm/linkage.h | 0
{arch => crtools/arch}/aarch64/include/asm/page.h | 0
.../arch}/aarch64/include/asm/parasite-syscall.h | 0
.../arch}/aarch64/include/asm/parasite.h | 0
.../arch/aarch64}/include/asm/processor-flags.h | 0
.../arch}/aarch64/include/asm/restore.h | 0
.../arch}/aarch64/include/asm/restorer.h | 0
.../arch/aarch64}/include/asm/string.h | 0
.../arch}/aarch64/include/asm/syscall-aux.S | 0
.../arch}/aarch64/include/asm/syscall-aux.h | 0
{arch => crtools/arch}/aarch64/include/asm/types.h | 0
{arch => crtools/arch}/aarch64/include/asm/vdso.h | 0
{arch => crtools/arch}/aarch64/intraprocedure.S | 0
{arch => crtools/arch}/aarch64/parasite-head.S | 0
{arch => crtools/arch}/aarch64/restorer.c | 0
{arch => crtools/arch}/aarch64/syscall-common.S | 0
{arch => crtools/arch}/aarch64/vdso-pie.c | 0
{arch => crtools/arch}/arm/Makefile | 0
{arch/aarch64 => crtools/arch/arm}/cpu.c | 0
{arch => crtools/arch}/arm/crtools.c | 0
{arch => crtools/arch}/arm/include/asm/atomic.h | 0
.../arch/arm}/include/asm/bitops.h | 0
.../arch}/arm/include/asm/bitsperlong.h | 0
{arch => crtools/arch}/arm/include/asm/cpu.h | 0
{arch => crtools/arch}/arm/include/asm/dump.h | 0
{arch => crtools/arch}/arm/include/asm/fpu.h | 0
{arch/ppc64 => crtools/arch/arm}/include/asm/int.h | 0
.../arch/arm}/include/asm/linkage.h | 0
{arch/x86 => crtools/arch/arm}/include/asm/page.h | 0
.../arch}/arm/include/asm/parasite-syscall.h | 0
{arch => crtools/arch}/arm/include/asm/parasite.h | 0
.../arch}/arm/include/asm/processor-flags.h | 0
{arch => crtools/arch}/arm/include/asm/processor.h | 0
{arch => crtools/arch}/arm/include/asm/restore.h | 0
{arch => crtools/arch}/arm/include/asm/restorer.h | 0
.../arch/arm}/include/asm/string.h | 0
.../arch}/arm/include/asm/syscall-aux.S | 0
.../arch}/arm/include/asm/syscall-aux.h | 0
{arch => crtools/arch}/arm/include/asm/types.h | 0
{arch => crtools/arch}/arm/parasite-head.S | 0
{arch => crtools/arch}/arm/restorer.c | 0
{arch => crtools/arch}/arm/syscall-common.S | 0
{arch => crtools/arch}/arm/syscall.def | 0
{arch => crtools/arch}/arm/uidiv.S | 0
{arch => crtools/arch}/ppc64/Makefile | 0
{arch => crtools/arch}/ppc64/cpu.c | 0
{arch => crtools/arch}/ppc64/crtools.c | 0
{arch => crtools/arch}/ppc64/include/asm/atomic.h | 0
{arch => crtools/arch}/ppc64/include/asm/bitops.h | 0
.../arch/ppc64}/include/asm/bitsperlong.h | 0
{arch => crtools/arch}/ppc64/include/asm/cmpxchg.h | 0
.../arch/ppc64}/include/asm/cpu.h | 0
.../x86 => crtools/arch/ppc64}/include/asm/dump.h | 0
.../arch/ppc64}/include/asm/fpu.h | 0
{arch/arm => crtools/arch/ppc64}/include/asm/int.h | 0
{arch => crtools/arch}/ppc64/include/asm/linkage.h | 0
{arch => crtools/arch}/ppc64/include/asm/page.h | 0
.../arch}/ppc64/include/asm/parasite-syscall.h | 0
.../arch}/ppc64/include/asm/parasite.h | 0
.../arch/ppc64}/include/asm/prlimit.h | 0
.../arch/ppc64}/include/asm/processor-flags.h | 0
{arch => crtools/arch}/ppc64/include/asm/restore.h | 0
.../arch}/ppc64/include/asm/restorer.h | 0
{arch => crtools/arch}/ppc64/include/asm/string.h | 0
{arch => crtools/arch}/ppc64/include/asm/types.h | 0
{arch => crtools/arch}/ppc64/include/asm/vdso.h | 0
{arch => crtools/arch}/ppc64/memcmp_64.S | 0
{arch => crtools/arch}/ppc64/memcpy_power7.S | 0
{arch => crtools/arch}/ppc64/misc.S | 0
{arch => crtools/arch}/ppc64/parasite-head.S | 0
{arch => crtools/arch}/ppc64/restorer.c | 0
.../arch}/ppc64/syscall-common-ppc64.S | 0
{arch => crtools/arch}/ppc64/syscall-ppc64.def | 0
{arch => crtools/arch}/ppc64/syscalls-ppc64.sh | 0
{arch => crtools/arch}/ppc64/vdso-pie.c | 0
{arch => crtools/arch}/ppc64/vdso-trampoline.S | 0
.../arch}/scripts/arm/gen-sys-exec-tbl.pl | 0
{arch => crtools/arch}/scripts/arm/gen-syscalls.pl | 0
crtools/arch/x86/Makefile | 7 +
.../Makefile => crtools/arch/x86/Makefile.syscalls | 69 ++--
{arch => crtools/arch}/x86/cpu.c | 0
{arch => crtools/arch}/x86/crtools.c | 0
{arch => crtools/arch}/x86/include/asm/atomic.h | 0
{arch => crtools/arch}/x86/include/asm/bitops.h | 0
.../arch}/x86/include/asm/bitsperlong.h | 0
{arch => crtools/arch}/x86/include/asm/cmpxchg.h | 0
{arch => crtools/arch}/x86/include/asm/cpu.h | 0
.../ppc64 => crtools/arch/x86}/include/asm/dump.h | 0
{arch => crtools/arch}/x86/include/asm/fpu.h | 0
.../aarch64 => crtools/arch/x86}/include/asm/int.h | 0
{arch => crtools/arch}/x86/include/asm/linkage.h | 0
{arch/arm => crtools/arch/x86}/include/asm/page.h | 0
.../arch}/x86/include/asm/parasite-syscall.h | 0
{arch => crtools/arch}/x86/include/asm/parasite.h | 0
.../arch/x86}/include/asm/prlimit.h | 0
.../arch}/x86/include/asm/processor-flags.h | 0
{arch => crtools/arch}/x86/include/asm/restore.h | 0
{arch => crtools/arch}/x86/include/asm/restorer.h | 0
{arch => crtools/arch}/x86/include/asm/string.h | 0
{arch => crtools/arch}/x86/include/asm/syscall32.h | 0
{arch => crtools/arch}/x86/include/asm/types.h | 0
{arch => crtools/arch}/x86/include/asm/vdso.h | 0
{arch => crtools/arch}/x86/parasite-head.S | 0
{arch => crtools/arch}/x86/prlimit.c | 0
{arch => crtools/arch}/x86/restorer.c | 0
.../arch}/x86/syscalls/syscall-common-x86-32.S | 0
.../arch}/x86/syscalls/syscall-common-x86-64.S | 0
{arch => crtools/arch}/x86/syscalls/syscall32.c | 0
{arch => crtools/arch}/x86/syscalls/syscall_32.tbl | 0
{arch => crtools/arch}/x86/syscalls/syscall_64.tbl | 0
{arch => crtools/arch}/x86/vdso-pie.c | 0
bfd.c => crtools/bfd.c | 0
bitmap.c => crtools/bitmap.c | 0
cgroup.c => crtools/cgroup.c | 0
cr-check.c => crtools/cr-check.c | 0
cr-dedup.c => crtools/cr-dedup.c | 0
cr-dump.c => crtools/cr-dump.c | 0
cr-errno.c => crtools/cr-errno.c | 0
cr-exec.c => crtools/cr-exec.c | 0
cr-restore.c => crtools/cr-restore.c | 0
cr-service.c => crtools/cr-service.c | 0
cr-show.c => crtools/cr-show.c | 0
crtools.c => crtools/crtools.c | 0
eventfd.c => crtools/eventfd.c | 0
eventpoll.c => crtools/eventpoll.c | 0
fault-injection.c => crtools/fault-injection.c | 0
fifo.c => crtools/fifo.c | 0
file-ids.c => crtools/file-ids.c | 0
file-lock.c => crtools/file-lock.c | 0
files-ext.c => crtools/files-ext.c | 0
files-reg.c => crtools/files-reg.c | 0
files.c => crtools/files.c | 0
fsnotify.c => crtools/fsnotify.c | 0
image-desc.c => crtools/image-desc.c | 0
image.c => crtools/image.c | 0
{include => crtools/include}/action-scripts.h | 0
{include => crtools/include}/aio.h | 0
{include => crtools/include}/asm-generic/bitops.h | 0
{include => crtools/include}/asm-generic/int.h | 0
{include => crtools/include}/asm-generic/string.h | 0
{include => crtools/include}/asm-generic/vdso.h | 0
{include => crtools/include}/bfd.h | 0
{include => crtools/include}/bitmap.h | 0
{include => crtools/include}/bug.h | 0
{include => crtools/include}/cgroup.h | 0
{include => crtools/include}/compiler.h | 0
{include => crtools/include}/config-base.h | 0
{include => crtools/include}/cpu.h | 0
{include => crtools/include}/cr-errno.h | 0
{include => crtools/include}/cr-service-const.h | 0
{include => crtools/include}/cr-service.h | 0
{include => crtools/include}/cr-show.h | 0
{include => crtools/include}/cr_options.h | 0
{include => crtools/include}/criu-log.h | 0
{include => crtools/include}/criu-plugin.h | 0
{include => crtools/include}/crtools.h | 0
{include => crtools/include}/err.h | 0
{include => crtools/include}/errno.h | 0
{include => crtools/include}/eventfd.h | 0
{include => crtools/include}/eventpoll.h | 0
{include => crtools/include}/fault-injection.h | 0
{include => crtools/include}/fcntl.h | 0
{include => crtools/include}/fifo.h | 0
{include => crtools/include}/file-ids.h | 0
{include => crtools/include}/file-lock.h | 0
{include => crtools/include}/files-reg.h | 0
{include => crtools/include}/files.h | 0
{include => crtools/include}/fs-magic.h | 0
{include => crtools/include}/fsnotify.h | 0
{include => crtools/include}/image-desc.h | 0
{include => crtools/include}/image.h | 0
{include => crtools/include}/imgset.h | 0
{include => crtools/include}/inet_diag.h | 0
{include => crtools/include}/ipc_ns.h | 0
{include => crtools/include}/irmap.h | 0
{include => crtools/include}/kcmp-ids.h | 0
{include => crtools/include}/kcmp.h | 0
{include => crtools/include}/kerndat.h | 0
{include => crtools/include}/libnetlink.h | 0
{include => crtools/include}/list.h | 0
{include => crtools/include}/lock.h | 0
{include => crtools/include}/log.h | 0
{include => crtools/include}/lsm.h | 0
{include => crtools/include}/magic.h | 0
{include => crtools/include}/mem.h | 0
{include => crtools/include}/mman.h | 0
{include => crtools/include}/mount.h | 0
{include => crtools/include}/namespaces.h | 0
{include => crtools/include}/net.h | 0
{include => crtools/include}/netfilter.h | 0
{include => crtools/include}/netlink_diag.h | 0
{include => crtools/include}/packet_diag.h | 0
{include => crtools/include}/page-pipe.h | 0
{include => crtools/include}/page-read.h | 0
{include => crtools/include}/page-xfer.h | 0
{include => crtools/include}/pagemap-cache.h | 0
{include => crtools/include}/parasite-syscall.h | 0
{include => crtools/include}/parasite-vdso.h | 0
{include => crtools/include}/parasite.h | 0
{include => crtools/include}/pid.h | 0
{include => crtools/include}/pipes.h | 0
{include => crtools/include}/plugin.h | 0
{include => crtools/include}/posix-timer.h | 0
{include => crtools/include}/prctl.h | 0
{include => crtools/include}/proc_parse.h | 0
{include => crtools/include}/protobuf-desc.h | 0
{include => crtools/include}/protobuf.h | 0
{include => crtools/include}/pstree.h | 0
{include => crtools/include}/ptrace.h | 0
{include => crtools/include}/rbtree.h | 0
{include => crtools/include}/restorer.h | 0
{include => crtools/include}/rst-malloc.h | 0
{include => crtools/include}/rst_info.h | 0
{include => crtools/include}/seccomp.h | 0
{include => crtools/include}/seize.h | 0
{include => crtools/include}/servicefd.h | 0
{include => crtools/include}/setproctitle.h | 0
{include => crtools/include}/shmem.h | 0
{include => crtools/include}/sigframe.h | 0
{include => crtools/include}/signalfd.h | 0
{include => crtools/include}/sk-inet.h | 0
{include => crtools/include}/sk-packet.h | 0
{include => crtools/include}/sk-queue.h | 0
{include => crtools/include}/sockets.h | 0
{include => crtools/include}/stats.h | 0
{include => crtools/include}/string.h | 0
{include => crtools/include}/syscall-types.h | 0
{include => crtools/include}/sysctl.h | 0
{include => crtools/include}/sysfs_parse.h | 0
{include => crtools/include}/timerfd.h | 0
{include => crtools/include}/tty.h | 0
{include => crtools/include}/tun.h | 0
{include => crtools/include}/unix_diag.h | 0
{include => crtools/include}/util-pie.h | 0
{include => crtools/include}/util-vdso.h | 0
{include => crtools/include}/util.h | 0
{include => crtools/include}/uts_ns.h | 0
{include => crtools/include}/vdso.h | 0
{include => crtools/include}/vma.h | 0
{include => crtools/include}/xmalloc.h | 0
ipc_ns.c => crtools/ipc_ns.c | 0
irmap.c => crtools/irmap.c | 0
kcmp-ids.c => crtools/kcmp-ids.c | 0
kerndat.c => crtools/kerndat.c | 0
libnetlink.c => crtools/libnetlink.c | 0
log.c => crtools/log.c | 0
lsm.c => crtools/lsm.c | 0
mem.c => crtools/mem.c | 0
mount.c => crtools/mount.c | 0
namespaces.c => crtools/namespaces.c | 0
net.c => crtools/net.c | 0
netfilter.c => crtools/netfilter.c | 0
page-pipe.c => crtools/page-pipe.c | 0
page-read.c => crtools/page-read.c | 0
page-xfer.c => crtools/page-xfer.c | 0
pagemap-cache.c => crtools/pagemap-cache.c | 0
parasite-syscall.c => crtools/parasite-syscall.c | 0
crtools/pie-util-fd.c | 1 +
crtools/pie-util-vdso.c | 1 +
crtools/pie-util.c | 1 +
{pie => crtools/pie}/Makefile | 85 ++---
crtools/pie/Makefile.library | 41 +++
{pie => crtools/pie}/log-simple.c | 0
{pie => crtools/pie}/parasite-vdso.c | 0
{pie => crtools/pie}/parasite.c | 0
{pie => crtools/pie}/pie-reloc.lds.S.in | 0
{pie => crtools/pie}/pie-relocs.c | 0
{pie => crtools/pie}/pie-relocs.h | 0
{pie => crtools/pie}/pie.lds.S.in | 0
{pie => crtools/pie}/piegen/Makefile | 0
{pie => crtools/pie}/piegen/elf-ppc64.c | 0
{pie => crtools/pie}/piegen/elf-x86-32.c | 0
{pie => crtools/pie}/piegen/elf-x86-64.c | 0
{pie => crtools/pie}/piegen/elf.c | 0
{pie => crtools/pie}/piegen/main.c | 0
{pie => crtools/pie}/piegen/piegen.h | 0
{pie => crtools/pie}/piegen/uapi/types.h | 0
{pie => crtools/pie}/restorer.c | 0
{pie => crtools/pie}/util-fd.c | 0
{pie => crtools/pie}/util-vdso.c | 0
{pie => crtools/pie}/util.c | 0
pipes.c => crtools/pipes.c | 0
plugin.c => crtools/plugin.c | 0
proc_parse.c => crtools/proc_parse.c | 0
protobuf-desc.c => crtools/protobuf-desc.c | 0
protobuf.c => crtools/protobuf.c | 0
pstree.c => crtools/pstree.c | 0
ptrace.c => crtools/ptrace.c | 0
rbtree.c => crtools/rbtree.c | 0
rst-malloc.c => crtools/rst-malloc.c | 0
seccomp.c => crtools/seccomp.c | 0
seize.c => crtools/seize.c | 0
shmem.c => crtools/shmem.c | 0
sigframe.c => crtools/sigframe.c | 0
signalfd.c => crtools/signalfd.c | 0
sk-inet.c => crtools/sk-inet.c | 0
sk-netlink.c => crtools/sk-netlink.c | 0
sk-packet.c => crtools/sk-packet.c | 0
sk-queue.c => crtools/sk-queue.c | 0
sk-tcp.c => crtools/sk-tcp.c | 0
sk-unix.c => crtools/sk-unix.c | 0
sockets.c => crtools/sockets.c | 0
stats.c => crtools/stats.c | 0
string.c => crtools/string.c | 0
sysctl.c => crtools/sysctl.c | 0
sysfs_parse.c => crtools/sysfs_parse.c | 0
timerfd.c => crtools/timerfd.c | 0
tty.c => crtools/tty.c | 0
tun.c => crtools/tun.c | 0
util.c => crtools/util.c | 0
uts_ns.c => crtools/uts_ns.c | 0
vdso.c => crtools/vdso.c | 0
images/Makefile | 5 +-
lib/Makefile | 6 +-
lib/c/Makefile | 6 -
lib/py/Makefile | 2 +-
lib/py/images/Makefile | 19 +-
scripts/Makefile.build | 251 -------------
scripts/Makefile.rules | 52 ---
343 files changed, 579 insertions(+), 885 deletions(-)
delete mode 100644 Makefile.crtools
delete mode 100644 Makefile.inc
create mode 100644 Makefile.install
delete mode 120000 crtools
create mode 100644 crtools/Makefile
rename Makefile.config => crtools/Makefile.config (50%)
create mode 100644 crtools/Makefile.crtools
rename {scripts => crtools}/Makefile.version (63%)
rename action-scripts.c => crtools/action-scripts.c (100%)
rename aio.c => crtools/aio.c (100%)
rename {arch => crtools/arch}/aarch64/Makefile (100%)
rename {arch/arm => crtools/arch/aarch64}/cpu.c (100%)
rename {arch => crtools/arch}/aarch64/crtools.c (100%)
rename {arch => crtools/arch}/aarch64/include/asm/atomic.h (100%)
rename {arch/arm => crtools/arch/aarch64}/include/asm/bitops.h (100%)
rename {arch/ppc64 => crtools/arch/aarch64}/include/asm/bitsperlong.h (100%)
rename {arch/ppc64 => crtools/arch/aarch64}/include/asm/cpu.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/dump.h (100%)
rename {arch/ppc64 => crtools/arch/aarch64}/include/asm/fpu.h (100%)
rename {arch/x86 => crtools/arch/aarch64}/include/asm/int.h (100%)
rename {arch/arm => crtools/arch/aarch64}/include/asm/linkage.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/page.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/parasite-syscall.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/parasite.h (100%)
rename {arch/ppc64 => crtools/arch/aarch64}/include/asm/processor-flags.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/restore.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/restorer.h (100%)
rename {arch/arm => crtools/arch/aarch64}/include/asm/string.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/syscall-aux.S (100%)
rename {arch => crtools/arch}/aarch64/include/asm/syscall-aux.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/types.h (100%)
rename {arch => crtools/arch}/aarch64/include/asm/vdso.h (100%)
rename {arch => crtools/arch}/aarch64/intraprocedure.S (100%)
rename {arch => crtools/arch}/aarch64/parasite-head.S (100%)
rename {arch => crtools/arch}/aarch64/restorer.c (100%)
rename {arch => crtools/arch}/aarch64/syscall-common.S (100%)
rename {arch => crtools/arch}/aarch64/vdso-pie.c (100%)
rename {arch => crtools/arch}/arm/Makefile (100%)
rename {arch/aarch64 => crtools/arch/arm}/cpu.c (100%)
rename {arch => crtools/arch}/arm/crtools.c (100%)
rename {arch => crtools/arch}/arm/include/asm/atomic.h (100%)
rename {arch/aarch64 => crtools/arch/arm}/include/asm/bitops.h (100%)
rename {arch => crtools/arch}/arm/include/asm/bitsperlong.h (100%)
rename {arch => crtools/arch}/arm/include/asm/cpu.h (100%)
rename {arch => crtools/arch}/arm/include/asm/dump.h (100%)
rename {arch => crtools/arch}/arm/include/asm/fpu.h (100%)
rename {arch/ppc64 => crtools/arch/arm}/include/asm/int.h (100%)
rename {arch/aarch64 => crtools/arch/arm}/include/asm/linkage.h (100%)
rename {arch/x86 => crtools/arch/arm}/include/asm/page.h (100%)
rename {arch => crtools/arch}/arm/include/asm/parasite-syscall.h (100%)
rename {arch => crtools/arch}/arm/include/asm/parasite.h (100%)
rename {arch => crtools/arch}/arm/include/asm/processor-flags.h (100%)
rename {arch => crtools/arch}/arm/include/asm/processor.h (100%)
rename {arch => crtools/arch}/arm/include/asm/restore.h (100%)
rename {arch => crtools/arch}/arm/include/asm/restorer.h (100%)
rename {arch/aarch64 => crtools/arch/arm}/include/asm/string.h (100%)
rename {arch => crtools/arch}/arm/include/asm/syscall-aux.S (100%)
rename {arch => crtools/arch}/arm/include/asm/syscall-aux.h (100%)
rename {arch => crtools/arch}/arm/include/asm/types.h (100%)
rename {arch => crtools/arch}/arm/parasite-head.S (100%)
rename {arch => crtools/arch}/arm/restorer.c (100%)
rename {arch => crtools/arch}/arm/syscall-common.S (100%)
rename {arch => crtools/arch}/arm/syscall.def (100%)
rename {arch => crtools/arch}/arm/uidiv.S (100%)
rename {arch => crtools/arch}/ppc64/Makefile (100%)
rename {arch => crtools/arch}/ppc64/cpu.c (100%)
rename {arch => crtools/arch}/ppc64/crtools.c (100%)
rename {arch => crtools/arch}/ppc64/include/asm/atomic.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/bitops.h (100%)
rename {arch/aarch64 => crtools/arch/ppc64}/include/asm/bitsperlong.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/cmpxchg.h (100%)
rename {arch/aarch64 => crtools/arch/ppc64}/include/asm/cpu.h (100%)
rename {arch/x86 => crtools/arch/ppc64}/include/asm/dump.h (100%)
rename {arch/aarch64 => crtools/arch/ppc64}/include/asm/fpu.h (100%)
rename {arch/arm => crtools/arch/ppc64}/include/asm/int.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/linkage.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/page.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/parasite-syscall.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/parasite.h (100%)
rename {arch/x86 => crtools/arch/ppc64}/include/asm/prlimit.h (100%)
rename {arch/aarch64 => crtools/arch/ppc64}/include/asm/processor-flags.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/restore.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/restorer.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/string.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/types.h (100%)
rename {arch => crtools/arch}/ppc64/include/asm/vdso.h (100%)
rename {arch => crtools/arch}/ppc64/memcmp_64.S (100%)
rename {arch => crtools/arch}/ppc64/memcpy_power7.S (100%)
rename {arch => crtools/arch}/ppc64/misc.S (100%)
rename {arch => crtools/arch}/ppc64/parasite-head.S (100%)
rename {arch => crtools/arch}/ppc64/restorer.c (100%)
rename {arch => crtools/arch}/ppc64/syscall-common-ppc64.S (100%)
rename {arch => crtools/arch}/ppc64/syscall-ppc64.def (100%)
rename {arch => crtools/arch}/ppc64/syscalls-ppc64.sh (100%)
rename {arch => crtools/arch}/ppc64/vdso-pie.c (100%)
rename {arch => crtools/arch}/ppc64/vdso-trampoline.S (100%)
rename {arch => crtools/arch}/scripts/arm/gen-sys-exec-tbl.pl (100%)
rename {arch => crtools/arch}/scripts/arm/gen-syscalls.pl (100%)
create mode 100644 crtools/arch/x86/Makefile
rename arch/x86/Makefile => crtools/arch/x86/Makefile.syscalls (57%)
rename {arch => crtools/arch}/x86/cpu.c (100%)
rename {arch => crtools/arch}/x86/crtools.c (100%)
rename {arch => crtools/arch}/x86/include/asm/atomic.h (100%)
rename {arch => crtools/arch}/x86/include/asm/bitops.h (100%)
rename {arch => crtools/arch}/x86/include/asm/bitsperlong.h (100%)
rename {arch => crtools/arch}/x86/include/asm/cmpxchg.h (100%)
rename {arch => crtools/arch}/x86/include/asm/cpu.h (100%)
rename {arch/ppc64 => crtools/arch/x86}/include/asm/dump.h (100%)
rename {arch => crtools/arch}/x86/include/asm/fpu.h (100%)
rename {arch/aarch64 => crtools/arch/x86}/include/asm/int.h (100%)
rename {arch => crtools/arch}/x86/include/asm/linkage.h (100%)
rename {arch/arm => crtools/arch/x86}/include/asm/page.h (100%)
rename {arch => crtools/arch}/x86/include/asm/parasite-syscall.h (100%)
rename {arch => crtools/arch}/x86/include/asm/parasite.h (100%)
rename {arch/ppc64 => crtools/arch/x86}/include/asm/prlimit.h (100%)
rename {arch => crtools/arch}/x86/include/asm/processor-flags.h (100%)
rename {arch => crtools/arch}/x86/include/asm/restore.h (100%)
rename {arch => crtools/arch}/x86/include/asm/restorer.h (100%)
rename {arch => crtools/arch}/x86/include/asm/string.h (100%)
rename {arch => crtools/arch}/x86/include/asm/syscall32.h (100%)
rename {arch => crtools/arch}/x86/include/asm/types.h (100%)
rename {arch => crtools/arch}/x86/include/asm/vdso.h (100%)
rename {arch => crtools/arch}/x86/parasite-head.S (100%)
rename {arch => crtools/arch}/x86/prlimit.c (100%)
rename {arch => crtools/arch}/x86/restorer.c (100%)
rename {arch => crtools/arch}/x86/syscalls/syscall-common-x86-32.S (100%)
rename {arch => crtools/arch}/x86/syscalls/syscall-common-x86-64.S (100%)
rename {arch => crtools/arch}/x86/syscalls/syscall32.c (100%)
rename {arch => crtools/arch}/x86/syscalls/syscall_32.tbl (100%)
rename {arch => crtools/arch}/x86/syscalls/syscall_64.tbl (100%)
rename {arch => crtools/arch}/x86/vdso-pie.c (100%)
rename bfd.c => crtools/bfd.c (100%)
rename bitmap.c => crtools/bitmap.c (100%)
rename cgroup.c => crtools/cgroup.c (100%)
rename cr-check.c => crtools/cr-check.c (100%)
rename cr-dedup.c => crtools/cr-dedup.c (100%)
rename cr-dump.c => crtools/cr-dump.c (100%)
rename cr-errno.c => crtools/cr-errno.c (100%)
rename cr-exec.c => crtools/cr-exec.c (100%)
rename cr-restore.c => crtools/cr-restore.c (100%)
rename cr-service.c => crtools/cr-service.c (100%)
rename cr-show.c => crtools/cr-show.c (100%)
rename crtools.c => crtools/crtools.c (100%)
rename eventfd.c => crtools/eventfd.c (100%)
rename eventpoll.c => crtools/eventpoll.c (100%)
rename fault-injection.c => crtools/fault-injection.c (100%)
rename fifo.c => crtools/fifo.c (100%)
rename file-ids.c => crtools/file-ids.c (100%)
rename file-lock.c => crtools/file-lock.c (100%)
rename files-ext.c => crtools/files-ext.c (100%)
rename files-reg.c => crtools/files-reg.c (100%)
rename files.c => crtools/files.c (100%)
rename fsnotify.c => crtools/fsnotify.c (100%)
rename image-desc.c => crtools/image-desc.c (100%)
rename image.c => crtools/image.c (100%)
rename {include => crtools/include}/action-scripts.h (100%)
rename {include => crtools/include}/aio.h (100%)
rename {include => crtools/include}/asm-generic/bitops.h (100%)
rename {include => crtools/include}/asm-generic/int.h (100%)
rename {include => crtools/include}/asm-generic/string.h (100%)
rename {include => crtools/include}/asm-generic/vdso.h (100%)
rename {include => crtools/include}/bfd.h (100%)
rename {include => crtools/include}/bitmap.h (100%)
rename {include => crtools/include}/bug.h (100%)
rename {include => crtools/include}/cgroup.h (100%)
rename {include => crtools/include}/compiler.h (100%)
rename {include => crtools/include}/config-base.h (100%)
rename {include => crtools/include}/cpu.h (100%)
rename {include => crtools/include}/cr-errno.h (100%)
rename {include => crtools/include}/cr-service-const.h (100%)
rename {include => crtools/include}/cr-service.h (100%)
rename {include => crtools/include}/cr-show.h (100%)
rename {include => crtools/include}/cr_options.h (100%)
rename {include => crtools/include}/criu-log.h (100%)
rename {include => crtools/include}/criu-plugin.h (100%)
rename {include => crtools/include}/crtools.h (100%)
rename {include => crtools/include}/err.h (100%)
rename {include => crtools/include}/errno.h (100%)
rename {include => crtools/include}/eventfd.h (100%)
rename {include => crtools/include}/eventpoll.h (100%)
rename {include => crtools/include}/fault-injection.h (100%)
rename {include => crtools/include}/fcntl.h (100%)
rename {include => crtools/include}/fifo.h (100%)
rename {include => crtools/include}/file-ids.h (100%)
rename {include => crtools/include}/file-lock.h (100%)
rename {include => crtools/include}/files-reg.h (100%)
rename {include => crtools/include}/files.h (100%)
rename {include => crtools/include}/fs-magic.h (100%)
rename {include => crtools/include}/fsnotify.h (100%)
rename {include => crtools/include}/image-desc.h (100%)
rename {include => crtools/include}/image.h (100%)
rename {include => crtools/include}/imgset.h (100%)
rename {include => crtools/include}/inet_diag.h (100%)
rename {include => crtools/include}/ipc_ns.h (100%)
rename {include => crtools/include}/irmap.h (100%)
rename {include => crtools/include}/kcmp-ids.h (100%)
rename {include => crtools/include}/kcmp.h (100%)
rename {include => crtools/include}/kerndat.h (100%)
rename {include => crtools/include}/libnetlink.h (100%)
rename {include => crtools/include}/list.h (100%)
rename {include => crtools/include}/lock.h (100%)
rename {include => crtools/include}/log.h (100%)
rename {include => crtools/include}/lsm.h (100%)
rename {include => crtools/include}/magic.h (100%)
rename {include => crtools/include}/mem.h (100%)
rename {include => crtools/include}/mman.h (100%)
rename {include => crtools/include}/mount.h (100%)
rename {include => crtools/include}/namespaces.h (100%)
rename {include => crtools/include}/net.h (100%)
rename {include => crtools/include}/netfilter.h (100%)
rename {include => crtools/include}/netlink_diag.h (100%)
rename {include => crtools/include}/packet_diag.h (100%)
rename {include => crtools/include}/page-pipe.h (100%)
rename {include => crtools/include}/page-read.h (100%)
rename {include => crtools/include}/page-xfer.h (100%)
rename {include => crtools/include}/pagemap-cache.h (100%)
rename {include => crtools/include}/parasite-syscall.h (100%)
rename {include => crtools/include}/parasite-vdso.h (100%)
rename {include => crtools/include}/parasite.h (100%)
rename {include => crtools/include}/pid.h (100%)
rename {include => crtools/include}/pipes.h (100%)
rename {include => crtools/include}/plugin.h (100%)
rename {include => crtools/include}/posix-timer.h (100%)
rename {include => crtools/include}/prctl.h (100%)
rename {include => crtools/include}/proc_parse.h (100%)
rename {include => crtools/include}/protobuf-desc.h (100%)
rename {include => crtools/include}/protobuf.h (100%)
rename {include => crtools/include}/pstree.h (100%)
rename {include => crtools/include}/ptrace.h (100%)
rename {include => crtools/include}/rbtree.h (100%)
rename {include => crtools/include}/restorer.h (100%)
rename {include => crtools/include}/rst-malloc.h (100%)
rename {include => crtools/include}/rst_info.h (100%)
rename {include => crtools/include}/seccomp.h (100%)
rename {include => crtools/include}/seize.h (100%)
rename {include => crtools/include}/servicefd.h (100%)
rename {include => crtools/include}/setproctitle.h (100%)
rename {include => crtools/include}/shmem.h (100%)
rename {include => crtools/include}/sigframe.h (100%)
rename {include => crtools/include}/signalfd.h (100%)
rename {include => crtools/include}/sk-inet.h (100%)
rename {include => crtools/include}/sk-packet.h (100%)
rename {include => crtools/include}/sk-queue.h (100%)
rename {include => crtools/include}/sockets.h (100%)
rename {include => crtools/include}/stats.h (100%)
rename {include => crtools/include}/string.h (100%)
rename {include => crtools/include}/syscall-types.h (100%)
rename {include => crtools/include}/sysctl.h (100%)
rename {include => crtools/include}/sysfs_parse.h (100%)
rename {include => crtools/include}/timerfd.h (100%)
rename {include => crtools/include}/tty.h (100%)
rename {include => crtools/include}/tun.h (100%)
rename {include => crtools/include}/unix_diag.h (100%)
rename {include => crtools/include}/util-pie.h (100%)
rename {include => crtools/include}/util-vdso.h (100%)
rename {include => crtools/include}/util.h (100%)
rename {include => crtools/include}/uts_ns.h (100%)
rename {include => crtools/include}/vdso.h (100%)
rename {include => crtools/include}/vma.h (100%)
rename {include => crtools/include}/xmalloc.h (100%)
rename ipc_ns.c => crtools/ipc_ns.c (100%)
rename irmap.c => crtools/irmap.c (100%)
rename kcmp-ids.c => crtools/kcmp-ids.c (100%)
rename kerndat.c => crtools/kerndat.c (100%)
rename libnetlink.c => crtools/libnetlink.c (100%)
rename log.c => crtools/log.c (100%)
rename lsm.c => crtools/lsm.c (100%)
rename mem.c => crtools/mem.c (100%)
rename mount.c => crtools/mount.c (100%)
rename namespaces.c => crtools/namespaces.c (100%)
rename net.c => crtools/net.c (100%)
rename netfilter.c => crtools/netfilter.c (100%)
rename page-pipe.c => crtools/page-pipe.c (100%)
rename page-read.c => crtools/page-read.c (100%)
rename page-xfer.c => crtools/page-xfer.c (100%)
rename pagemap-cache.c => crtools/pagemap-cache.c (100%)
rename parasite-syscall.c => crtools/parasite-syscall.c (100%)
create mode 120000 crtools/pie-util-fd.c
create mode 120000 crtools/pie-util-vdso.c
create mode 120000 crtools/pie-util.c
rename {pie => crtools/pie}/Makefile (56%)
create mode 100644 crtools/pie/Makefile.library
rename {pie => crtools/pie}/log-simple.c (100%)
rename {pie => crtools/pie}/parasite-vdso.c (100%)
rename {pie => crtools/pie}/parasite.c (100%)
rename {pie => crtools/pie}/pie-reloc.lds.S.in (100%)
rename {pie => crtools/pie}/pie-relocs.c (100%)
rename {pie => crtools/pie}/pie-relocs.h (100%)
rename {pie => crtools/pie}/pie.lds.S.in (100%)
rename {pie => crtools/pie}/piegen/Makefile (100%)
rename {pie => crtools/pie}/piegen/elf-ppc64.c (100%)
rename {pie => crtools/pie}/piegen/elf-x86-32.c (100%)
rename {pie => crtools/pie}/piegen/elf-x86-64.c (100%)
rename {pie => crtools/pie}/piegen/elf.c (100%)
rename {pie => crtools/pie}/piegen/main.c (100%)
rename {pie => crtools/pie}/piegen/piegen.h (100%)
rename {pie => crtools/pie}/piegen/uapi/types.h (100%)
rename {pie => crtools/pie}/restorer.c (100%)
rename {pie => crtools/pie}/util-fd.c (100%)
rename {pie => crtools/pie}/util-vdso.c (100%)
rename {pie => crtools/pie}/util.c (100%)
rename pipes.c => crtools/pipes.c (100%)
rename plugin.c => crtools/plugin.c (100%)
rename proc_parse.c => crtools/proc_parse.c (100%)
rename protobuf-desc.c => crtools/protobuf-desc.c (100%)
rename protobuf.c => crtools/protobuf.c (100%)
rename pstree.c => crtools/pstree.c (100%)
rename ptrace.c => crtools/ptrace.c (100%)
rename rbtree.c => crtools/rbtree.c (100%)
rename rst-malloc.c => crtools/rst-malloc.c (100%)
rename seccomp.c => crtools/seccomp.c (100%)
rename seize.c => crtools/seize.c (100%)
rename shmem.c => crtools/shmem.c (100%)
rename sigframe.c => crtools/sigframe.c (100%)
rename signalfd.c => crtools/signalfd.c (100%)
rename sk-inet.c => crtools/sk-inet.c (100%)
rename sk-netlink.c => crtools/sk-netlink.c (100%)
rename sk-packet.c => crtools/sk-packet.c (100%)
rename sk-queue.c => crtools/sk-queue.c (100%)
rename sk-tcp.c => crtools/sk-tcp.c (100%)
rename sk-unix.c => crtools/sk-unix.c (100%)
rename sockets.c => crtools/sockets.c (100%)
rename stats.c => crtools/stats.c (100%)
rename string.c => crtools/string.c (100%)
rename sysctl.c => crtools/sysctl.c (100%)
rename sysfs_parse.c => crtools/sysfs_parse.c (100%)
rename timerfd.c => crtools/timerfd.c (100%)
rename tty.c => crtools/tty.c (100%)
rename tun.c => crtools/tun.c (100%)
rename util.c => crtools/util.c (100%)
rename uts_ns.c => crtools/uts_ns.c (100%)
rename vdso.c => crtools/vdso.c (100%)
delete mode 100644 scripts/Makefile.build
delete mode 100644 scripts/Makefile.rules
diff --git a/.gitignore b/.gitignore
index d1ee8415e8d4..781de3474df0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,20 +17,21 @@ tags
TAGS
Makefile.local
syscall-x86-64.S
-include/syscall.h
-include/syscall-codes.h
-protobuf/*.c
-protobuf/*.h
-protobuf/google/protobuf/*.c
-protobuf/google/protobuf/*.h
-include/version.h
-arch/x86/sys-exec-tbl.c
-arch/x86/syscalls.S
-pie/pie.lds.S
-pie/piegen/piegen
-include/config.h
-protobuf-desc-gen.h
-criu.pc
+crtools/include/syscall.h
+crtools/include/syscall-codes.h
+images/*.c
+images/*.h
+images/google/protobuf/*.c
+images/google/protobuf/*.h
+crtools/include/version.h
+crtools/arch/x86/sys-exec-tbl.c
+crtools/arch/x86/syscalls.S
+crtools/pie/pie.lds.S
+crtools/pie/lib.a
+crtools/pie/piegen/piegen
+crtools/include/config.h
+crtools/protobuf-desc-gen.h
+lib/c/criu.pc
build
.gitid
usr/
diff --git a/.travis.yml b/.travis.yml
index 11835e7ec795..ee1a568f6d13 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: c
env:
- ARCH=arm
- - ARCH=x86_64
+ - ARCH=x86
compiler:
- gcc
before_install:
diff --git a/Documentation/Makefile b/Documentation/Makefile
index e236635e5b20..77e3a26bb3ad 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,4 +1,5 @@
--include ../Makefile.inc
+include $(__nmk_dir)/include.mk
+include $(__nmk_dir)/macro.mk
ASCIIDOC := asciidoc
A2X := a2x
@@ -9,10 +10,9 @@ XMLS := $(patsubst %.txt,%.xml,$(SRC))
MANS := $(patsubst %.txt,%.8,$(SRC))
MAN8DIR := $(MANDIR)/man8
-GROFF=groff
-PAPER=$(shell paperconf 2>/dev/null || echo letter)
-GROFF_OPTS := -Tps -t -dpaper=$(PAPER) -P-p$(PAPER) \
- -man -msafer -rC1 -rD1 -rS11
+GROFF :=groff
+PAPER :=$(shell paperconf 2>/dev/null || echo letter)
+GROFF_OPTS := -Tps -t -dpaper=$(PAPER) -P-p$(PAPER) -man -msafer -rC1 -rD1 -rS11
PSS := $(MANS:%.8=%.ps)
PDFS := $(MANS:%.8=%.pdf)
@@ -27,20 +27,20 @@ check:
done
%.8: %.txt
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) $(ASCIIDOC) -b docbook -d manpage -o $(patsubst %.8,%.xml,$@) $<
$(Q) $(XMLTO) man --skip-validation $(patsubst %.8,%.xml,$@) 2>/dev/null
%.ps: %.8
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) $(GROFF) $(GROFF_OPTS) $^ > $@
%.pdf: %.ps
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) ps2pdf $< $@
clean:
- $(E) " CLEAN "
+ $(call msg-clean, "Documentation")
$(Q) rm -f $(XMLS) $(MANS) $(PSS) $(PDFS)
install: $(MANS)
diff --git a/Makefile b/Makefile
index d55c4bd47905..17231eaae21e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,103 +1,67 @@
+#
# Import the build engine first
__nmk_dir=$(CURDIR)/scripts/nmk/scripts/
export __nmk_dir
include $(__nmk_dir)/include.mk
+include $(__nmk_dir)/macro.mk
-VERSION_MAJOR := 1
-VERSION_MINOR := 8
-VERSION_SUBLEVEL :=
-VERSION_EXTRA :=
-VERSION_NAME :=
-VERSION_SO_MAJOR := 1
-VERSION_SO_MINOR := 0
-
-export VERSION_MAJOR VERSION_MINOR VERSION_SUBLEVEL VERSION_EXTRA VERSION_NAME
-export VERSION_SO_MAJOR VERSION_SO_MINOR
-
-#
-# FIXME zdtm building procedure requires implicit rules
-# so I can't use strict make file mode and drop completely
-# all of implicit rules, so I tuned only .SUFFIXES:
-#
-# In future zdtm makefiles need to be fixed and the line below
-# may be uncommented.
-#
-#MAKEFLAGS := -r -R
-
-#
-# Common definitions
#
-
-FIND := find
-CSCOPE := cscope
-RM := rm -f
-LD := $(CROSS_COMPILE)ld
-CC := $(CROSS_COMPILE)gcc
-NM := $(CROSS_COMPILE)nm
-SH := bash
-MAKE := make
-OBJCOPY := $(CROSS_COMPILE)objcopy
+# To build host helpers.
HOSTCC ?= gcc
HOSTLD ?= ld
+export HOSTCC HOSTLD
CFLAGS += $(USERCFLAGS)
-HOSTCFLAGS ?= $(CFLAGS)
+export CFLAGS
-export HOSTCC
-export HOSTLD
+HOSTCFLAGS ?= $(CFLAGS)
export HOSTCFLAGS
+#
+# Where we live.
+SRC_DIR := $(CURDIR)
+export SRC_DIR
-ifeq ($(ARCH),x86_64)
- ARCH := x86
-endif
-
+#
+# Architecture specific options.
ifeq ($(ARCH),x86)
- SRCARCH := x86
- DEFINES := -DCONFIG_X86_64
- LDARCH := i386:x86-64
- VDSO := y
-endif
-ifeq ($(ARCH),ia32)
- SRCARCH := x86
- DEFINES := -DCONFIG_X86_32
- LDARCH := i386
- ldflags-y += -m elf_i386
- VDSO := y
- USERCFLAGS += -m32
- PROTOUFIX := y
- export PROTOUFIX ldflags-y
+ DEFINES := -DCONFIG_X86_64
+ LDARCH := i386:x86-64
+ VDSO := y
endif
-ifeq ($(GCOV),1)
- LDFLAGS += -lgcov
- DEBUG = 1 # disable optimization if we want to measure code coverage
-%.o $(PROGRAM): override CFLAGS += --coverage -fno-exceptions -fno-inline
+ifeq ($(ARCH),ia32)
+ DEFINES := -DCONFIG_X86_32
+ LDARCH := i386
+ ldflags-y += -m elf_i386
+ VDSO := y
+ USERCFLAGS += -m32
+ PROTOUFIX := y
endif
ifeq ($(shell echo $(ARCH) | sed -e 's/arm.*/arm/'),arm)
- ARMV := $(shell echo $(ARCH) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
- SRCARCH := arm
- DEFINES := -DCONFIG_ARMV$(ARMV)
+ ARMV := $(shell echo $(ARCH) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
+ SRCARCH := arm
+ DEFINES := -DCONFIG_ARMV$(ARMV)
- USERCFLAGS += -Wa,-mimplicit-it=always
+ USERCFLAGS += -Wa,-mimplicit-it=always
- ifeq ($(ARMV),6)
- USERCFLAGS += -march=armv6
- endif
+ ifeq ($(ARMV),6)
+ USERCFLAGS += -march=armv6
+ endif
- ifeq ($(ARMV),7)
- USERCFLAGS += -march=armv7-a
- endif
+ ifeq ($(ARMV),7)
+ USERCFLAGS += -march=armv7-a
+ endif
endif
+
ifeq ($(ARCH),aarch64)
- VDSO := y
+ VDSO := y
endif
ifeq ($(SRCARCH),arm)
- PROTOUFIX := y
- export PROTOUFIX
+ PROTOUFIX := y
endif
#
@@ -105,237 +69,114 @@ endif
# They are handled in the same way.
#
ifeq ($(shell echo $(ARCH) | sed -e 's/ppc64.*/ppc64/'),ppc64)
- ifeq ($(ARCH),ppc64)
- error := $(error ppc64 big endian not yet supported)
- endif
- SRCARCH := ppc64
- DEFINES := -DCONFIG_PPC64
- LDARCH := powerpc:common64
- VDSO := y
+ ifeq ($(ARCH),ppc64)
+ error := $(error ppc64 big endian not yet supported)
+ endif
+
+ SRCARCH := ppc64
+ DEFINES := -DCONFIG_PPC64
+ LDARCH := powerpc:common64
+ VDSO := y
endif
-LDARCH ?= $(SRCARCH)
-
-SRC_DIR ?= $(CURDIR)
-ARCH_DIR := arch/$(SRCARCH)
+LDARCH ?= $(SRCARCH)
-$(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported"))
+export PROTOUFIX VDSO DEFINES LDARCH ldflags-y
#
-# piegen might be disabled by hands. Don't use it until
-# you know what you're doing.
-ifneq ($(filter ia32 x86 ppc64le, $(ARCH)),)
-ifneq ($(PIEGEN),no)
- piegen-y := y
- export piegen-y
-endif
-endif
-
-cflags-y += -iquote include -iquote pie -iquote .
-cflags-y += -iquote $(ARCH_DIR) -iquote $(ARCH_DIR)/include
-cflags-y += -fno-strict-aliasing
-export cflags-y
-
-LIBS := -lrt -lpthread -lprotobuf-c -ldl
-
-DEFINES += -D_FILE_OFFSET_BITS=64
-DEFINES += -D_GNU_SOURCE
-
-WARNINGS := -Wall
-
-ifneq ($(WERROR),0)
- WARNINGS += -Werror
-endif
-
-ifeq ($(DEBUG),1)
- DEFINES += -DCR_DEBUG
- CFLAGS += -O0 -ggdb3
-else
- CFLAGS += -O2
-endif
-
-ifeq ($(GMON),1)
- CFLAGS += -pg
- GMONLDOPT = -pg
-endif
-
-CFLAGS += $(WARNINGS) $(DEFINES)
-SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o
-ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o
-CRIU-SO := libcriu
-CRIU-LIB := lib/c/$(CRIU-SO).so
-CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
-ifeq ($(piegen-y),y)
-piegen := pie/piegen/piegen
-endif
-
-export CC MAKE CFLAGS LIBS SRCARCH DEFINES MAKEFLAGS CRIU-SO
-export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
-export USERCFLAGS
-export cflags-y
-export VDSO
-
-include Makefile.inc
-include Makefile.config
-include scripts/Makefile.version
-include scripts/Makefile.rules
-
-.SUFFIXES:
+# Protobuf images first, they are not depending
+# on anything else.
+$(eval $(call gen-built-in,images))
+PHONY += images
#
-# shorthand
-build-old := -r -R -f scripts/Makefile.build makefile=Makefile obj
-build-old-crtools := -r -R -f scripts/Makefile.build makefile=Makefile.crtools obj
-
-PROGRAM := criu
-
-.PHONY: all zdtm test rebuild clean distclean tags cscope \
- docs help pie protobuf $(ARCH_DIR) clean-built lib crit
-
-all: config pie $(VERSION_HEADER) $(CRIU-LIB)
- $(Q) $(MAKE) $(PROGRAM)
- $(Q) $(MAKE) crit
-
-protobuf/%::
- $(Q) $(MAKE) $(build-old)=protobuf $@
-protobuf:
- $(Q) $(MAKE) $(build-old)=protobuf all
-
-$(ARCH_DIR)/%:: protobuf config
- $(Q) $(MAKE) $(build-old)=$(ARCH_DIR) $@
-$(ARCH_DIR): protobuf config
- $(Q) $(MAKE) $(build-old)=$(ARCH_DIR) all
-
-ifeq ($(piegen-y),y)
-pie/piegen/%: config
- $(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build-old)=pie/piegen $@
-pie/piegen: config
- $(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build-old)=pie/piegen all
-$(piegen): pie/piegen/built-in.o
- $(E) " LINK " $@
- $(Q) $(HOSTCC) $(HOSTCFLAGS) $^ $(LDFLAGS) -o $@
-.PHONY: pie/piegen
-endif
-
-pie: $(ARCH_DIR) $(piegen)
- $(Q) $(MAKE) $(build-old)=pie all
-
-%.o %.i %.s %.d: $(VERSION_HEADER) pie
- $(Q) $(MAKE) $(build-old-crtools)=. $@
-built-in.o: $(VERSION_HEADER) pie
- $(Q) $(MAKE) $(build-old-crtools)=. $@
+# CRIU building done in own directory
+# with slightly different rules so we
+# can't use nmk engine directly (we
+# build syscalls library and such).
+#
+# But note that we're already included
+# the nmk so we can reuse it there.
+crtools/%: images/built-in.o
+ $(Q) $(MAKE) -C crtools $@
+crtools: images/built-in.o
+ $(Q) $(MAKE) -C crtools all
+crtools/criu: crtools
+PHONY += crtools
-lib/%:: $(VERSION_HEADER) config built-in.o
+#
+# Libraries.
+lib/%: crtools
$(Q) $(MAKE) -C lib $@
-lib: $(VERSION_HEADER) config built-in.o
+lib: crtools
$(Q) $(MAKE) -C lib all
+PHONY += lib
-$(CRIU-LIB): lib
- @true
-crit: lib
- @true
-
-
-PROGRAM-BUILTINS += protobuf/built-in.o
-PROGRAM-BUILTINS += built-in.o
-
-$(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS): config
-
-$(PROGRAM): $(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS)
- $(E) " LINK " $@
- $(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@
+all: crtools lib
+PHONY += all
zdtm: all
$(Q) $(MAKE) -C test/zdtm all
+PHONY += zdtm
test: zdtm
$(Q) $(MAKE) -C test
+PHONY += test
clean-built:
- $(Q) $(RM) $(VERSION_HEADER)
- $(Q) $(MAKE) $(build-old)=$(ARCH_DIR) clean
- $(Q) $(MAKE) $(build-old)=protobuf clean
- $(Q) $(MAKE) $(build-old)=pie/piegen clean
- $(Q) $(MAKE) $(build-old)=pie clean
+ $(Q) $(MAKE) $(build)=images clean
+ $(Q) $(MAKE) -C crtools clean
$(Q) $(MAKE) -C lib clean
- $(Q) $(MAKE) $(build-old-crtools)=. clean
- $(Q) $(MAKE) -C Documentation clean
- $(Q) $(RM) ./include/config.h
- $(Q) $(RM) ./$(PROGRAM)
-
-rebuild: clean-built
- $(E) " FORCE-REBUILD"
- $(Q) $(MAKE)
+PHONY += clean-built
clean: clean-built
- $(E) " CLEAN"
- $(Q) $(RM) ./*.img
- $(Q) $(RM) ./*.out
- $(Q) $(RM) ./*.bin
- $(Q) $(RM) ./*.{gcda,gcno,gcov} ./test/`pwd`/*.{gcda,gcno,gcov} ./pie/*.{gcda,gcno,gcov}
- $(Q) $(RM) -r ./gcov
- $(Q) $(RM) protobuf-desc-gen.h
- $(Q) $(MAKE) -C test $@
- $(Q) $(RM) ./*.pyc
- $(Q) $(RM) -r build
- $(Q) $(RM) -r usr
-
-distclean: clean
- $(E) " DISTCLEAN"
- $(Q) $(RM) ./tags
- $(Q) $(RM) ./cscope*
+ $(call msg-clean, criu)
+PHONY += clean
+
+dist: tar
+tar: criu-$(CRTOOLSVERSION).tar.bz2
+criu-$(CRTOOLSVERSION).tar.bz2:
+ git archive --format tar --prefix 'criu-$(CRTOOLSVERSION)/' \
+ v$(CRTOOLSVERSION) | bzip2 > $@
+.PHONY: dist tar
tags:
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) $(RM) tags
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' -print | xargs ctags -a
+PHONY += tags
cscope:
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' ! -type l -print > cscope.files
$(Q) $(CSCOPE) -bkqu
+PHONY += cscope
docs:
$(Q) $(MAKE) -s -C Documentation all
+PHONY += docs
-dist: tar
-tar: criu-$(CRTOOLSVERSION).tar.bz2
-criu-$(CRTOOLSVERSION).tar.bz2:
- git archive --format tar --prefix 'criu-$(CRTOOLSVERSION)/' \
- v$(CRTOOLSVERSION) | bzip2 > $@
-.PHONY: dist tar
+gcov:
+ $(E) " GCOV"
+ $(Q) test -d gcov || mkdir gcov && \
+ cp *.{gcno,c} test/`pwd`/ && \
+ geninfo --output-filename gcov/crtools.h.info --no-recursion . && \
+ geninfo --output-filename gcov/crtools.ns.info --no-recursion test/`pwd`/ && \
+ sed -i 's#/test/`pwd`##' gcov/crtools.ns.info && \
+ cd gcov && \
+ lcov --rc lcov_branch_coverage=1 --add-tracefile crtools.h.info \
+ --add-tracefile crtools.ns.info --output-file criu.info && \
+ genhtml --rc lcov_branch_coverage=1 --output-directory html criu.info
+ @echo "Code coverage report is in `pwd`/gcov/html/ directory."
+PHONY += gcov
+
+docker-build:
+ docker build -t criu .
+PHONY += docker-build
-install: install-criu install-man
-
-install-criu: all $(CRIU-LIB) install-crit
- $(E) " INSTALL " $(PROGRAM)
- $(Q) mkdir -p $(DESTDIR)$(SBINDIR)
- $(Q) install -m 755 $(PROGRAM) $(DESTDIR)$(SBINDIR)
- $(Q) mkdir -p $(DESTDIR)$(LIBDIR)
- $(Q) install -m 755 $(CRIU-LIB) \
- $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR)
- $(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
- $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR)
- $(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
- $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so
- $(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
- $(Q) install -m 644 $(CRIU-INC) $(DESTDIR)$(INCLUDEDIR)
- $(Q) mkdir -p $(DESTDIR)$(SYSTEMDUNITDIR)
- $(Q) sed -e 's, at version@,$(CRTOOLSVERSION),' \
- -e 's, at libdir@,$(LIBDIR),' \
- -e 's, at includedir@,$(dir $(INCLUDEDIR)),' \
- lib/criu.pc.in > criu.pc
- $(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
- $(Q) install -m 644 criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
-
-install-man:
- $(Q) $(MAKE) -C Documentation install
-
-install-crit: crit
- $(E) " INSTALL crit"
- $(Q) python scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
-
-.PHONY: install install-man install-crit install-criu
+docker-test:
+ docker run --rm -it --privileged criu ./test/zdtm.sh -C -x tcp6 -x tcpbuf6 -x static/rtc -x cgroup -x mountpoint
+PHONY += docker-test
help:
@echo ' Targets:'
@@ -350,28 +191,15 @@ help:
@echo ' cscope - Generate cscope database'
@echo ' rebuild - Force-rebuild of [*] targets'
@echo ' test - Run zdtm test-suite'
- @echo ' gcov - Make code coverage report'
-
-gcov:
- $(E) " GCOV"
- $(Q) test -d gcov || mkdir gcov && \
- cp *.{gcno,c} test/`pwd`/ && \
- geninfo --output-filename gcov/crtools.h.info --no-recursion . && \
- geninfo --output-filename gcov/crtools.ns.info --no-recursion test/`pwd`/ && \
- sed -i 's#/test/`pwd`##' gcov/crtools.ns.info && \
- cd gcov && \
- lcov --rc lcov_branch_coverage=1 --add-tracefile crtools.h.info --add-tracefile crtools.ns.info --output-file criu.info && \
- genhtml --rc lcov_branch_coverage=1 --output-directory html criu.info
- @echo "Code coverage report is in `pwd`/gcov/html/ directory."
-.PHONY: gcov
+ @echo ' gcov - Make code coverage report'
+PHONY += help
-docker-build:
- docker build -t criu .
+include Makefile.install
-docker-test:
- docker run --rm -it --privileged criu ./test/zdtm.sh -C -x tcp6 -x tcpbuf6 -x static/rtc -x cgroup -x mountpoint
+.PHONY: $(PHONY)
-.DEFAULT_GOAL := all
+.DEFAULT_GOAL := all
-# include optional local rules
+#
+# Optional local include.
-include Makefile.local
diff --git a/Makefile.crtools b/Makefile.crtools
deleted file mode 100644
index 5788ef0304a4..000000000000
--- a/Makefile.crtools
+++ /dev/null
@@ -1,94 +0,0 @@
-obj-y += parasite-syscall.o
-obj-y += mem.o
-obj-y += rst-malloc.o
-obj-y += cr-restore.o
-obj-y += crtools.o
-obj-y += image.o
-obj-y += image-desc.o
-obj-y += net.o
-obj-y += tun.o
-obj-y += proc_parse.o
-obj-y += sysfs_parse.o
-obj-y += cr-dump.o
-obj-y += cr-show.o
-obj-y += cr-check.o
-obj-y += cr-dedup.o
-obj-y += util.o
-obj-y += bfd.o
-obj-y += action-scripts.o
-obj-y += sysctl.o
-obj-y += ptrace.o
-obj-y += kcmp-ids.o
-obj-y += rbtree.o
-obj-y += log.o
-obj-y += libnetlink.o
-obj-y += sockets.o
-obj-y += sk-inet.o
-obj-y += sk-tcp.o
-obj-y += sk-unix.o
-obj-y += sk-packet.o
-obj-y += sk-netlink.o
-obj-y += sk-queue.o
-obj-y += files.o
-obj-y += files-reg.o
-obj-y += files-ext.o
-obj-y += pipes.o
-obj-y += fifo.o
-obj-y += file-ids.o
-obj-y += namespaces.o
-obj-y += uts_ns.o
-obj-y += ipc_ns.o
-obj-y += netfilter.o
-obj-y += shmem.o
-obj-y += eventfd.o
-obj-y += eventpoll.o
-obj-y += mount.o
-obj-y += fsnotify.o
-obj-y += irmap.o
-obj-y += signalfd.o
-obj-y += pstree.o
-obj-y += bitmap.o
-obj-y += protobuf.o
-obj-y += protobuf-desc.o
-obj-y += tty.o
-obj-y += cr-exec.o
-obj-y += file-lock.o
-obj-y += page-pipe.o
-obj-y += page-xfer.o
-obj-y += page-read.o
-obj-y += pagemap-cache.o
-obj-y += kerndat.o
-obj-y += stats.o
-obj-y += cgroup.o
-obj-y += timerfd.o
-obj-y += aio.o
-obj-y += string.o
-obj-y += sigframe.o
-obj-y += lsm.o
-ifeq ($(VDSO),y)
-obj-y += vdso.o
-obj-y += pie/util-vdso.o
-endif
-obj-y += cr-service.o
-obj-y += plugin.o
-obj-y += cr-errno.o
-obj-y += pie/pie-relocs.o
-obj-y += seize.o
-obj-y += fault-injection.o
-obj-y += pie/util-fd.o
-obj-y += pie/util.o
-obj-y += seccomp.o
-
-ifneq ($(MAKECMDGOALS),clean)
-incdeps := y
-endif
-
-PROTOBUF_GEN := scripts/protobuf-gen.sh
-
-protobuf-desc.c: protobuf-desc-gen.h
-
-protobuf-desc-gen.h: $(PROTOBUF_GEN) include/protobuf-desc.h
- $(E) " GEN " $@
- $(Q) $(SH) $(obj)/$(PROTOBUF_GEN) > $@
-
-cleanup-y += protobuf-desc-gen.h
diff --git a/Makefile.inc b/Makefile.inc
deleted file mode 100644
index 4782ea23939d..000000000000
--- a/Makefile.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-# Installation paths
-PREFIX ?= /usr/local
-SBINDIR ?= $(PREFIX)/sbin
-MANDIR ?= $(PREFIX)/share/man
-SYSTEMDUNITDIR ?= $(PREFIX)/lib/systemd/system/
-LOGROTATEDIR ?= $(PREFIX)/etc/logrotate.d/
-LIBDIR ?= $(PREFIX)/lib
-# For recent Debian/Ubuntu with multiarch support
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture \
- -qDEB_HOST_MULTIARCH 2>/dev/null)
-ifneq "$(DEB_HOST_MULTIARCH)" ""
-LIBDIR ?= $(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
-# For most other systems
-else ifeq "$(shell uname -m)" "x86_64"
-LIBDIR ?= $(PREFIX)/lib64
-endif
-
-INCLUDEDIR ?= $(PREFIX)/include/criu
diff --git a/Makefile.install b/Makefile.install
new file mode 100644
index 000000000000..4f3b57fb07d8
--- /dev/null
+++ b/Makefile.install
@@ -0,0 +1,31 @@
+install: install-criu install-man
+
+install-criu: all $(CRIU-LIB) install-crit
+ $(E) " INSTALL " $(PROGRAM)
+ $(Q) mkdir -p $(DESTDIR)$(SBINDIR)
+ $(Q) install -m 755 $(PROGRAM) $(DESTDIR)$(SBINDIR)
+ $(Q) mkdir -p $(DESTDIR)$(LIBDIR)
+ $(Q) install -m 755 $(CRIU-LIB) \
+ $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR)
+ $(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
+ $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR)
+ $(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
+ $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so
+ $(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
+ $(Q) install -m 644 $(CRIU-INC) $(DESTDIR)$(INCLUDEDIR)
+ $(Q) mkdir -p $(DESTDIR)$(SYSTEMDUNITDIR)
+ $(Q) sed -e 's, at version@,$(CRTOOLSVERSION),' \
+ -e 's, at libdir@,$(LIBDIR),' \
+ -e 's, at includedir@,$(dir $(INCLUDEDIR)),' \
+ lib/criu.pc.in > criu.pc
+ $(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+ $(Q) install -m 644 criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
+
+install-man:
+ $(Q) $(MAKE) -C Documentation install
+
+install-crit: crit
+ $(E) " INSTALL crit"
+ $(Q) python scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
+
+.PHONY: install install-man install-crit install-criu
diff --git a/crtools b/crtools
deleted file mode 120000
index 33c504fed369..000000000000
--- a/crtools
+++ /dev/null
@@ -1 +0,0 @@
-criu
\ No newline at end of file
diff --git a/crtools/Makefile b/crtools/Makefile
new file mode 100644
index 000000000000..14aca46ca175
--- /dev/null
+++ b/crtools/Makefile
@@ -0,0 +1,164 @@
+#
+# CRIU version.
+VERSION_MAJOR := 2
+VERSION_MINOR := 0
+VERSION_SUBLEVEL :=
+VERSION_EXTRA :=
+VERSION_NAME :=
+
+export VERSION_MAJOR VERSION_MINOR
+export VERSION_SUBLEVEL VERSION_EXTRA VERSION_NAME
+
+#
+# HOST part is needed to build helper
+# tools such as piegen.
+HOSTCC ?= gcc
+HOSTLD ?= ld
+HOSTCFLAGS ?= $(CFLAGS)
+CFLAGS += $(USERCFLAGS)
+
+export HOSTCC HOSTLD HOSTCFLAGS USERCFLAGS
+
+ifeq ($(ARCH),x86)
+ SRCARCH := x86
+ DEFINES := -DCONFIG_X86_64
+ LDARCH := i386:x86-64
+ VDSO := y
+endif
+
+SRCARCH ?= $(ARCH)
+LDARCH ?= $(SRCARCH)
+ARCH_DIR := arch/$(SRCARCH)
+
+export SRCARCH LDARCH ARCH_DIR VDSO
+
+$(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported"))
+
+#
+# General flags.
+ccflags-y += -iquote include -iquote $(SRC_DIR)/images -iquote pie
+ccflags-y += -iquote $(ARCH_DIR) -iquote $(ARCH_DIR)/include
+ccflags-y += -fno-strict-aliasing
+
+export ccflags-y
+
+LIBS := -lrt -lpthread -lprotobuf-c -ldl
+
+DEFINES += -D_FILE_OFFSET_BITS=64
+DEFINES += -D_GNU_SOURCE
+
+WARNINGS := -Wall
+
+ifneq ($(WERROR),0)
+ WARNINGS += -Werror
+endif
+
+ifeq ($(DEBUG),1)
+ DEFINES += -DCR_DEBUG
+ CFLAGS += -O0 -ggdb3
+else
+ CFLAGS += -O2
+endif
+
+ifeq ($(GMON),1)
+ CFLAGS += -pg
+ GMONLDOPT = -pg
+endif
+
+CFLAGS += $(WARNINGS) $(DEFINES)
+
+export CFLAGS
+
+#
+# piegen tool might be disabled by hands. Don't use it until
+# you know what you're doing.
+ifneq ($(filter ia32 x86 ppc64le,$(ARCH)),)
+ ifneq ($(PIEGEN),no)
+ piegen-y := y
+ export piegen-y
+ endif
+endif
+
+#
+# Version header file.
+include Makefile.version
+
+#
+# Configure variables.
+include Makefile.config
+config: $(VERSION_HEADER)
+
+#
+# System calls library.
+SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o
+$(SYSCALL-LIB): config
+ $(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) all
+PHONY += $(SYSCALL-LIB)
+
+#
+# Architecture dependant part.
+ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o
+$(ARCH-LIB): config $(SYSCALL-LIB)
+ $(Q) $(MAKE) $(call build-as,Makefile,$(ARCH_DIR)) $@
+PHONY += $(ARCH-LIB)
+
+#
+# piegen tool needed for PIE code.
+ifeq ($(piegen-y),y)
+piegen := pie/piegen/piegen
+
+pie/piegen/%: config
+ $(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS) $(WARNINGS) $(DEFINES)" $(MAKE) $(build)=pie/piegen $@
+pie/piegen: config
+ $(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS) $(WARNINGS) $(DEFINES)" $(MAKE) $(build)=pie/piegen all
+$(piegen): pie/piegen/built-in.o
+ $(call msg-link, $@)
+ $(Q) $(HOSTCC) $(HOSTCFLAGS) $^ $(LDFLAGS) -o $@
+PHONY += pie/piegen
+endif
+
+#
+# PIE library code.
+pie/lib.a: $(ARCH-LIB)
+ $(Q) $(MAKE) $(call build-as,Makefile.library,pie) all
+
+#
+# PIE code blobs themseves.
+pie: $(ARCH_DIR) $(piegen) pie/lib.a
+ $(Q) $(MAKE) $(build)=pie all
+PHONY += pie
+
+#
+# CRIU executable
+PROGRAM-BUILTINS += ../images/built-in.o
+PROGRAM-BUILTINS += built-in.o
+PROGRAM-BUILTINS += pie/lib.a
+PROGRAM-BUILTINS += $(SYSCALL-LIB)
+
+LIBS += arch/$(ARCH)/crtools.built-in.o
+
+built-in.o: pie/lib.a
+ $(Q) $(MAKE) $(call build-as,Makefile.crtools,.) all
+
+criu: $(PROGRAM-BUILTINS) built-in.o
+ $(call msg-link, $@)
+ $(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@
+PHONY += criu
+
+#
+# Cleanup everything.
+clean:
+ $(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) $@
+ $(Q) $(MAKE) $(call build-as,Makefile.library,pie) $@
+ $(Q) $(MAKE) $(call build-as,Makefile.crtools,.) $@
+ $(Q) $(MAKE) $(build)=pie/piegen $@
+ $(Q) $(MAKE) $(build)=pie $@
+ $(Q) $(RM) $(VERSION_HEADER)
+ $(Q) $(RM) criu
+
+#
+# Final @all target.
+all: $(PHONY)
+ @true
+
+.PHONY: $(PHONY) clean
diff --git a/Makefile.config b/crtools/Makefile.config
similarity index 50%
rename from Makefile.config
rename to crtools/Makefile.config
index ce4b8d844982..cfe352fef803 100644
--- a/Makefile.config
+++ b/crtools/Makefile.config
@@ -1,51 +1,58 @@
-include scripts/utilities.mak
-include scripts/feature-tests.mak
+include $(__nmk_dir)/utils.mk
+include ../scripts/feature-tests.mak
-CONFIG := include/config.h
+CONFIG := include/config.h
ifeq ($(call try-cc,$(LIBBSD_DEV_TEST),-lbsd),y)
- LIBS += -lbsd
- DEFINES += -DCONFIG_HAS_LIBBSD
+ LIBS += -lbsd
+ DEFINES += -DCONFIG_HAS_LIBBSD
endif
ifeq ($(call pkg-config-check,libselinux),y)
- LIBS := -lselinux $(LIBS)
- DEFINES += -DCONFIG_HAS_SELINUX
+ LIBS += -lselinux $(LIBS)
+ DEFINES += -DCONFIG_HAS_SELINUX
endif
-$(CONFIG): scripts/utilities.mak scripts/feature-tests.mak include/config-base.h
- $(E) " GEN " $@
+$(CONFIG): include/config-base.h
+ $(call msg-gen, $@)
$(Q) @echo '#ifndef __CR_CONFIG_H__' > $@
$(Q) @echo '#define __CR_CONFIG_H__' >> $@
$(Q) @echo '' >> $@
$(Q) @echo '#include "config-base.h"' >> $@
$(Q) @echo '' >> $@
-ifeq ($(call try-cc,$(TCP_REPAIR_TEST),),y)
+ifeq ($(call try-cc,$(TCP_REPAIR_TEST),,$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_TCP_REPAIR' >> $@
+ $(Q) @echo '' >> $@
endif
-ifeq ($(call try-cc,$(PRLIMIT_TEST),),y)
+ifeq ($(call try-cc,$(PRLIMIT_TEST),,$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_PRLIMIT' >> $@
+ $(Q) @echo '' >> $@
endif
-ifeq ($(call try-cc,$(STRLCPY_TEST),$(LIBS)),y)
+ifeq ($(call try-cc,$(STRLCPY_TEST),$(LIBS),$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_STRLCPY' >> $@
+ $(Q) @echo '' >> $@
endif
-ifeq ($(call try-cc,$(STRLCAT_TEST),$(LIBS)),y)
+ifeq ($(call try-cc,$(STRLCAT_TEST),$(LIBS),$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_STRLCAT' >> $@
+ $(Q) @echo '' >> $@
endif
-ifeq ($(call try-cc,$(PTRACE_PEEKSIGINFO_TEST),),y)
+ifeq ($(call try-cc,$(PTRACE_PEEKSIGINFO_TEST),,$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_PEEKSIGINFO_ARGS' >> $@
+ $(Q) @echo '' >> $@
endif
ifeq ($(VDSO),y)
$(Q) @echo '#define CONFIG_VDSO' >> $@
+ $(Q) @echo '' >> $@
endif
-ifeq ($(call try-cc,$(SETPROCTITLE_INIT_TEST),-lbsd),y)
+ifeq ($(call try-cc,$(SETPROCTITLE_INIT_TEST),-lbsd,$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_SETPROCTITLE_INIT' >> $@
+ $(Q) @echo '' >> $@
endif
ifeq ($(piegen-y),y)
$(Q) @echo '#define CONFIG_PIEGEN' >> $@
+ $(Q) @echo '' >> $@
endif
$(Q) @echo '#endif /* __CR_CONFIG_H__ */' >> $@
config: $(CONFIG)
-
-.PHONY: config
+PHONY += config
diff --git a/crtools/Makefile.crtools b/crtools/Makefile.crtools
new file mode 100644
index 000000000000..15e2dfe0d981
--- /dev/null
+++ b/crtools/Makefile.crtools
@@ -0,0 +1,95 @@
+ccflags-y += -iquote $(ARCH)
+ccflags-y += -iquote $(SRC_DIR)/images
+ccflags-y += -iquote $(SRC_DIR)
+
+obj-y += action-scripts.o
+obj-y += aio.o
+obj-y += bfd.o
+obj-y += bitmap.o
+obj-y += cgroup.o
+obj-y += cr-check.o
+obj-y += cr-dedup.o
+obj-y += cr-dump.o
+obj-y += cr-errno.o
+obj-y += cr-exec.o
+obj-y += cr-restore.o
+obj-y += cr-service.o
+obj-y += cr-show.o
+obj-y += crtools.o
+obj-y += eventfd.o
+obj-y += eventpoll.o
+obj-y += fault-injection.o
+obj-y += fifo.o
+obj-y += file-ids.o
+obj-y += file-lock.o
+obj-y += files-ext.o
+obj-y += files.o
+obj-y += files-reg.o
+obj-y += fsnotify.o
+obj-y += image-desc.o
+obj-y += image.o
+obj-y += ipc_ns.o
+obj-y += irmap.o
+obj-y += kcmp-ids.o
+obj-y += kerndat.o
+obj-y += libnetlink.o
+obj-y += log.o
+obj-y += lsm.o
+obj-y += mem.o
+obj-y += mount.o
+obj-y += namespaces.o
+obj-y += netfilter.o
+obj-y += net.o
+obj-y += pagemap-cache.o
+obj-y += page-pipe.o
+obj-y += page-read.o
+obj-y += page-xfer.o
+obj-y += parasite-syscall.o
+obj-y += pie/pie-relocs.o
+obj-y += pie-util-fd.o
+obj-y += pie-util.o
+obj-y += pipes.o
+obj-y += plugin.o
+obj-y += proc_parse.o
+obj-y += protobuf-desc.o
+obj-y += protobuf.o
+obj-y += pstree.o
+obj-y += ptrace.o
+obj-y += rbtree.o
+obj-y += rst-malloc.o
+obj-y += seccomp.o
+obj-y += seize.o
+obj-y += shmem.o
+obj-y += sigframe.o
+obj-y += signalfd.o
+obj-y += sk-inet.o
+obj-y += sk-netlink.o
+obj-y += sk-packet.o
+obj-y += sk-queue.o
+obj-y += sk-tcp.o
+obj-y += sk-unix.o
+obj-y += sockets.o
+obj-y += stats.o
+obj-y += string.o
+obj-y += sysctl.o
+obj-y += sysfs_parse.o
+obj-y += timerfd.o
+obj-y += tty.o
+obj-y += tun.o
+obj-y += util.o
+obj-y += uts_ns.o
+
+ifeq ($(VDSO),y)
+obj-y += pie-util-vdso.o
+obj-y += vdso.o
+endif
+
+PROTOBUF_GEN := $(SRC_DIR)/scripts/protobuf-gen.sh
+
+protobuf-desc.c: protobuf-desc-gen.h
+
+protobuf-desc-gen.h: $(PROTOBUF_GEN) include/protobuf-desc.h
+ $(call msg-gen, $@)
+ $(Q) $(SH) $(PROTOBUF_GEN) > $@
+
+cleanup-y += protobuf-desc-gen.h
diff --git a/scripts/Makefile.version b/crtools/Makefile.version
similarity index 63%
rename from scripts/Makefile.version
rename to crtools/Makefile.version
index 8905bd9b63a9..44dad6c14266 100644
--- a/scripts/Makefile.version
+++ b/crtools/Makefile.version
@@ -1,24 +1,23 @@
CRTOOLSVERSION := $(VERSION_MAJOR)$(if $(VERSION_MINOR),.$(VERSION_MINOR))$(if $(VERSION_SUBLEVEL),.$(VERSION_SUBLEVEL))
-
-VERSION_HEADER := include/version.h
-GITID_FILE := .gitid
-GITID := $(shell if [ -d ".git" ]; then git describe; fi)
+VERSION_HEADER := include/version.h
+GITID_FILE := ../.gitid
+GITID := $(shell if [ -d "../.git" ]; then cd .. && git describe; fi)
ifeq ($(GITID),)
- GITID := 0
+ GITID := 0
else
- GITID_FILE_VALUE := $(shell if [ -f '.gitid' ]; then if [ `cat .gitid` = $(GITID) ]; then echo y; fi; fi)
+ GITID_FILE_VALUE := $(shell if [ -f '$(GITID_FILE)' ]; then if [ `cat '$(GITID_FILE)'` = $(GITID) ]; then echo y; fi; fi)
ifneq ($(GITID_FILE_VALUE),y)
.PHONY: $(GITID_FILE)
endif
endif
$(GITID_FILE):
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) echo "$(GITID)" > $(GITID_FILE)
-$(VERSION_HEADER): Makefile scripts/Makefile.version $(GITID_FILE)
- $(E) " GEN " $@
+$(VERSION_HEADER): Makefile.version $(GITID_FILE)
+ $(call msg-gen, $@)
$(Q) echo "/* Autogenerated, do not edit */" > $(VERSION_HEADER)
$(Q) echo "#ifndef __CR_VERSION_H__" >> $(VERSION_HEADER)
$(Q) echo "#define __CR_VERSION_H__" >> $(VERSION_HEADER)
@@ -28,9 +27,5 @@ $(VERSION_HEADER): Makefile scripts/Makefile.version $(GITID_FILE)
$(Q) echo "#define CRIU_GITID \"$(GITID)\"" >> $(VERSION_HEADER)
$(Q) echo "#endif /* __CR_VERSION_H__ */" >> $(VERSION_HEADER)
-##
-## In case if someone add last resort rule
-## together with .SUFFIXES not cleaned, this
-## will slow down the build procedure
-scripts/Makefile.version::
+Makefile.version:
@true
diff --git a/action-scripts.c b/crtools/action-scripts.c
similarity index 100%
rename from action-scripts.c
rename to crtools/action-scripts.c
diff --git a/aio.c b/crtools/aio.c
similarity index 100%
rename from aio.c
rename to crtools/aio.c
diff --git a/arch/aarch64/Makefile b/crtools/arch/aarch64/Makefile
similarity index 100%
rename from arch/aarch64/Makefile
rename to crtools/arch/aarch64/Makefile
diff --git a/arch/arm/cpu.c b/crtools/arch/aarch64/cpu.c
similarity index 100%
rename from arch/arm/cpu.c
rename to crtools/arch/aarch64/cpu.c
diff --git a/arch/aarch64/crtools.c b/crtools/arch/aarch64/crtools.c
similarity index 100%
rename from arch/aarch64/crtools.c
rename to crtools/arch/aarch64/crtools.c
diff --git a/arch/aarch64/include/asm/atomic.h b/crtools/arch/aarch64/include/asm/atomic.h
similarity index 100%
rename from arch/aarch64/include/asm/atomic.h
rename to crtools/arch/aarch64/include/asm/atomic.h
diff --git a/arch/arm/include/asm/bitops.h b/crtools/arch/aarch64/include/asm/bitops.h
similarity index 100%
rename from arch/arm/include/asm/bitops.h
rename to crtools/arch/aarch64/include/asm/bitops.h
diff --git a/arch/ppc64/include/asm/bitsperlong.h b/crtools/arch/aarch64/include/asm/bitsperlong.h
similarity index 100%
rename from arch/ppc64/include/asm/bitsperlong.h
rename to crtools/arch/aarch64/include/asm/bitsperlong.h
diff --git a/arch/ppc64/include/asm/cpu.h b/crtools/arch/aarch64/include/asm/cpu.h
similarity index 100%
rename from arch/ppc64/include/asm/cpu.h
rename to crtools/arch/aarch64/include/asm/cpu.h
diff --git a/arch/aarch64/include/asm/dump.h b/crtools/arch/aarch64/include/asm/dump.h
similarity index 100%
rename from arch/aarch64/include/asm/dump.h
rename to crtools/arch/aarch64/include/asm/dump.h
diff --git a/arch/ppc64/include/asm/fpu.h b/crtools/arch/aarch64/include/asm/fpu.h
similarity index 100%
rename from arch/ppc64/include/asm/fpu.h
rename to crtools/arch/aarch64/include/asm/fpu.h
diff --git a/arch/x86/include/asm/int.h b/crtools/arch/aarch64/include/asm/int.h
similarity index 100%
rename from arch/x86/include/asm/int.h
rename to crtools/arch/aarch64/include/asm/int.h
diff --git a/arch/arm/include/asm/linkage.h b/crtools/arch/aarch64/include/asm/linkage.h
similarity index 100%
rename from arch/arm/include/asm/linkage.h
rename to crtools/arch/aarch64/include/asm/linkage.h
diff --git a/arch/aarch64/include/asm/page.h b/crtools/arch/aarch64/include/asm/page.h
similarity index 100%
rename from arch/aarch64/include/asm/page.h
rename to crtools/arch/aarch64/include/asm/page.h
diff --git a/arch/aarch64/include/asm/parasite-syscall.h b/crtools/arch/aarch64/include/asm/parasite-syscall.h
similarity index 100%
rename from arch/aarch64/include/asm/parasite-syscall.h
rename to crtools/arch/aarch64/include/asm/parasite-syscall.h
diff --git a/arch/aarch64/include/asm/parasite.h b/crtools/arch/aarch64/include/asm/parasite.h
similarity index 100%
rename from arch/aarch64/include/asm/parasite.h
rename to crtools/arch/aarch64/include/asm/parasite.h
diff --git a/arch/ppc64/include/asm/processor-flags.h b/crtools/arch/aarch64/include/asm/processor-flags.h
similarity index 100%
rename from arch/ppc64/include/asm/processor-flags.h
rename to crtools/arch/aarch64/include/asm/processor-flags.h
diff --git a/arch/aarch64/include/asm/restore.h b/crtools/arch/aarch64/include/asm/restore.h
similarity index 100%
rename from arch/aarch64/include/asm/restore.h
rename to crtools/arch/aarch64/include/asm/restore.h
diff --git a/arch/aarch64/include/asm/restorer.h b/crtools/arch/aarch64/include/asm/restorer.h
similarity index 100%
rename from arch/aarch64/include/asm/restorer.h
rename to crtools/arch/aarch64/include/asm/restorer.h
diff --git a/arch/arm/include/asm/string.h b/crtools/arch/aarch64/include/asm/string.h
similarity index 100%
rename from arch/arm/include/asm/string.h
rename to crtools/arch/aarch64/include/asm/string.h
diff --git a/arch/aarch64/include/asm/syscall-aux.S b/crtools/arch/aarch64/include/asm/syscall-aux.S
similarity index 100%
rename from arch/aarch64/include/asm/syscall-aux.S
rename to crtools/arch/aarch64/include/asm/syscall-aux.S
diff --git a/arch/aarch64/include/asm/syscall-aux.h b/crtools/arch/aarch64/include/asm/syscall-aux.h
similarity index 100%
rename from arch/aarch64/include/asm/syscall-aux.h
rename to crtools/arch/aarch64/include/asm/syscall-aux.h
diff --git a/arch/aarch64/include/asm/types.h b/crtools/arch/aarch64/include/asm/types.h
similarity index 100%
rename from arch/aarch64/include/asm/types.h
rename to crtools/arch/aarch64/include/asm/types.h
diff --git a/arch/aarch64/include/asm/vdso.h b/crtools/arch/aarch64/include/asm/vdso.h
similarity index 100%
rename from arch/aarch64/include/asm/vdso.h
rename to crtools/arch/aarch64/include/asm/vdso.h
diff --git a/arch/aarch64/intraprocedure.S b/crtools/arch/aarch64/intraprocedure.S
similarity index 100%
rename from arch/aarch64/intraprocedure.S
rename to crtools/arch/aarch64/intraprocedure.S
diff --git a/arch/aarch64/parasite-head.S b/crtools/arch/aarch64/parasite-head.S
similarity index 100%
rename from arch/aarch64/parasite-head.S
rename to crtools/arch/aarch64/parasite-head.S
diff --git a/arch/aarch64/restorer.c b/crtools/arch/aarch64/restorer.c
similarity index 100%
rename from arch/aarch64/restorer.c
rename to crtools/arch/aarch64/restorer.c
diff --git a/arch/aarch64/syscall-common.S b/crtools/arch/aarch64/syscall-common.S
similarity index 100%
rename from arch/aarch64/syscall-common.S
rename to crtools/arch/aarch64/syscall-common.S
diff --git a/arch/aarch64/vdso-pie.c b/crtools/arch/aarch64/vdso-pie.c
similarity index 100%
rename from arch/aarch64/vdso-pie.c
rename to crtools/arch/aarch64/vdso-pie.c
diff --git a/arch/arm/Makefile b/crtools/arch/arm/Makefile
similarity index 100%
rename from arch/arm/Makefile
rename to crtools/arch/arm/Makefile
diff --git a/arch/aarch64/cpu.c b/crtools/arch/arm/cpu.c
similarity index 100%
rename from arch/aarch64/cpu.c
rename to crtools/arch/arm/cpu.c
diff --git a/arch/arm/crtools.c b/crtools/arch/arm/crtools.c
similarity index 100%
rename from arch/arm/crtools.c
rename to crtools/arch/arm/crtools.c
diff --git a/arch/arm/include/asm/atomic.h b/crtools/arch/arm/include/asm/atomic.h
similarity index 100%
rename from arch/arm/include/asm/atomic.h
rename to crtools/arch/arm/include/asm/atomic.h
diff --git a/arch/aarch64/include/asm/bitops.h b/crtools/arch/arm/include/asm/bitops.h
similarity index 100%
rename from arch/aarch64/include/asm/bitops.h
rename to crtools/arch/arm/include/asm/bitops.h
diff --git a/arch/arm/include/asm/bitsperlong.h b/crtools/arch/arm/include/asm/bitsperlong.h
similarity index 100%
rename from arch/arm/include/asm/bitsperlong.h
rename to crtools/arch/arm/include/asm/bitsperlong.h
diff --git a/arch/arm/include/asm/cpu.h b/crtools/arch/arm/include/asm/cpu.h
similarity index 100%
rename from arch/arm/include/asm/cpu.h
rename to crtools/arch/arm/include/asm/cpu.h
diff --git a/arch/arm/include/asm/dump.h b/crtools/arch/arm/include/asm/dump.h
similarity index 100%
rename from arch/arm/include/asm/dump.h
rename to crtools/arch/arm/include/asm/dump.h
diff --git a/arch/arm/include/asm/fpu.h b/crtools/arch/arm/include/asm/fpu.h
similarity index 100%
rename from arch/arm/include/asm/fpu.h
rename to crtools/arch/arm/include/asm/fpu.h
diff --git a/arch/ppc64/include/asm/int.h b/crtools/arch/arm/include/asm/int.h
similarity index 100%
rename from arch/ppc64/include/asm/int.h
rename to crtools/arch/arm/include/asm/int.h
diff --git a/arch/aarch64/include/asm/linkage.h b/crtools/arch/arm/include/asm/linkage.h
similarity index 100%
rename from arch/aarch64/include/asm/linkage.h
rename to crtools/arch/arm/include/asm/linkage.h
diff --git a/arch/x86/include/asm/page.h b/crtools/arch/arm/include/asm/page.h
similarity index 100%
rename from arch/x86/include/asm/page.h
rename to crtools/arch/arm/include/asm/page.h
diff --git a/arch/arm/include/asm/parasite-syscall.h b/crtools/arch/arm/include/asm/parasite-syscall.h
similarity index 100%
rename from arch/arm/include/asm/parasite-syscall.h
rename to crtools/arch/arm/include/asm/parasite-syscall.h
diff --git a/arch/arm/include/asm/parasite.h b/crtools/arch/arm/include/asm/parasite.h
similarity index 100%
rename from arch/arm/include/asm/parasite.h
rename to crtools/arch/arm/include/asm/parasite.h
diff --git a/arch/arm/include/asm/processor-flags.h b/crtools/arch/arm/include/asm/processor-flags.h
similarity index 100%
rename from arch/arm/include/asm/processor-flags.h
rename to crtools/arch/arm/include/asm/processor-flags.h
diff --git a/arch/arm/include/asm/processor.h b/crtools/arch/arm/include/asm/processor.h
similarity index 100%
rename from arch/arm/include/asm/processor.h
rename to crtools/arch/arm/include/asm/processor.h
diff --git a/arch/arm/include/asm/restore.h b/crtools/arch/arm/include/asm/restore.h
similarity index 100%
rename from arch/arm/include/asm/restore.h
rename to crtools/arch/arm/include/asm/restore.h
diff --git a/arch/arm/include/asm/restorer.h b/crtools/arch/arm/include/asm/restorer.h
similarity index 100%
rename from arch/arm/include/asm/restorer.h
rename to crtools/arch/arm/include/asm/restorer.h
diff --git a/arch/aarch64/include/asm/string.h b/crtools/arch/arm/include/asm/string.h
similarity index 100%
rename from arch/aarch64/include/asm/string.h
rename to crtools/arch/arm/include/asm/string.h
diff --git a/arch/arm/include/asm/syscall-aux.S b/crtools/arch/arm/include/asm/syscall-aux.S
similarity index 100%
rename from arch/arm/include/asm/syscall-aux.S
rename to crtools/arch/arm/include/asm/syscall-aux.S
diff --git a/arch/arm/include/asm/syscall-aux.h b/crtools/arch/arm/include/asm/syscall-aux.h
similarity index 100%
rename from arch/arm/include/asm/syscall-aux.h
rename to crtools/arch/arm/include/asm/syscall-aux.h
diff --git a/arch/arm/include/asm/types.h b/crtools/arch/arm/include/asm/types.h
similarity index 100%
rename from arch/arm/include/asm/types.h
rename to crtools/arch/arm/include/asm/types.h
diff --git a/arch/arm/parasite-head.S b/crtools/arch/arm/parasite-head.S
similarity index 100%
rename from arch/arm/parasite-head.S
rename to crtools/arch/arm/parasite-head.S
diff --git a/arch/arm/restorer.c b/crtools/arch/arm/restorer.c
similarity index 100%
rename from arch/arm/restorer.c
rename to crtools/arch/arm/restorer.c
diff --git a/arch/arm/syscall-common.S b/crtools/arch/arm/syscall-common.S
similarity index 100%
rename from arch/arm/syscall-common.S
rename to crtools/arch/arm/syscall-common.S
diff --git a/arch/arm/syscall.def b/crtools/arch/arm/syscall.def
similarity index 100%
rename from arch/arm/syscall.def
rename to crtools/arch/arm/syscall.def
diff --git a/arch/arm/uidiv.S b/crtools/arch/arm/uidiv.S
similarity index 100%
rename from arch/arm/uidiv.S
rename to crtools/arch/arm/uidiv.S
diff --git a/arch/ppc64/Makefile b/crtools/arch/ppc64/Makefile
similarity index 100%
rename from arch/ppc64/Makefile
rename to crtools/arch/ppc64/Makefile
diff --git a/arch/ppc64/cpu.c b/crtools/arch/ppc64/cpu.c
similarity index 100%
rename from arch/ppc64/cpu.c
rename to crtools/arch/ppc64/cpu.c
diff --git a/arch/ppc64/crtools.c b/crtools/arch/ppc64/crtools.c
similarity index 100%
rename from arch/ppc64/crtools.c
rename to crtools/arch/ppc64/crtools.c
diff --git a/arch/ppc64/include/asm/atomic.h b/crtools/arch/ppc64/include/asm/atomic.h
similarity index 100%
rename from arch/ppc64/include/asm/atomic.h
rename to crtools/arch/ppc64/include/asm/atomic.h
diff --git a/arch/ppc64/include/asm/bitops.h b/crtools/arch/ppc64/include/asm/bitops.h
similarity index 100%
rename from arch/ppc64/include/asm/bitops.h
rename to crtools/arch/ppc64/include/asm/bitops.h
diff --git a/arch/aarch64/include/asm/bitsperlong.h b/crtools/arch/ppc64/include/asm/bitsperlong.h
similarity index 100%
rename from arch/aarch64/include/asm/bitsperlong.h
rename to crtools/arch/ppc64/include/asm/bitsperlong.h
diff --git a/arch/ppc64/include/asm/cmpxchg.h b/crtools/arch/ppc64/include/asm/cmpxchg.h
similarity index 100%
rename from arch/ppc64/include/asm/cmpxchg.h
rename to crtools/arch/ppc64/include/asm/cmpxchg.h
diff --git a/arch/aarch64/include/asm/cpu.h b/crtools/arch/ppc64/include/asm/cpu.h
similarity index 100%
rename from arch/aarch64/include/asm/cpu.h
rename to crtools/arch/ppc64/include/asm/cpu.h
diff --git a/arch/x86/include/asm/dump.h b/crtools/arch/ppc64/include/asm/dump.h
similarity index 100%
rename from arch/x86/include/asm/dump.h
rename to crtools/arch/ppc64/include/asm/dump.h
diff --git a/arch/aarch64/include/asm/fpu.h b/crtools/arch/ppc64/include/asm/fpu.h
similarity index 100%
rename from arch/aarch64/include/asm/fpu.h
rename to crtools/arch/ppc64/include/asm/fpu.h
diff --git a/arch/arm/include/asm/int.h b/crtools/arch/ppc64/include/asm/int.h
similarity index 100%
rename from arch/arm/include/asm/int.h
rename to crtools/arch/ppc64/include/asm/int.h
diff --git a/arch/ppc64/include/asm/linkage.h b/crtools/arch/ppc64/include/asm/linkage.h
similarity index 100%
rename from arch/ppc64/include/asm/linkage.h
rename to crtools/arch/ppc64/include/asm/linkage.h
diff --git a/arch/ppc64/include/asm/page.h b/crtools/arch/ppc64/include/asm/page.h
similarity index 100%
rename from arch/ppc64/include/asm/page.h
rename to crtools/arch/ppc64/include/asm/page.h
diff --git a/arch/ppc64/include/asm/parasite-syscall.h b/crtools/arch/ppc64/include/asm/parasite-syscall.h
similarity index 100%
rename from arch/ppc64/include/asm/parasite-syscall.h
rename to crtools/arch/ppc64/include/asm/parasite-syscall.h
diff --git a/arch/ppc64/include/asm/parasite.h b/crtools/arch/ppc64/include/asm/parasite.h
similarity index 100%
rename from arch/ppc64/include/asm/parasite.h
rename to crtools/arch/ppc64/include/asm/parasite.h
diff --git a/arch/x86/include/asm/prlimit.h b/crtools/arch/ppc64/include/asm/prlimit.h
similarity index 100%
rename from arch/x86/include/asm/prlimit.h
rename to crtools/arch/ppc64/include/asm/prlimit.h
diff --git a/arch/aarch64/include/asm/processor-flags.h b/crtools/arch/ppc64/include/asm/processor-flags.h
similarity index 100%
rename from arch/aarch64/include/asm/processor-flags.h
rename to crtools/arch/ppc64/include/asm/processor-flags.h
diff --git a/arch/ppc64/include/asm/restore.h b/crtools/arch/ppc64/include/asm/restore.h
similarity index 100%
rename from arch/ppc64/include/asm/restore.h
rename to crtools/arch/ppc64/include/asm/restore.h
diff --git a/arch/ppc64/include/asm/restorer.h b/crtools/arch/ppc64/include/asm/restorer.h
similarity index 100%
rename from arch/ppc64/include/asm/restorer.h
rename to crtools/arch/ppc64/include/asm/restorer.h
diff --git a/arch/ppc64/include/asm/string.h b/crtools/arch/ppc64/include/asm/string.h
similarity index 100%
rename from arch/ppc64/include/asm/string.h
rename to crtools/arch/ppc64/include/asm/string.h
diff --git a/arch/ppc64/include/asm/types.h b/crtools/arch/ppc64/include/asm/types.h
similarity index 100%
rename from arch/ppc64/include/asm/types.h
rename to crtools/arch/ppc64/include/asm/types.h
diff --git a/arch/ppc64/include/asm/vdso.h b/crtools/arch/ppc64/include/asm/vdso.h
similarity index 100%
rename from arch/ppc64/include/asm/vdso.h
rename to crtools/arch/ppc64/include/asm/vdso.h
diff --git a/arch/ppc64/memcmp_64.S b/crtools/arch/ppc64/memcmp_64.S
similarity index 100%
rename from arch/ppc64/memcmp_64.S
rename to crtools/arch/ppc64/memcmp_64.S
diff --git a/arch/ppc64/memcpy_power7.S b/crtools/arch/ppc64/memcpy_power7.S
similarity index 100%
rename from arch/ppc64/memcpy_power7.S
rename to crtools/arch/ppc64/memcpy_power7.S
diff --git a/arch/ppc64/misc.S b/crtools/arch/ppc64/misc.S
similarity index 100%
rename from arch/ppc64/misc.S
rename to crtools/arch/ppc64/misc.S
diff --git a/arch/ppc64/parasite-head.S b/crtools/arch/ppc64/parasite-head.S
similarity index 100%
rename from arch/ppc64/parasite-head.S
rename to crtools/arch/ppc64/parasite-head.S
diff --git a/arch/ppc64/restorer.c b/crtools/arch/ppc64/restorer.c
similarity index 100%
rename from arch/ppc64/restorer.c
rename to crtools/arch/ppc64/restorer.c
diff --git a/arch/ppc64/syscall-common-ppc64.S b/crtools/arch/ppc64/syscall-common-ppc64.S
similarity index 100%
rename from arch/ppc64/syscall-common-ppc64.S
rename to crtools/arch/ppc64/syscall-common-ppc64.S
diff --git a/arch/ppc64/syscall-ppc64.def b/crtools/arch/ppc64/syscall-ppc64.def
similarity index 100%
rename from arch/ppc64/syscall-ppc64.def
rename to crtools/arch/ppc64/syscall-ppc64.def
diff --git a/arch/ppc64/syscalls-ppc64.sh b/crtools/arch/ppc64/syscalls-ppc64.sh
similarity index 100%
rename from arch/ppc64/syscalls-ppc64.sh
rename to crtools/arch/ppc64/syscalls-ppc64.sh
diff --git a/arch/ppc64/vdso-pie.c b/crtools/arch/ppc64/vdso-pie.c
similarity index 100%
rename from arch/ppc64/vdso-pie.c
rename to crtools/arch/ppc64/vdso-pie.c
diff --git a/arch/ppc64/vdso-trampoline.S b/crtools/arch/ppc64/vdso-trampoline.S
similarity index 100%
rename from arch/ppc64/vdso-trampoline.S
rename to crtools/arch/ppc64/vdso-trampoline.S
diff --git a/arch/scripts/arm/gen-sys-exec-tbl.pl b/crtools/arch/scripts/arm/gen-sys-exec-tbl.pl
similarity index 100%
rename from arch/scripts/arm/gen-sys-exec-tbl.pl
rename to crtools/arch/scripts/arm/gen-sys-exec-tbl.pl
diff --git a/arch/scripts/arm/gen-syscalls.pl b/crtools/arch/scripts/arm/gen-syscalls.pl
similarity index 100%
rename from arch/scripts/arm/gen-syscalls.pl
rename to crtools/arch/scripts/arm/gen-syscalls.pl
diff --git a/crtools/arch/x86/Makefile b/crtools/arch/x86/Makefile
new file mode 100644
index 000000000000..6491eff845f7
--- /dev/null
+++ b/crtools/arch/x86/Makefile
@@ -0,0 +1,7 @@
+builtin-name := crtools.built-in.o
+
+ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include -iquote include
+
+obj-y += cpu.o
+obj-y += crtools.o
+obj-y += prlimit.o
diff --git a/arch/x86/Makefile b/crtools/arch/x86/Makefile.syscalls
similarity index 57%
rename from arch/x86/Makefile
rename to crtools/arch/x86/Makefile.syscalls
index d532f8f96d81..d2d4b66cdc41 100644
--- a/arch/x86/Makefile
+++ b/crtools/arch/x86/Makefile.syscalls
@@ -1,41 +1,27 @@
-targets += syscalls
-targets += crtools
+builtin-name := syscalls.built-in.o
-SYS-ASM := syscalls.S
-
-syscalls-asm-y += $(SYS-ASM:.S=).o
-crtools-obj-y += crtools.o
-crtools-obj-y += cpu.o
-crtools-obj-y += prlimit.o
-
-ifeq ($(ARCH),x86)
-SYS-DEF := syscall_64.tbl
-SYS-ASM-COMMON := syscall-common-x86-64.S
-else
-SYS-DEF := syscall_32.tbl
-SYS-ASM-COMMON := syscall-common-x86-32.S
-endif
-
-SYS-TYPES := ../../include/syscall-types.h
-SYS-CODES := ../../include/syscall-codes.h
-SYS-PROTO := ../../include/syscall.h
-
-SYS-EXEC-TBL := sys-exec-tbl.c
+SYS-TYPES := ../../include/syscall-types.h
+SYS-CODES := ../../include/syscall-codes.h
+SYS-PROTO := ../../include/syscall.h
ifeq ($(ARCH),x86)
-syscalls-asm-y-asmflags := -fpie -Wstrict-prototypes -Wa,--noexecstack
+ SYS-DEF := syscall_64.tbl
+ SYS-ASM-COMMON := syscall-common-x86-64.S
+ asflags-y += -fpie -Wstrict-prototypes -Wa,--noexecstack
else
-syscalls-asm-y-asmflags := -fno-pic -Wstrict-prototypes -Wa,--noexecstack
-endif
-syscalls-asm-y-asmflags += -nostdlib -fomit-frame-pointer -I$(obj)
+ SYS-DEF := syscall_32.tbl
+ SYS-ASM-COMMON := syscall-common-x86-32.S
+ asflags-y += -fno-pic -Wstrict-prototypes -Wa,--noexecstack
+ obj-y += syscalls/syscall32.o
-ifneq ($(ARCH),x86)
-syscalls-obj-y += syscalls/syscall32.o
$(obj)/syscalls/syscall32.o: $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
endif
-cleanup-y += $(obj)/syscalls/*.o $(obj)/syscalls/*.d
-ASMFLAGS += -D__ASSEMBLY__
+asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
+asflags-y += -iquote $(obj) -iquote $(obj)/include -iquote include
+
+SYS-ASM := syscalls.S
+obj-y += $(SYS-ASM:.S=).o
$(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@
@@ -44,8 +30,7 @@ $(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
$(Q) echo "#define __ASM_CR_SYSCALL_CODES_H__" >> $@
$(Q) cat $< | awk '/^__NR/{print "#define", $$1, $$2}' >> $@
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@
-_all += $(obj)/$(SYS-CODES)
-cleanup-y += $(obj)/$(SYS-CODES)
+cleanup-y += $(obj)/$(SYS-CODES)
$(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@
@@ -59,8 +44,7 @@ ifneq ($(ARCH),x86)
endif
$(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
-_all += $(obj)/$(SYS-PROTO)
-cleanup-y += $(obj)/$(SYS-PROTO)
+cleanup-y += $(obj)/$(SYS-PROTO)
$(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
$(E) " GEN " $@
@@ -68,21 +52,12 @@ $(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON)
$(Q) echo "#include \"syscall-codes.h\"" >> $@
$(Q) echo "#include \"syscalls/$(SYS-ASM-COMMON)\"" >> $@
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@
-_all += $(obj)/$(SYS-ASM)
-cleanup-y += $(obj)/$(SYS-ASM)
-
-$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
+cleanup-y += $(obj)/$(SYS-ASM)
+SYS-EXEC-TBL := sys-exec-tbl.c
$(obj)/$(SYS-EXEC-TBL): $(obj)/syscalls/$(SYS-DEF) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
$(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@
-_all += $(obj)/$(SYS-EXEC-TBL)
-cleanup-y += $(obj)/$(SYS-EXEC-TBL)
-
-$(obj)/crtools.built-in.o: | $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
-
-ifneq ($(MAKECMDGOALS),clean)
-deps-after := $(obj)/$(SYS-ASM)
-incdeps := y
-endif
+cleanup-y += $(obj)/$(SYS-EXEC-TBL)
+all-y += $(obj)/$(SYS-EXEC-TBL)
diff --git a/arch/x86/cpu.c b/crtools/arch/x86/cpu.c
similarity index 100%
rename from arch/x86/cpu.c
rename to crtools/arch/x86/cpu.c
diff --git a/arch/x86/crtools.c b/crtools/arch/x86/crtools.c
similarity index 100%
rename from arch/x86/crtools.c
rename to crtools/arch/x86/crtools.c
diff --git a/arch/x86/include/asm/atomic.h b/crtools/arch/x86/include/asm/atomic.h
similarity index 100%
rename from arch/x86/include/asm/atomic.h
rename to crtools/arch/x86/include/asm/atomic.h
diff --git a/arch/x86/include/asm/bitops.h b/crtools/arch/x86/include/asm/bitops.h
similarity index 100%
rename from arch/x86/include/asm/bitops.h
rename to crtools/arch/x86/include/asm/bitops.h
diff --git a/arch/x86/include/asm/bitsperlong.h b/crtools/arch/x86/include/asm/bitsperlong.h
similarity index 100%
rename from arch/x86/include/asm/bitsperlong.h
rename to crtools/arch/x86/include/asm/bitsperlong.h
diff --git a/arch/x86/include/asm/cmpxchg.h b/crtools/arch/x86/include/asm/cmpxchg.h
similarity index 100%
rename from arch/x86/include/asm/cmpxchg.h
rename to crtools/arch/x86/include/asm/cmpxchg.h
diff --git a/arch/x86/include/asm/cpu.h b/crtools/arch/x86/include/asm/cpu.h
similarity index 100%
rename from arch/x86/include/asm/cpu.h
rename to crtools/arch/x86/include/asm/cpu.h
diff --git a/arch/ppc64/include/asm/dump.h b/crtools/arch/x86/include/asm/dump.h
similarity index 100%
rename from arch/ppc64/include/asm/dump.h
rename to crtools/arch/x86/include/asm/dump.h
diff --git a/arch/x86/include/asm/fpu.h b/crtools/arch/x86/include/asm/fpu.h
similarity index 100%
rename from arch/x86/include/asm/fpu.h
rename to crtools/arch/x86/include/asm/fpu.h
diff --git a/arch/aarch64/include/asm/int.h b/crtools/arch/x86/include/asm/int.h
similarity index 100%
rename from arch/aarch64/include/asm/int.h
rename to crtools/arch/x86/include/asm/int.h
diff --git a/arch/x86/include/asm/linkage.h b/crtools/arch/x86/include/asm/linkage.h
similarity index 100%
rename from arch/x86/include/asm/linkage.h
rename to crtools/arch/x86/include/asm/linkage.h
diff --git a/arch/arm/include/asm/page.h b/crtools/arch/x86/include/asm/page.h
similarity index 100%
rename from arch/arm/include/asm/page.h
rename to crtools/arch/x86/include/asm/page.h
diff --git a/arch/x86/include/asm/parasite-syscall.h b/crtools/arch/x86/include/asm/parasite-syscall.h
similarity index 100%
rename from arch/x86/include/asm/parasite-syscall.h
rename to crtools/arch/x86/include/asm/parasite-syscall.h
diff --git a/arch/x86/include/asm/parasite.h b/crtools/arch/x86/include/asm/parasite.h
similarity index 100%
rename from arch/x86/include/asm/parasite.h
rename to crtools/arch/x86/include/asm/parasite.h
diff --git a/arch/ppc64/include/asm/prlimit.h b/crtools/arch/x86/include/asm/prlimit.h
similarity index 100%
rename from arch/ppc64/include/asm/prlimit.h
rename to crtools/arch/x86/include/asm/prlimit.h
diff --git a/arch/x86/include/asm/processor-flags.h b/crtools/arch/x86/include/asm/processor-flags.h
similarity index 100%
rename from arch/x86/include/asm/processor-flags.h
rename to crtools/arch/x86/include/asm/processor-flags.h
diff --git a/arch/x86/include/asm/restore.h b/crtools/arch/x86/include/asm/restore.h
similarity index 100%
rename from arch/x86/include/asm/restore.h
rename to crtools/arch/x86/include/asm/restore.h
diff --git a/arch/x86/include/asm/restorer.h b/crtools/arch/x86/include/asm/restorer.h
similarity index 100%
rename from arch/x86/include/asm/restorer.h
rename to crtools/arch/x86/include/asm/restorer.h
diff --git a/arch/x86/include/asm/string.h b/crtools/arch/x86/include/asm/string.h
similarity index 100%
rename from arch/x86/include/asm/string.h
rename to crtools/arch/x86/include/asm/string.h
diff --git a/arch/x86/include/asm/syscall32.h b/crtools/arch/x86/include/asm/syscall32.h
similarity index 100%
rename from arch/x86/include/asm/syscall32.h
rename to crtools/arch/x86/include/asm/syscall32.h
diff --git a/arch/x86/include/asm/types.h b/crtools/arch/x86/include/asm/types.h
similarity index 100%
rename from arch/x86/include/asm/types.h
rename to crtools/arch/x86/include/asm/types.h
diff --git a/arch/x86/include/asm/vdso.h b/crtools/arch/x86/include/asm/vdso.h
similarity index 100%
rename from arch/x86/include/asm/vdso.h
rename to crtools/arch/x86/include/asm/vdso.h
diff --git a/arch/x86/parasite-head.S b/crtools/arch/x86/parasite-head.S
similarity index 100%
rename from arch/x86/parasite-head.S
rename to crtools/arch/x86/parasite-head.S
diff --git a/arch/x86/prlimit.c b/crtools/arch/x86/prlimit.c
similarity index 100%
rename from arch/x86/prlimit.c
rename to crtools/arch/x86/prlimit.c
diff --git a/arch/x86/restorer.c b/crtools/arch/x86/restorer.c
similarity index 100%
rename from arch/x86/restorer.c
rename to crtools/arch/x86/restorer.c
diff --git a/arch/x86/syscalls/syscall-common-x86-32.S b/crtools/arch/x86/syscalls/syscall-common-x86-32.S
similarity index 100%
rename from arch/x86/syscalls/syscall-common-x86-32.S
rename to crtools/arch/x86/syscalls/syscall-common-x86-32.S
diff --git a/arch/x86/syscalls/syscall-common-x86-64.S b/crtools/arch/x86/syscalls/syscall-common-x86-64.S
similarity index 100%
rename from arch/x86/syscalls/syscall-common-x86-64.S
rename to crtools/arch/x86/syscalls/syscall-common-x86-64.S
diff --git a/arch/x86/syscalls/syscall32.c b/crtools/arch/x86/syscalls/syscall32.c
similarity index 100%
rename from arch/x86/syscalls/syscall32.c
rename to crtools/arch/x86/syscalls/syscall32.c
diff --git a/arch/x86/syscalls/syscall_32.tbl b/crtools/arch/x86/syscalls/syscall_32.tbl
similarity index 100%
rename from arch/x86/syscalls/syscall_32.tbl
rename to crtools/arch/x86/syscalls/syscall_32.tbl
diff --git a/arch/x86/syscalls/syscall_64.tbl b/crtools/arch/x86/syscalls/syscall_64.tbl
similarity index 100%
rename from arch/x86/syscalls/syscall_64.tbl
rename to crtools/arch/x86/syscalls/syscall_64.tbl
diff --git a/arch/x86/vdso-pie.c b/crtools/arch/x86/vdso-pie.c
similarity index 100%
rename from arch/x86/vdso-pie.c
rename to crtools/arch/x86/vdso-pie.c
diff --git a/bfd.c b/crtools/bfd.c
similarity index 100%
rename from bfd.c
rename to crtools/bfd.c
diff --git a/bitmap.c b/crtools/bitmap.c
similarity index 100%
rename from bitmap.c
rename to crtools/bitmap.c
diff --git a/cgroup.c b/crtools/cgroup.c
similarity index 100%
rename from cgroup.c
rename to crtools/cgroup.c
diff --git a/cr-check.c b/crtools/cr-check.c
similarity index 100%
rename from cr-check.c
rename to crtools/cr-check.c
diff --git a/cr-dedup.c b/crtools/cr-dedup.c
similarity index 100%
rename from cr-dedup.c
rename to crtools/cr-dedup.c
diff --git a/cr-dump.c b/crtools/cr-dump.c
similarity index 100%
rename from cr-dump.c
rename to crtools/cr-dump.c
diff --git a/cr-errno.c b/crtools/cr-errno.c
similarity index 100%
rename from cr-errno.c
rename to crtools/cr-errno.c
diff --git a/cr-exec.c b/crtools/cr-exec.c
similarity index 100%
rename from cr-exec.c
rename to crtools/cr-exec.c
diff --git a/cr-restore.c b/crtools/cr-restore.c
similarity index 100%
rename from cr-restore.c
rename to crtools/cr-restore.c
diff --git a/cr-service.c b/crtools/cr-service.c
similarity index 100%
rename from cr-service.c
rename to crtools/cr-service.c
diff --git a/cr-show.c b/crtools/cr-show.c
similarity index 100%
rename from cr-show.c
rename to crtools/cr-show.c
diff --git a/crtools.c b/crtools/crtools.c
similarity index 100%
rename from crtools.c
rename to crtools/crtools.c
diff --git a/eventfd.c b/crtools/eventfd.c
similarity index 100%
rename from eventfd.c
rename to crtools/eventfd.c
diff --git a/eventpoll.c b/crtools/eventpoll.c
similarity index 100%
rename from eventpoll.c
rename to crtools/eventpoll.c
diff --git a/fault-injection.c b/crtools/fault-injection.c
similarity index 100%
rename from fault-injection.c
rename to crtools/fault-injection.c
diff --git a/fifo.c b/crtools/fifo.c
similarity index 100%
rename from fifo.c
rename to crtools/fifo.c
diff --git a/file-ids.c b/crtools/file-ids.c
similarity index 100%
rename from file-ids.c
rename to crtools/file-ids.c
diff --git a/file-lock.c b/crtools/file-lock.c
similarity index 100%
rename from file-lock.c
rename to crtools/file-lock.c
diff --git a/files-ext.c b/crtools/files-ext.c
similarity index 100%
rename from files-ext.c
rename to crtools/files-ext.c
diff --git a/files-reg.c b/crtools/files-reg.c
similarity index 100%
rename from files-reg.c
rename to crtools/files-reg.c
diff --git a/files.c b/crtools/files.c
similarity index 100%
rename from files.c
rename to crtools/files.c
diff --git a/fsnotify.c b/crtools/fsnotify.c
similarity index 100%
rename from fsnotify.c
rename to crtools/fsnotify.c
diff --git a/image-desc.c b/crtools/image-desc.c
similarity index 100%
rename from image-desc.c
rename to crtools/image-desc.c
diff --git a/image.c b/crtools/image.c
similarity index 100%
rename from image.c
rename to crtools/image.c
diff --git a/include/action-scripts.h b/crtools/include/action-scripts.h
similarity index 100%
rename from include/action-scripts.h
rename to crtools/include/action-scripts.h
diff --git a/include/aio.h b/crtools/include/aio.h
similarity index 100%
rename from include/aio.h
rename to crtools/include/aio.h
diff --git a/include/asm-generic/bitops.h b/crtools/include/asm-generic/bitops.h
similarity index 100%
rename from include/asm-generic/bitops.h
rename to crtools/include/asm-generic/bitops.h
diff --git a/include/asm-generic/int.h b/crtools/include/asm-generic/int.h
similarity index 100%
rename from include/asm-generic/int.h
rename to crtools/include/asm-generic/int.h
diff --git a/include/asm-generic/string.h b/crtools/include/asm-generic/string.h
similarity index 100%
rename from include/asm-generic/string.h
rename to crtools/include/asm-generic/string.h
diff --git a/include/asm-generic/vdso.h b/crtools/include/asm-generic/vdso.h
similarity index 100%
rename from include/asm-generic/vdso.h
rename to crtools/include/asm-generic/vdso.h
diff --git a/include/bfd.h b/crtools/include/bfd.h
similarity index 100%
rename from include/bfd.h
rename to crtools/include/bfd.h
diff --git a/include/bitmap.h b/crtools/include/bitmap.h
similarity index 100%
rename from include/bitmap.h
rename to crtools/include/bitmap.h
diff --git a/include/bug.h b/crtools/include/bug.h
similarity index 100%
rename from include/bug.h
rename to crtools/include/bug.h
diff --git a/include/cgroup.h b/crtools/include/cgroup.h
similarity index 100%
rename from include/cgroup.h
rename to crtools/include/cgroup.h
diff --git a/include/compiler.h b/crtools/include/compiler.h
similarity index 100%
rename from include/compiler.h
rename to crtools/include/compiler.h
diff --git a/include/config-base.h b/crtools/include/config-base.h
similarity index 100%
rename from include/config-base.h
rename to crtools/include/config-base.h
diff --git a/include/cpu.h b/crtools/include/cpu.h
similarity index 100%
rename from include/cpu.h
rename to crtools/include/cpu.h
diff --git a/include/cr-errno.h b/crtools/include/cr-errno.h
similarity index 100%
rename from include/cr-errno.h
rename to crtools/include/cr-errno.h
diff --git a/include/cr-service-const.h b/crtools/include/cr-service-const.h
similarity index 100%
rename from include/cr-service-const.h
rename to crtools/include/cr-service-const.h
diff --git a/include/cr-service.h b/crtools/include/cr-service.h
similarity index 100%
rename from include/cr-service.h
rename to crtools/include/cr-service.h
diff --git a/include/cr-show.h b/crtools/include/cr-show.h
similarity index 100%
rename from include/cr-show.h
rename to crtools/include/cr-show.h
diff --git a/include/cr_options.h b/crtools/include/cr_options.h
similarity index 100%
rename from include/cr_options.h
rename to crtools/include/cr_options.h
diff --git a/include/criu-log.h b/crtools/include/criu-log.h
similarity index 100%
rename from include/criu-log.h
rename to crtools/include/criu-log.h
diff --git a/include/criu-plugin.h b/crtools/include/criu-plugin.h
similarity index 100%
rename from include/criu-plugin.h
rename to crtools/include/criu-plugin.h
diff --git a/include/crtools.h b/crtools/include/crtools.h
similarity index 100%
rename from include/crtools.h
rename to crtools/include/crtools.h
diff --git a/include/err.h b/crtools/include/err.h
similarity index 100%
rename from include/err.h
rename to crtools/include/err.h
diff --git a/include/errno.h b/crtools/include/errno.h
similarity index 100%
rename from include/errno.h
rename to crtools/include/errno.h
diff --git a/include/eventfd.h b/crtools/include/eventfd.h
similarity index 100%
rename from include/eventfd.h
rename to crtools/include/eventfd.h
diff --git a/include/eventpoll.h b/crtools/include/eventpoll.h
similarity index 100%
rename from include/eventpoll.h
rename to crtools/include/eventpoll.h
diff --git a/include/fault-injection.h b/crtools/include/fault-injection.h
similarity index 100%
rename from include/fault-injection.h
rename to crtools/include/fault-injection.h
diff --git a/include/fcntl.h b/crtools/include/fcntl.h
similarity index 100%
rename from include/fcntl.h
rename to crtools/include/fcntl.h
diff --git a/include/fifo.h b/crtools/include/fifo.h
similarity index 100%
rename from include/fifo.h
rename to crtools/include/fifo.h
diff --git a/include/file-ids.h b/crtools/include/file-ids.h
similarity index 100%
rename from include/file-ids.h
rename to crtools/include/file-ids.h
diff --git a/include/file-lock.h b/crtools/include/file-lock.h
similarity index 100%
rename from include/file-lock.h
rename to crtools/include/file-lock.h
diff --git a/include/files-reg.h b/crtools/include/files-reg.h
similarity index 100%
rename from include/files-reg.h
rename to crtools/include/files-reg.h
diff --git a/include/files.h b/crtools/include/files.h
similarity index 100%
rename from include/files.h
rename to crtools/include/files.h
diff --git a/include/fs-magic.h b/crtools/include/fs-magic.h
similarity index 100%
rename from include/fs-magic.h
rename to crtools/include/fs-magic.h
diff --git a/include/fsnotify.h b/crtools/include/fsnotify.h
similarity index 100%
rename from include/fsnotify.h
rename to crtools/include/fsnotify.h
diff --git a/include/image-desc.h b/crtools/include/image-desc.h
similarity index 100%
rename from include/image-desc.h
rename to crtools/include/image-desc.h
diff --git a/include/image.h b/crtools/include/image.h
similarity index 100%
rename from include/image.h
rename to crtools/include/image.h
diff --git a/include/imgset.h b/crtools/include/imgset.h
similarity index 100%
rename from include/imgset.h
rename to crtools/include/imgset.h
diff --git a/include/inet_diag.h b/crtools/include/inet_diag.h
similarity index 100%
rename from include/inet_diag.h
rename to crtools/include/inet_diag.h
diff --git a/include/ipc_ns.h b/crtools/include/ipc_ns.h
similarity index 100%
rename from include/ipc_ns.h
rename to crtools/include/ipc_ns.h
diff --git a/include/irmap.h b/crtools/include/irmap.h
similarity index 100%
rename from include/irmap.h
rename to crtools/include/irmap.h
diff --git a/include/kcmp-ids.h b/crtools/include/kcmp-ids.h
similarity index 100%
rename from include/kcmp-ids.h
rename to crtools/include/kcmp-ids.h
diff --git a/include/kcmp.h b/crtools/include/kcmp.h
similarity index 100%
rename from include/kcmp.h
rename to crtools/include/kcmp.h
diff --git a/include/kerndat.h b/crtools/include/kerndat.h
similarity index 100%
rename from include/kerndat.h
rename to crtools/include/kerndat.h
diff --git a/include/libnetlink.h b/crtools/include/libnetlink.h
similarity index 100%
rename from include/libnetlink.h
rename to crtools/include/libnetlink.h
diff --git a/include/list.h b/crtools/include/list.h
similarity index 100%
rename from include/list.h
rename to crtools/include/list.h
diff --git a/include/lock.h b/crtools/include/lock.h
similarity index 100%
rename from include/lock.h
rename to crtools/include/lock.h
diff --git a/include/log.h b/crtools/include/log.h
similarity index 100%
rename from include/log.h
rename to crtools/include/log.h
diff --git a/include/lsm.h b/crtools/include/lsm.h
similarity index 100%
rename from include/lsm.h
rename to crtools/include/lsm.h
diff --git a/include/magic.h b/crtools/include/magic.h
similarity index 100%
rename from include/magic.h
rename to crtools/include/magic.h
diff --git a/include/mem.h b/crtools/include/mem.h
similarity index 100%
rename from include/mem.h
rename to crtools/include/mem.h
diff --git a/include/mman.h b/crtools/include/mman.h
similarity index 100%
rename from include/mman.h
rename to crtools/include/mman.h
diff --git a/include/mount.h b/crtools/include/mount.h
similarity index 100%
rename from include/mount.h
rename to crtools/include/mount.h
diff --git a/include/namespaces.h b/crtools/include/namespaces.h
similarity index 100%
rename from include/namespaces.h
rename to crtools/include/namespaces.h
diff --git a/include/net.h b/crtools/include/net.h
similarity index 100%
rename from include/net.h
rename to crtools/include/net.h
diff --git a/include/netfilter.h b/crtools/include/netfilter.h
similarity index 100%
rename from include/netfilter.h
rename to crtools/include/netfilter.h
diff --git a/include/netlink_diag.h b/crtools/include/netlink_diag.h
similarity index 100%
rename from include/netlink_diag.h
rename to crtools/include/netlink_diag.h
diff --git a/include/packet_diag.h b/crtools/include/packet_diag.h
similarity index 100%
rename from include/packet_diag.h
rename to crtools/include/packet_diag.h
diff --git a/include/page-pipe.h b/crtools/include/page-pipe.h
similarity index 100%
rename from include/page-pipe.h
rename to crtools/include/page-pipe.h
diff --git a/include/page-read.h b/crtools/include/page-read.h
similarity index 100%
rename from include/page-read.h
rename to crtools/include/page-read.h
diff --git a/include/page-xfer.h b/crtools/include/page-xfer.h
similarity index 100%
rename from include/page-xfer.h
rename to crtools/include/page-xfer.h
diff --git a/include/pagemap-cache.h b/crtools/include/pagemap-cache.h
similarity index 100%
rename from include/pagemap-cache.h
rename to crtools/include/pagemap-cache.h
diff --git a/include/parasite-syscall.h b/crtools/include/parasite-syscall.h
similarity index 100%
rename from include/parasite-syscall.h
rename to crtools/include/parasite-syscall.h
diff --git a/include/parasite-vdso.h b/crtools/include/parasite-vdso.h
similarity index 100%
rename from include/parasite-vdso.h
rename to crtools/include/parasite-vdso.h
diff --git a/include/parasite.h b/crtools/include/parasite.h
similarity index 100%
rename from include/parasite.h
rename to crtools/include/parasite.h
diff --git a/include/pid.h b/crtools/include/pid.h
similarity index 100%
rename from include/pid.h
rename to crtools/include/pid.h
diff --git a/include/pipes.h b/crtools/include/pipes.h
similarity index 100%
rename from include/pipes.h
rename to crtools/include/pipes.h
diff --git a/include/plugin.h b/crtools/include/plugin.h
similarity index 100%
rename from include/plugin.h
rename to crtools/include/plugin.h
diff --git a/include/posix-timer.h b/crtools/include/posix-timer.h
similarity index 100%
rename from include/posix-timer.h
rename to crtools/include/posix-timer.h
diff --git a/include/prctl.h b/crtools/include/prctl.h
similarity index 100%
rename from include/prctl.h
rename to crtools/include/prctl.h
diff --git a/include/proc_parse.h b/crtools/include/proc_parse.h
similarity index 100%
rename from include/proc_parse.h
rename to crtools/include/proc_parse.h
diff --git a/include/protobuf-desc.h b/crtools/include/protobuf-desc.h
similarity index 100%
rename from include/protobuf-desc.h
rename to crtools/include/protobuf-desc.h
diff --git a/include/protobuf.h b/crtools/include/protobuf.h
similarity index 100%
rename from include/protobuf.h
rename to crtools/include/protobuf.h
diff --git a/include/pstree.h b/crtools/include/pstree.h
similarity index 100%
rename from include/pstree.h
rename to crtools/include/pstree.h
diff --git a/include/ptrace.h b/crtools/include/ptrace.h
similarity index 100%
rename from include/ptrace.h
rename to crtools/include/ptrace.h
diff --git a/include/rbtree.h b/crtools/include/rbtree.h
similarity index 100%
rename from include/rbtree.h
rename to crtools/include/rbtree.h
diff --git a/include/restorer.h b/crtools/include/restorer.h
similarity index 100%
rename from include/restorer.h
rename to crtools/include/restorer.h
diff --git a/include/rst-malloc.h b/crtools/include/rst-malloc.h
similarity index 100%
rename from include/rst-malloc.h
rename to crtools/include/rst-malloc.h
diff --git a/include/rst_info.h b/crtools/include/rst_info.h
similarity index 100%
rename from include/rst_info.h
rename to crtools/include/rst_info.h
diff --git a/include/seccomp.h b/crtools/include/seccomp.h
similarity index 100%
rename from include/seccomp.h
rename to crtools/include/seccomp.h
diff --git a/include/seize.h b/crtools/include/seize.h
similarity index 100%
rename from include/seize.h
rename to crtools/include/seize.h
diff --git a/include/servicefd.h b/crtools/include/servicefd.h
similarity index 100%
rename from include/servicefd.h
rename to crtools/include/servicefd.h
diff --git a/include/setproctitle.h b/crtools/include/setproctitle.h
similarity index 100%
rename from include/setproctitle.h
rename to crtools/include/setproctitle.h
diff --git a/include/shmem.h b/crtools/include/shmem.h
similarity index 100%
rename from include/shmem.h
rename to crtools/include/shmem.h
diff --git a/include/sigframe.h b/crtools/include/sigframe.h
similarity index 100%
rename from include/sigframe.h
rename to crtools/include/sigframe.h
diff --git a/include/signalfd.h b/crtools/include/signalfd.h
similarity index 100%
rename from include/signalfd.h
rename to crtools/include/signalfd.h
diff --git a/include/sk-inet.h b/crtools/include/sk-inet.h
similarity index 100%
rename from include/sk-inet.h
rename to crtools/include/sk-inet.h
diff --git a/include/sk-packet.h b/crtools/include/sk-packet.h
similarity index 100%
rename from include/sk-packet.h
rename to crtools/include/sk-packet.h
diff --git a/include/sk-queue.h b/crtools/include/sk-queue.h
similarity index 100%
rename from include/sk-queue.h
rename to crtools/include/sk-queue.h
diff --git a/include/sockets.h b/crtools/include/sockets.h
similarity index 100%
rename from include/sockets.h
rename to crtools/include/sockets.h
diff --git a/include/stats.h b/crtools/include/stats.h
similarity index 100%
rename from include/stats.h
rename to crtools/include/stats.h
diff --git a/include/string.h b/crtools/include/string.h
similarity index 100%
rename from include/string.h
rename to crtools/include/string.h
diff --git a/include/syscall-types.h b/crtools/include/syscall-types.h
similarity index 100%
rename from include/syscall-types.h
rename to crtools/include/syscall-types.h
diff --git a/include/sysctl.h b/crtools/include/sysctl.h
similarity index 100%
rename from include/sysctl.h
rename to crtools/include/sysctl.h
diff --git a/include/sysfs_parse.h b/crtools/include/sysfs_parse.h
similarity index 100%
rename from include/sysfs_parse.h
rename to crtools/include/sysfs_parse.h
diff --git a/include/timerfd.h b/crtools/include/timerfd.h
similarity index 100%
rename from include/timerfd.h
rename to crtools/include/timerfd.h
diff --git a/include/tty.h b/crtools/include/tty.h
similarity index 100%
rename from include/tty.h
rename to crtools/include/tty.h
diff --git a/include/tun.h b/crtools/include/tun.h
similarity index 100%
rename from include/tun.h
rename to crtools/include/tun.h
diff --git a/include/unix_diag.h b/crtools/include/unix_diag.h
similarity index 100%
rename from include/unix_diag.h
rename to crtools/include/unix_diag.h
diff --git a/include/util-pie.h b/crtools/include/util-pie.h
similarity index 100%
rename from include/util-pie.h
rename to crtools/include/util-pie.h
diff --git a/include/util-vdso.h b/crtools/include/util-vdso.h
similarity index 100%
rename from include/util-vdso.h
rename to crtools/include/util-vdso.h
diff --git a/include/util.h b/crtools/include/util.h
similarity index 100%
rename from include/util.h
rename to crtools/include/util.h
diff --git a/include/uts_ns.h b/crtools/include/uts_ns.h
similarity index 100%
rename from include/uts_ns.h
rename to crtools/include/uts_ns.h
diff --git a/include/vdso.h b/crtools/include/vdso.h
similarity index 100%
rename from include/vdso.h
rename to crtools/include/vdso.h
diff --git a/include/vma.h b/crtools/include/vma.h
similarity index 100%
rename from include/vma.h
rename to crtools/include/vma.h
diff --git a/include/xmalloc.h b/crtools/include/xmalloc.h
similarity index 100%
rename from include/xmalloc.h
rename to crtools/include/xmalloc.h
diff --git a/ipc_ns.c b/crtools/ipc_ns.c
similarity index 100%
rename from ipc_ns.c
rename to crtools/ipc_ns.c
diff --git a/irmap.c b/crtools/irmap.c
similarity index 100%
rename from irmap.c
rename to crtools/irmap.c
diff --git a/kcmp-ids.c b/crtools/kcmp-ids.c
similarity index 100%
rename from kcmp-ids.c
rename to crtools/kcmp-ids.c
diff --git a/kerndat.c b/crtools/kerndat.c
similarity index 100%
rename from kerndat.c
rename to crtools/kerndat.c
diff --git a/libnetlink.c b/crtools/libnetlink.c
similarity index 100%
rename from libnetlink.c
rename to crtools/libnetlink.c
diff --git a/log.c b/crtools/log.c
similarity index 100%
rename from log.c
rename to crtools/log.c
diff --git a/lsm.c b/crtools/lsm.c
similarity index 100%
rename from lsm.c
rename to crtools/lsm.c
diff --git a/mem.c b/crtools/mem.c
similarity index 100%
rename from mem.c
rename to crtools/mem.c
diff --git a/mount.c b/crtools/mount.c
similarity index 100%
rename from mount.c
rename to crtools/mount.c
diff --git a/namespaces.c b/crtools/namespaces.c
similarity index 100%
rename from namespaces.c
rename to crtools/namespaces.c
diff --git a/net.c b/crtools/net.c
similarity index 100%
rename from net.c
rename to crtools/net.c
diff --git a/netfilter.c b/crtools/netfilter.c
similarity index 100%
rename from netfilter.c
rename to crtools/netfilter.c
diff --git a/page-pipe.c b/crtools/page-pipe.c
similarity index 100%
rename from page-pipe.c
rename to crtools/page-pipe.c
diff --git a/page-read.c b/crtools/page-read.c
similarity index 100%
rename from page-read.c
rename to crtools/page-read.c
diff --git a/page-xfer.c b/crtools/page-xfer.c
similarity index 100%
rename from page-xfer.c
rename to crtools/page-xfer.c
diff --git a/pagemap-cache.c b/crtools/pagemap-cache.c
similarity index 100%
rename from pagemap-cache.c
rename to crtools/pagemap-cache.c
diff --git a/parasite-syscall.c b/crtools/parasite-syscall.c
similarity index 100%
rename from parasite-syscall.c
rename to crtools/parasite-syscall.c
diff --git a/crtools/pie-util-fd.c b/crtools/pie-util-fd.c
new file mode 120000
index 000000000000..4af261ede48c
--- /dev/null
+++ b/crtools/pie-util-fd.c
@@ -0,0 +1 @@
+pie/util-fd.c
\ No newline at end of file
diff --git a/crtools/pie-util-vdso.c b/crtools/pie-util-vdso.c
new file mode 120000
index 000000000000..6e56238c237c
--- /dev/null
+++ b/crtools/pie-util-vdso.c
@@ -0,0 +1 @@
+pie/util-vdso.c
\ No newline at end of file
diff --git a/crtools/pie-util.c b/crtools/pie-util.c
new file mode 120000
index 000000000000..238f297c82e7
--- /dev/null
+++ b/crtools/pie-util.c
@@ -0,0 +1 @@
+pie/util.c
\ No newline at end of file
diff --git a/pie/Makefile b/crtools/pie/Makefile
similarity index 56%
rename from pie/Makefile
rename to crtools/pie/Makefile
index fd48da92ea43..dd62e4b96a90 100644
--- a/pie/Makefile
+++ b/crtools/pie/Makefile
@@ -1,38 +1,13 @@
-targets += parasite
-targets += restorer
-
-# used by obj-x to identify shared files built for parasite/restorer binaries
-xsuffix := -pie-build
-
-obj-y += log-simple.o
-obj-x += util.o
-obj-x += util-fd.o
-
-ifeq ($(VDSO),y)
-obj-x += util-vdso.o
-obj-y += parasite-vdso.o
-obj-e += $(ARCH_DIR)/vdso-pie.o
-ifeq ($(SRCARCH),aarch64)
-asm-e += $(ARCH_DIR)/intraprocedure.o
-endif
-ifeq ($(SRCARCH), ppc64)
-asm-e += $(ARCH_DIR)/vdso-trampoline.o
-endif
-endif
-
-ifeq ($(SRCARCH), ppc64)
-asm-e += $(ARCH_DIR)/memcpy_power7.o
-asm-e += $(ARCH_DIR)/memcmp_64.o
-asm-e += $(ARCH_DIR)/misc.o
-endif
+target += parasite
+target += restorer
parasite-obj-y += parasite.o
-parasite-asm-e += $(ARCH_DIR)/parasite-head.o
-parasite-libs-e += $(SYSCALL-LIB)
+parasite-obj-y += ./$(ARCH_DIR)/parasite-head.o
+parasite-obj-e += ./$(ARCH_DIR)/syscalls.built-in.o
restorer-obj-y += restorer.o
-restorer-obj-e += $(ARCH_DIR)/restorer.o
-restorer-libs-e += $(SYSCALL-LIB)
+restorer-obj-y += ./$(ARCH_DIR)/restorer.o
+restorer-obj-e += ./$(ARCH_DIR)/syscalls.built-in.o
#
# We can't provide proper mount implementation
@@ -40,18 +15,19 @@ restorer-libs-e += $(SYSCALL-LIB)
# applications, which is not the target of the
# project.
#
-CFLAGS := $(filter-out -pg,$(CFLAGS)) -iquote pie/piegen
+CFLAGS := $(filter-out -pg,$(CFLAGS)) -iquote pie/piegen -iquote arch/$(ARCH)/include -iquote $(SRC_DIR) -iquote include
-ifneq ($(filter-out i386 ia32, $(ARCH)),)
-cflags-y += -DCR_NOGLIBC -fpie -Wa,--noexecstack -fno-stack-protector
+ifneq ($(filter-out ia32,$(ARCH)),)
+ ccflags-y += -DCR_NOGLIBC -fpie -Wa,--noexecstack -fno-stack-protector
else
-cflags-y += -DCR_NOGLIBC -fno-pic -Wa,--noexecstack -fno-stack-protector
+ ccflags-y += -DCR_NOGLIBC -fno-pic -Wa,--noexecstack -fno-stack-protector
endif
-ifeq ($(SRCARCH), arm)
- cflags-y += -marm
+ifeq ($(SRCARCH),arm)
+ ccflags-y += -marm
endif
-ASMFLAGS += -D__ASSEMBLY__
+
+asflags-y += -D__ASSEMBLY__
GEN-OFFSETS := ../scripts/gen-offsets.sh
BLOBS := $(obj)/parasite-blob.h $(obj)/restorer-blob.h
@@ -61,24 +37,23 @@ PIELDS := pie.lds.S
.SECONDARY:
ifeq ($(piegen-y),y)
-ldflags-y += -r
target-name = $(patsubst pie/%-blob.h,%,$(1))
ifeq ($(SRCARCH),ppc64)
$(obj)/$(PIELDS): $(obj)/pie-reloc.lds.S.in
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) echo "OUTPUT_ARCH($(LDARCH))" > $(obj)/$(PIELDS)
$(Q) cat $< >> $(obj)/$(PIELDS)
else
ifeq ($(ARCH),x86)
$(obj)/$(PIELDS): $(obj)/pie-reloc.lds.S.in
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) echo "OUTPUT_ARCH(i386:x86-64)" > $(obj)/$(PIELDS)
$(Q) echo "TARGET(elf64-x86-64)" >> $(obj)/$(PIELDS)
$(Q) cat $< >> $(obj)/$(PIELDS)
else # i386 ia32
$(obj)/$(PIELDS): $(obj)/pie-reloc.lds.S.in
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) echo "OUTPUT_ARCH(i386)" > $(obj)/$(PIELDS)
$(Q) echo "TARGET(elf32-i386)" >> $(obj)/$(PIELDS)
$(Q) cat $< >> $(obj)/$(PIELDS)
@@ -86,47 +61,43 @@ endif
endif
ifeq ($(strip $(V)),)
-piegen_stdout = >/dev/null
+ piegen_stdout := >/dev/null
endif
-$(obj)/%.built-in.bin.o: $(obj)/%.built-in.o $(obj)/$(PIELDS)
- $(E) " GEN " $@
- $(Q) $(LD) $(ldflags-y) -T $(obj)/$(PIELDS) -o $@ $<
+$(obj)/%.built-in.bin.o: $(obj)/%.built-in.o $(obj)/lib.a $(obj)/$(PIELDS)
+ $(call msg-gen, $@)
+ $(Q) $(LD) -r -T $(obj)/$(PIELDS) -o $@ $< $(obj)/lib.a
$(obj)/%-blob.h: $(obj)/%.built-in.bin.o $(obj)/$(PIELDS) pie/piegen
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) pie/piegen/piegen -f $< -v $(call target-name,$@)_relocs -p $(call target-name,$@)_blob_offset__ -s $(call target-name,$@)_blob -o $@ $(piegen_stdout)
else
$(obj)/$(PIELDS): $(obj)/$(PIELDS).in
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) $(SH) -c "echo 'OUTPUT_ARCH($(LDARCH))' > $(obj)/$(PIELDS)"
$(Q) $(SH) -c "cat $(obj)/$(PIELDS).in >> $(obj)/$(PIELDS)"
$(obj)/%.built-in.bin.o: $(obj)/%.built-in.o $(obj)/$(PIELDS)
- $(E) " GEN " $@
- $(Q) $(LD) $(ldflags-y) -T $(obj)/$(PIELDS) -o $@ $<
+ $(call msg-gen, $@)
+ $(Q) $(LD) -r -T $(obj)/$(PIELDS) -o $@ $<
$(obj)/%.built-in.bin: $(obj)/%.built-in.bin.o
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) $(OBJCOPY) -O binary $^ $@
$(obj)/%-blob.h: $(obj)/%.built-in.bin $(obj)/$(GEN-OFFSETS)
- $(E) " GEN " $@
+ $(call msg-gen, $@)
$(Q) $(SH) $(obj)/$(GEN-OFFSETS) $(@:-blob.h=) $(notdir $(@:-blob.h=)) $(CROSS_COMPILE) > $@
endif
$(BLOBS): $(obj)/$(PIELDS)
-_all += $(BLOBS)
+all-y += $(BLOBS)
cleanup-y += $(obj)/$(PIELDS)
cleanup-y += $(obj)/*.bin
cleanup-y += $(BLOBS)
cleanup-y += $(obj)/*.built-in.bin.o
cleanup-y += $(obj)/*.built-in.bin
-
-ifneq ($(MAKECMDGOALS),clean)
-incdeps := y
-endif
diff --git a/crtools/pie/Makefile.library b/crtools/pie/Makefile.library
new file mode 100644
index 000000000000..047a5335754a
--- /dev/null
+++ b/crtools/pie/Makefile.library
@@ -0,0 +1,41 @@
+lib-y += log-simple.o
+lib-y += util-fd.o
+lib-y += util.o
+
+ifeq ($(VDSO),y)
+ lib-y += util-vdso.o
+ lib-y += parasite-vdso.o
+ lib-y += ./$(ARCH_DIR)/vdso-pie.o
+
+ ifeq ($(SRCARCH),aarch64)
+ lib-y += ./$(ARCH_DIR)/intraprocedure.o
+ endif
+
+ ifeq ($(SRCARCH),ppc64)
+ lib-y += ./$(ARCH_DIR)/vdso-trampoline.o
+ endif
+endif
+
+ifeq ($(SRCARCH),ppc64)
+ obj-y += ./$(ARCH_DIR)/memcpy_power7.o
+ obj-y += ./$(ARCH_DIR)/memcmp_64.o
+ obj-y += ./$(ARCH_DIR)/misc.o
+endif
+
+#
+# We can't provide proper mount implementation
+# in parasite code -- it requires run-time rellocation
+# applications, which is not the target of the
+# project.
+#
+ccflags-y += $(filter-out -pg,$(CFLAGS)) -iquote $(SRC_DIR) -iquote pie/piegen
+
+ifeq ($(SRCARCH), arm)
+ cflags-y += -marm
+endif
+
+ifneq ($(filter-out ia32, $(ARCH)),)
+ ccflags-y += -DCR_NOGLIBC -fpie -Wa,--noexecstack -fno-stack-protector
+else
+ ccflags-y += -DCR_NOGLIBC -fno-pic -Wa,--noexecstack -fno-stack-protector
+endif
diff --git a/pie/log-simple.c b/crtools/pie/log-simple.c
similarity index 100%
rename from pie/log-simple.c
rename to crtools/pie/log-simple.c
diff --git a/pie/parasite-vdso.c b/crtools/pie/parasite-vdso.c
similarity index 100%
rename from pie/parasite-vdso.c
rename to crtools/pie/parasite-vdso.c
diff --git a/pie/parasite.c b/crtools/pie/parasite.c
similarity index 100%
rename from pie/parasite.c
rename to crtools/pie/parasite.c
diff --git a/pie/pie-reloc.lds.S.in b/crtools/pie/pie-reloc.lds.S.in
similarity index 100%
rename from pie/pie-reloc.lds.S.in
rename to crtools/pie/pie-reloc.lds.S.in
diff --git a/pie/pie-relocs.c b/crtools/pie/pie-relocs.c
similarity index 100%
rename from pie/pie-relocs.c
rename to crtools/pie/pie-relocs.c
diff --git a/pie/pie-relocs.h b/crtools/pie/pie-relocs.h
similarity index 100%
rename from pie/pie-relocs.h
rename to crtools/pie/pie-relocs.h
diff --git a/pie/pie.lds.S.in b/crtools/pie/pie.lds.S.in
similarity index 100%
rename from pie/pie.lds.S.in
rename to crtools/pie/pie.lds.S.in
diff --git a/pie/piegen/Makefile b/crtools/pie/piegen/Makefile
similarity index 100%
rename from pie/piegen/Makefile
rename to crtools/pie/piegen/Makefile
diff --git a/pie/piegen/elf-ppc64.c b/crtools/pie/piegen/elf-ppc64.c
similarity index 100%
rename from pie/piegen/elf-ppc64.c
rename to crtools/pie/piegen/elf-ppc64.c
diff --git a/pie/piegen/elf-x86-32.c b/crtools/pie/piegen/elf-x86-32.c
similarity index 100%
rename from pie/piegen/elf-x86-32.c
rename to crtools/pie/piegen/elf-x86-32.c
diff --git a/pie/piegen/elf-x86-64.c b/crtools/pie/piegen/elf-x86-64.c
similarity index 100%
rename from pie/piegen/elf-x86-64.c
rename to crtools/pie/piegen/elf-x86-64.c
diff --git a/pie/piegen/elf.c b/crtools/pie/piegen/elf.c
similarity index 100%
rename from pie/piegen/elf.c
rename to crtools/pie/piegen/elf.c
diff --git a/pie/piegen/main.c b/crtools/pie/piegen/main.c
similarity index 100%
rename from pie/piegen/main.c
rename to crtools/pie/piegen/main.c
diff --git a/pie/piegen/piegen.h b/crtools/pie/piegen/piegen.h
similarity index 100%
rename from pie/piegen/piegen.h
rename to crtools/pie/piegen/piegen.h
diff --git a/pie/piegen/uapi/types.h b/crtools/pie/piegen/uapi/types.h
similarity index 100%
rename from pie/piegen/uapi/types.h
rename to crtools/pie/piegen/uapi/types.h
diff --git a/pie/restorer.c b/crtools/pie/restorer.c
similarity index 100%
rename from pie/restorer.c
rename to crtools/pie/restorer.c
diff --git a/pie/util-fd.c b/crtools/pie/util-fd.c
similarity index 100%
rename from pie/util-fd.c
rename to crtools/pie/util-fd.c
diff --git a/pie/util-vdso.c b/crtools/pie/util-vdso.c
similarity index 100%
rename from pie/util-vdso.c
rename to crtools/pie/util-vdso.c
diff --git a/pie/util.c b/crtools/pie/util.c
similarity index 100%
rename from pie/util.c
rename to crtools/pie/util.c
diff --git a/pipes.c b/crtools/pipes.c
similarity index 100%
rename from pipes.c
rename to crtools/pipes.c
diff --git a/plugin.c b/crtools/plugin.c
similarity index 100%
rename from plugin.c
rename to crtools/plugin.c
diff --git a/proc_parse.c b/crtools/proc_parse.c
similarity index 100%
rename from proc_parse.c
rename to crtools/proc_parse.c
diff --git a/protobuf-desc.c b/crtools/protobuf-desc.c
similarity index 100%
rename from protobuf-desc.c
rename to crtools/protobuf-desc.c
diff --git a/protobuf.c b/crtools/protobuf.c
similarity index 100%
rename from protobuf.c
rename to crtools/protobuf.c
diff --git a/pstree.c b/crtools/pstree.c
similarity index 100%
rename from pstree.c
rename to crtools/pstree.c
diff --git a/ptrace.c b/crtools/ptrace.c
similarity index 100%
rename from ptrace.c
rename to crtools/ptrace.c
diff --git a/rbtree.c b/crtools/rbtree.c
similarity index 100%
rename from rbtree.c
rename to crtools/rbtree.c
diff --git a/rst-malloc.c b/crtools/rst-malloc.c
similarity index 100%
rename from rst-malloc.c
rename to crtools/rst-malloc.c
diff --git a/seccomp.c b/crtools/seccomp.c
similarity index 100%
rename from seccomp.c
rename to crtools/seccomp.c
diff --git a/seize.c b/crtools/seize.c
similarity index 100%
rename from seize.c
rename to crtools/seize.c
diff --git a/shmem.c b/crtools/shmem.c
similarity index 100%
rename from shmem.c
rename to crtools/shmem.c
diff --git a/sigframe.c b/crtools/sigframe.c
similarity index 100%
rename from sigframe.c
rename to crtools/sigframe.c
diff --git a/signalfd.c b/crtools/signalfd.c
similarity index 100%
rename from signalfd.c
rename to crtools/signalfd.c
diff --git a/sk-inet.c b/crtools/sk-inet.c
similarity index 100%
rename from sk-inet.c
rename to crtools/sk-inet.c
diff --git a/sk-netlink.c b/crtools/sk-netlink.c
similarity index 100%
rename from sk-netlink.c
rename to crtools/sk-netlink.c
diff --git a/sk-packet.c b/crtools/sk-packet.c
similarity index 100%
rename from sk-packet.c
rename to crtools/sk-packet.c
diff --git a/sk-queue.c b/crtools/sk-queue.c
similarity index 100%
rename from sk-queue.c
rename to crtools/sk-queue.c
diff --git a/sk-tcp.c b/crtools/sk-tcp.c
similarity index 100%
rename from sk-tcp.c
rename to crtools/sk-tcp.c
diff --git a/sk-unix.c b/crtools/sk-unix.c
similarity index 100%
rename from sk-unix.c
rename to crtools/sk-unix.c
diff --git a/sockets.c b/crtools/sockets.c
similarity index 100%
rename from sockets.c
rename to crtools/sockets.c
diff --git a/stats.c b/crtools/stats.c
similarity index 100%
rename from stats.c
rename to crtools/stats.c
diff --git a/string.c b/crtools/string.c
similarity index 100%
rename from string.c
rename to crtools/string.c
diff --git a/sysctl.c b/crtools/sysctl.c
similarity index 100%
rename from sysctl.c
rename to crtools/sysctl.c
diff --git a/sysfs_parse.c b/crtools/sysfs_parse.c
similarity index 100%
rename from sysfs_parse.c
rename to crtools/sysfs_parse.c
diff --git a/timerfd.c b/crtools/timerfd.c
similarity index 100%
rename from timerfd.c
rename to crtools/timerfd.c
diff --git a/tty.c b/crtools/tty.c
similarity index 100%
rename from tty.c
rename to crtools/tty.c
diff --git a/tun.c b/crtools/tun.c
similarity index 100%
rename from tun.c
rename to crtools/tun.c
diff --git a/util.c b/crtools/util.c
similarity index 100%
rename from util.c
rename to crtools/util.c
diff --git a/uts_ns.c b/crtools/uts_ns.c
similarity index 100%
rename from uts_ns.c
rename to crtools/uts_ns.c
diff --git a/vdso.c b/crtools/vdso.c
similarity index 100%
rename from vdso.c
rename to crtools/vdso.c
diff --git a/images/Makefile b/images/Makefile
index 12089a2192ab..16ecb6ab54ef 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -59,7 +59,7 @@ proto-obj-y += seccomp.o
proto-obj-y += binfmt-misc.o
proto-obj-y += time.o
-CFLAGS += -I$(obj)/
+CFLAGS += -iquote $(obj)/
#
# Generates a set of names from protobuf "import" directive.
@@ -101,8 +101,6 @@ $(obj)/built-in.o: $(addprefix $(obj)/,$(proto-obj-y))
$(E) " LINK " $@
$(Q) $(LD) $(ldflags-y) -r -o $@ $^
-_all += $(obj)/built-in.o
-
ifneq ($(MAKECMDGOALS),clean)
-include $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.d))
endif
@@ -112,4 +110,3 @@ cleanup-y += $(obj)/google/protobuf/*.d
cleanup-y += $(obj)/google/protobuf/*.h
cleanup-y += $(obj)/google/protobuf/*.c
cleanup-y += $(obj)/google/protobuf/*.o
-cleanup-y += $(obj)/*.d $(obj)/*.i $(obj)/*.s $(obj)/*.o
diff --git a/lib/Makefile b/lib/Makefile
index f07e07b9051e..d1b0450599f8 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -15,11 +15,11 @@ c/built-in.o:
$(call msg-gen, $@)
$(Q) $(MAKE) $(build)=c all
-ccflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(lib-so).so.$(VERSION_SO_MAJOR)
+cflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(lib-so).so.$(VERSION_SO_MAJOR)
ldflags-so += -lprotobuf-c
c/$(CRIU_SO): c/built-in.o
$(call msg-link, $@)
- $(Q) $(CC) -shared $(ccflags-so) -o $@ $^ $(ldflags-so) $(LDFLAGS)
+ $(Q) $(CC) -shared $(cflags-so) -o $@ $^ $(ldflags-so) $(LDFLAGS)
lib-c: c/$(CRIU_SO)
PHONY += lib-c
@@ -40,3 +40,5 @@ clean:
all: $(PHONY)
@true
PHONY += all
+
+.PHONY: $(PHONY) clean
diff --git a/lib/c/Makefile b/lib/c/Makefile
index 16b4ef194004..c7b8762f09b5 100644
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -5,9 +5,3 @@ ccflags-y += -iquote $(SRC_DIR)/crtools/$(ARCH_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/crtools/include -iquote $(obj)/..
ccflags-y += -iquote $(SRC_DIR)/images
ccflags-y += -fPIC -Wa,--noexecstack -fno-stack-protector
-
-#
-# Remove once criu moved into proper place.
-ccflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR)/include
-ccflags-y += -iquote $(SRC_DIR)/include -iquote $(obj)/..
-ccflags-y += -iquote $(SRC_DIR)/images
diff --git a/lib/py/Makefile b/lib/py/Makefile
index 135fe1c01600..582cc93dea84 100644
--- a/lib/py/Makefile
+++ b/lib/py/Makefile
@@ -8,7 +8,7 @@ images:
# rpc_pb2.py doesn't depend on any other file, so
# it is safe to rename it, dropping ugly _pb2 suffix.
rpc.py:
- $(Q) protoc -I=$(SRC_DIR)/protobuf/ --python_out=./ $(SRC_DIR)/protobuf/$(@:.py=.proto)
+ $(Q) protoc -I=$(SRC_DIR)/images/ --python_out=./ $(SRC_DIR)/images/$(@:.py=.proto)
$(Q) mv $(@:.py=_pb2.py) $@
clean:
diff --git a/lib/py/images/Makefile b/lib/py/images/Makefile
index 98a450065465..e6d26c8a70a0 100644
--- a/lib/py/images/Makefile
+++ b/lib/py/images/Makefile
@@ -1,22 +1,21 @@
-all: pb.py protobuf magic.py
+all: pb.py images magic.py
-.PHONY: all protobuf clean pb.py
+.PHONY: all images clean pb.py
-proto := $(filter-out $(SRC_DIR)/protobuf/rpc.proto, $(sort $(wildcard $(SRC_DIR)/protobuf/*.proto)))
+proto := $(filter-out $(SRC_DIR)/images/rpc.proto, $(sort $(wildcard $(SRC_DIR)/images/*.proto)))
proto-py-modules := $(foreach m,$(proto),$(subst -,_,$(notdir $(m:.proto=_pb2))))
-# We don't need rpc_pb2.py here, as it is not related to the
-# images.
+# We don't need rpc_pb2.py here, as it is not related to the images.
# Unfortunately, we can't drop ugly _pb2 suffixes here, because
# some _pb2 files depend on others _pb2 files.
-protobuf:
- $(Q) protoc -I=$(SRC_DIR)/protobuf -I=/usr/include/ --python_out=./ $(proto)
+images:
+ $(Q) protoc -I=$(SRC_DIR)/images -I=/usr/include/ --python_out=./ $(proto)
-magic.py: $(SRC_DIR)/scripts/magic-gen.py $(SRC_DIR)/include/magic.h
- $(E) " GEN " $@
+magic.py: $(SRC_DIR)/scripts/magic-gen.py $(SRC_DIR)/crtools/include/magic.h
+ $(call msg-gen, $@)
$(Q) python $^ $@
-pb.py: protobuf
+pb.py: images
$(Q) echo "# Autogenerated. Do not edit!" > $@
$(Q) for m in $(proto-py-modules); do \
echo "from $$m import *" >> $@ ;\
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
deleted file mode 100644
index ee0b800063e1..000000000000
--- a/scripts/Makefile.build
+++ /dev/null
@@ -1,251 +0,0 @@
-##
-## General helpers for simplified Makefiles.
-##
-MAKEFLAGS := -r -R --no-print-directory
-
-targets :=
-deps :=
-deps-after :=
-all-objs :=
-incdeps :=
-_all :=
-_cleanup-y :=
-
-include scripts/Makefile.rules
-include $(obj)/$(makefile)
-
-##
-## Append targets to be auto-cleanuped
-define add-cleanup-obj-c-by-name
-_cleanup-y+= $(1).o
-_cleanup-y+= $(1).i
-_cleanup-y+= $(1).d
-_cleanup-y+= $(1).s
-endef
-
-define add-cleanup-obj-S-by-name
-_cleanup-y+= $(1).o
-_cleanup-y+= $(1).d
-_cleanup-y+= $(1).i
-endef
-
-##
-##
-## Generate a bundle of rules for C files
-define gen-target-c-bundle
-$(eval $(call gen-rule-o-from-c-by-name,$(1),$(2),$(3)))
-$(eval $(call gen-rule-i-from-c-by-name,$(1),$(2),$(3)))
-$(eval $(call gen-rule-d-from-c-by-name,$(1),$(2),$(3)))
-$(eval $(call gen-rule-s-from-c-by-name,$(1),$(2),$(3)))
-$(eval $(call add-cleanup-obj-c-by-name,$(1)))
-endef
-
-##
-##
-## Generate a bundle of rules for S files
-define gen-target-S-bundle
-$(eval $(call gen-rule-o-from-S-by-name,$(1),$(2),$(3)))
-$(eval $(call gen-rule-d-from-S-by-name,$(1),$(2),$(3)))
-$(eval $(call gen-rule-i-from-S-by-name,$(1),$(2),$(3)))
-$(eval $(call add-cleanup-obj-S-by-name,$(1)))
-endef
-
-##
-##
-## Shared or standalone targets
-ifneq ($(obj-y),)
-obj-y := $(addprefix $(obj)/, $(obj-y))
-$(foreach file, \
- $(obj-y), \
- $(eval \
- $(call gen-target-c-bundle, \
- $(file:.o=),$(file:.o=))))
-all-objs += $(obj-y)
-deps += $(obj-y:.o=.d)
-endif
-
-ifneq ($(obj-x),)
-obj-x := $(addprefix $(obj)/, $(obj-x))
-obj-x := $(addsuffix $(xsuffix).o, $(obj-x:.o=))
-$(foreach file, \
- $(obj-x), \
- $(eval \
- $(call gen-target-c-bundle, \
- $(file:$(xsuffix).o=),$(file:.o=))))
-all-objs += $(obj-x)
-deps += $(obj-x:.o=.d)
-cleanup-y += $(obj-x) $(obj-x:.o=.d)
-endif
-
-ifneq ($(obj-e),)
-$(foreach file, \
- $(obj-e), \
- $(eval \
- $(call gen-target-c-bundle, \
- $(file:.o=),$(file:.o=))))
-all-objs += $(obj-e)
-deps += $(obj-e:.o=.d)
-endif
-
-ifneq ($(asm-y),)
-asm-y := $(addprefix $(obj)/, $(asm-y))
-$(foreach file, \
- $(asm-y), \
- $(eval \
- $(call gen-target-S-bundle, \
- $(file:.o=),$(file:.o=))))
-all-objs += $(asm-y)
-deps += $(asm-y:.o=.d)
-endif
-
-ifneq ($(asm-e),)
-$(foreach file, \
- $(asm-e), \
- $(eval \
- $(call gen-target-S-bundle, \
- $(file:.o=),$(file:.o=))))
-all-objs += $(asm-e)
-deps += $(asm-e:.o=.d)
-endif
-
-##
-##
-## Standalone files where sources are kept in external
-## directories. Usually needed when same source files
-## are compiled with different flags.
-ifneq ($(obj-ext-src-y),)
-__obj-ext-src-y := $(addprefix $(obj)/, $(notdir $(obj-ext-src-y)))
-$(foreach file, \
- $(obj-ext-src-y), \
- $(eval \
- $(call gen-target-c-bundle, \
- $(file:.o=), \
- $(addprefix $(obj)/,$(notdir $(file:.o=))))))
-all-objs += $(__obj-ext-src-y)
-deps += $(__obj-ext-src-y:.o=.d)
-cleanup-y += $(__obj-ext-src-y) $(__obj-ext-src-y:.o=.d)
-endif
-
-##
-##
-## Generate rules for a target
-define gen-target-rules
-
-$(1)-all-objs :=
-
-ifneq ($($(1)-obj-y),)
- $(foreach file, \
- $($(1)-obj-y), \
- $(eval \
- $(call gen-target-c-bundle, \
- $(obj)/$(file:.o=), \
- $(obj)/$(file:.o=), \
- $($(1)-obj-y-cflags))))
- $(1)-all-objs += $$(addprefix $(obj)/, $($(1)-obj-y))
- deps += $$(addprefix $(obj)/, $($(1)-obj-y:.o=.d))
-endif
-
-ifneq ($($(1)-obj-e),)
- $(foreach file, \
- $($(1)-obj-e), \
- $(eval \
- $(call gen-target-c-bundle, \
- $(file:.o=), \
- $(file:.o=), \
- $($(1)-obj-e-cflags))))
- $(1)-all-objs += $$($(1)-obj-e)
- deps += $$($(1)-obj-e:.o=.d)
-endif
-
-ifneq ($($(1)-asm-y),)
- $(foreach file, \
- $($(1)-asm-y), \
- $(eval \
- $(call gen-target-S-bundle, \
- $(obj)/$(file:.o=), \
- $(obj)/$(file:.o=), \
- $($(1)-asm-y-asmflags))))
- $(1)-all-objs += $$(addprefix $(obj)/, $($(1)-asm-y))
- deps += $$($(1)-asm-y:.o=.d)
-endif
-
-ifneq ($($(1)-asm-e),)
- $(foreach file, \
- $($(1)-asm-e), \
- $(eval \
- $(call gen-target-S-bundle, \
- $(file:.o=), \
- $(file:.o=), \
- $($(1)-asm-e-asmflags))))
- $(1)-all-objs += $$($(1)-asm-e)
- deps += $$($(1)-asm-e:.o=.d)
-endif
-
-$(1)-all-objs += $(all-objs)
-
-$$(obj)/$(1).built-in.o: $$($(1)-all-objs) $$($(1)-libs-e) $(libs-e)
- $$(E) " LINK " $$@
- $$(Q) $$(LD) $$(ldflags-y) -r -o $$@ $$^
-
-_all += $$(obj)/$(1).built-in.o
-cleanup-y += $$(obj)/$(1).built-in.o
-endef
-
-##
-##
-## Walk over all targets and generate rules they require
-$(foreach target, \
- $(targets), \
- $(eval \
- $(call gen-target-rules,$(target))))
-
-##
-##
-## No targets -- just builtin default one
-ifeq ($(targets),)
-ifneq ($(all-objs),)
-$(obj)/built-in.o: $(all-objs) $(libs-e)
- $(E) " LINK " $@
- $(Q) $(LD) $(ldflags-y) -r -o $@ $^
-
-_all += $(obj)/built-in.o
-cleanup-y += $(obj)/built-in.o
-endif
-endif
-
-##
-## A rule for building library.
-ifneq ($(lib-so),)
-$(obj)/$(lib-so).so: $(all-objs) $(libs-e)
- $(E) " LINK " $@
- $(Q) $(CC) -shared $(cflags-so) -o $@ $^ $(ldflags-so) $(LDFLAGS)
-
-_all += $(obj)/$(lib-so).so
-cleanup-y += $(obj)/$(lib-so).so
-endif
-
-##
-##
-## Include deps if requested
-ifneq ($(incdeps),)
-ifneq ($(deps-after),)
-$(deps): | $(deps-after)
-endif
--include $(deps)
-endif
-
-##
-##
-## Autocomplete cleanups
-cleanup-y += $(_cleanup-y)
-
-##
-## Predefined .PHONY targets
-.PHONY: all clean
-
-all: $(_all)
- @true
-
-clean:
- $(E) " CLEANUP " $(obj)
- $(Q) $(RM) $(cleanup-y)
diff --git a/scripts/Makefile.rules b/scripts/Makefile.rules
deleted file mode 100644
index 229131091e6f..000000000000
--- a/scripts/Makefile.rules
+++ /dev/null
@@ -1,52 +0,0 @@
-##
-##
-## These are per-file generators.
-##
-define gen-rule-o-from-c-by-name
-$(2).o: $(1).c
- $$(E) " CC " $$@
- $$(Q) $$(CC) -c $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
-endef
-
-define gen-rule-i-from-c-by-name
-$(2).i: $(1).c
- $$(E) " CC " $$@
- $$(Q) $$(CC) -E $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
-endef
-
-define gen-rule-s-from-c-by-name
-$(2).s: $(1).c
- $$(E) " CC " $$@
- $$(Q) $$(CC) -S $$(CFLAGS) $$(cflags-y) $(3) -fverbose-asm $$< -o $$@
-endef
-
-define gen-rule-o-from-S-by-name
-$(2).o: $(1).S
- $$(E) " CC " $$@
- $$(Q) $$(CC) -c $$(CFLAGS) $$(cflags-y) $(3) $$(ASMFLAGS) $(4) $$< -o $$@
-endef
-
-define gen-rule-d-from-c-by-name
-$(2).d: $(1).c
- $$(E) " DEP " $$@
- $$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
-endef
-
-define gen-rule-d-from-S-by-name
-$(2).d: $(1).S
- $$(E) " DEP " $$@
- $$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
-endef
-
-define gen-rule-i-from-S-by-name
-$(2).i: $(1).S
- $$(E) " CC " $$@
- $$(Q) $$(CC) -E $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
-endef
-
-##
-## In case if someone add last resort rule
-## together with .SUFFIXES not cleaned, this
-## will slow down the build procedure
-scripts/Makefile.rules::
- @true
--
2.5.0
More information about the CRIU
mailing list