Makefile: fix libcriu.so links and man page installation

The links to the versioned libcriu.so.* included $(DESTDIR) and
$(LIBDIR) which will generate wrong links if building criu packages.
Now the links points to the correct file without any path.

For some reason criu.8 was installed with executable permission. Use
'install' with '-m 644' to make sure this does not happen.

Signed-off-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Make tpacket_req3 definition conditional

The makefile includes need to be moved for everything to be
defined properly when the configure tests run.

The Ubuntu 12.04 x86_64 GCC and Linaro's 13.08 and newer AArch64
GCC's have the if_packet.h kernel header, but as of 13.12,
the Linaro AArch32 GCC does not.

Change-Id: I363c43fdb81b028f99aac77e15bff9462c87af4b

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Fix library build

A user may have necessary linker directories specified in CFLAGS.
Make sure to include them.

Change-Id: I76c2a7bd6e34cc282bfcd5f83cc69ae7fa2c8cc2

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Always use ARCH_DIR

The top-level makefile defines an ARCH_DIR variable. Always use
it rather than referencing ARCH directly, since ARCH may be set
by the user on the command line and that raw input may not be
what needs to be used internally.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Use SRCARCH internally

ARCH is a user-facing variable and setting it on the command line
clobbers any manipulation attempted in the makefile. Following
the example of the Linux kernel makefiles, use a SRCARCH variable
instead for the internal, potentially fixed-up, architecture name.
This fixes the following error.

make ARCH=x86_64
Makefile:69: *** "The architecture x86_64 isn't supported".  Stop.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Complain about missing CONFIG_ARMV*

Without this a user may encounter the following error.

arch/arm/include/asm/atomic.h:38:2: error: implicit declaration of function ‘smp_mb’

With the #error pragma a user is a least pointed to the specific
section in the file that's causing the problem

arch/arm/include/asm/atomic.h:21:2: error: #error ARM architecture version (CONFIG_ARMV*) not set or unsupported.

Acked-by: Alexander Kartashov <alekskartashov@parallels.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Default to ARMv7

The current mechanism for determining ARM architecture version
breaks down when cross-compiling. Default to ARMv7 if the user
specifies ARCH=arm. Users wishing to cross-compile for ARMv6
platforms such as the Raspberry Pi should use ARCH=armv6 as
previously required.

Acked-by: Alexander Kartashov <alekskartashov@parallels.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Remove ARM AT_VECTOR_SIZE from x86 header

Perhaps left over from when a single types.h was being used for
multiple architectures, remove the ARM definition of
AT_VECTOR_SIZE from the x86 types.h header. Also remove the
CONFIG_ARM definition since it unused.

Acked-by: Alexander Kartashov <alekskartashov@parallels.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Allow for user CFLAGS

Ideally, a user could set CFLAGS on the command line to contain
compilation options and include and library paths (or maybe set
those last two with CPPFLAGS and LDFLAGS). Unfortunately, setting
CFLAGS on the command line currently short-circuits essential
logic in the makefile and breaks the build. After a first failed
attempt it appears that a monolithic overhaul or "flag day" to
fix this is a substantial undertaking, so for now just provide a
workaround in the form of a USERCFLAGS variable.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Make -march settings part of USERCFLAGS

The current -march settings will cause an error if the user a
conflicting flags such as -mcpu=cortex-a15. Use USERCFLAGS instead
of CFLAGS so that a default is provided but can be overridden.

Change-Id: I8ffecd6bfd7ad5794486a5d14d27bce3170898d3

Acked-by: Alexander Kartashov <alekskartashov@parallels.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Make sure sed fixups are carried out

The following issue is possibly caused by using busybox make.

protobuf/packet-sock.pb-c.c: In function 'packet_sock_entry__init':
protobuf/packet-sock.pb-c.c:98:3: error: this decimal constant is unsigned only in ISO C90 [-Werror]

Use a belt-and-suspenders approach to ensure it doesn't happen.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>