2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 04:48:16 +00:00

35 Commits

Author SHA1 Message Date
Cyrill Gorcunov
7b8b418edf build: nmk -- Filter out -Wl flags from linking builtin targets
Tycho reported that Debian uses custom LDFLAGS to
build criu, this flag get propagated into built-in
targets where we use $(LD) instead causing build
procedure to interrupt

|  LINK     arch/x86/syscalls.built-in.o
| ld: unrecognized option '-Wl,-Bsymbolic-functions'
| ld: use the --help option for usage information
| /«PKGBUILDDIR»/scripts/nmk/scripts/build.mk:141: recipe for target 'arch/x86/syscalls.built-in.o' failed

Lets make maintainers life easier and filter
out the flags we know never accepted by $(LD).

Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-21 11:17:31 +03:00
Kir Kolyshkin
67388c2455 build system: make CC/LD derive from HOSTCC/HOSTLD
1. Move HOSTCC/HOSTLD to nmk (note there are rules in nmk
   that make use of these variables already)

2. Make CC/LD derive from HOSTCC/HOSTLD

Note that one can still change anything from the command line.

travis-ci: success for build system: make CC/LD derive from HOSTCC/HOSTLD
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 01:32:55 +03:00
Cyrill Gorcunov
4b0bbb3da9 nmk: built.mk -- Add missing space
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Savonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-10-10 12:48:19 +03:00
Kir Kolyshkin
25a1acd8cc nmk/script: rm bad code
I discovered that the scripts/ suffix is added to __nmk_dir despite
the fact it already contains it, ending in obviously wrong filenames
like scripts/nmk/scripts/scripts/msg.mk. As those files are non-existent,
make tried to recreate every .mk file, spawninga child to execute 'true'
command, like this (part of "make -dr" output):

> Considering target file '../scripts/nmk/scripts/scripts/include.mk'.
>  File '../scripts/nmk/scripts/scripts/include.mk' does not exist.
>  Finished prerequisites of target file
> '../scripts/nmk/scripts/scripts/include.mk'.
> Must remake target '../scripts/nmk/scripts/scripts/include.mk'.
> Putting child 0x564ec1768740 (../scripts/nmk/scripts/scripts/include.mk)
> PID 21633 on the chain.
> Live child 0x564ec1768740 (../scripts/nmk/scripts/scripts/include.mk)
> PID 21633
> Reaping winning child 0x564ec1768740 PID 21633
> Removing child 0x564ec1768740 PID 21633 from chain.

The fix was to remove the extra scripts/, but once I did it, I found
out problem #2: these targets, being defined in contents that is often
included in the beginning of Makefiles, hijacks the default make
target (the first one in the Makefile), breaking the usual and
expected make behavior, and forcing to use .DEFAULT_GOAL.

Finally, I don't know why these targets are there, i.e. what purpose
do they serve. Maybe it was done to exclude any implicit rules to
re-make those files, but there are no such rules as far as I can see.

So, in order to address problem #2, I have removed these targets.
I don't see any harm in doing that; let me know if it breaks anything.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-10-05 13:11:26 +03:00
Dmitry Safonov
34996312c2 build/nmk: simplify try-cc and return true/false
- simplify: don't use temporary file -- use /dev/null instead
- return 'true' or 'false' -- this way we can use it inside rules
without external call to bash to compare return with 'y', see
the next patch for a use case.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-11 16:18:43 +03:00
Dmitry Safonov
3693c5e6f9 build/nmk: declare build-as as a recursive
So, how it was working:
1. build-as was declared with $$(1) and $$(2) which were expanded
on entering the submake;
2. function $(call build-as,...) performed the second expansion of
build-as.

Cons: build-as works only in sub-makefile, no sub-sub-makefile, no
upper/top makefile.

Simplify this by single $(1).
Then build-as variable will be used _only_ in makefile, not in
sub-makefiles.

This is for now fine, as each file, that calls $(MAKE) with
$(build)=dir or $(call build-as,makefile,dir) will include main.mk
from NMK, which has build-as definition (from include.mk).

In the future, we'll get rid of $(build) and $(build-as) workarounds
as finally switch to building from a global makefile.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 18:38:35 +03:00
Cyrill Gorcunov
6094b643dc nmk: build.mk -- Add @libso-y helper
To link dynamic libs (libcompel for example).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:31 +03:00
Cyrill Gorcunov
4a19618ea2 nmk: build.mk -- Add @hostprogs-y mode
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
e4e2f19d85 nmk: msg.mk -- Add host- messages
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
1693e539d5 nmk: build.mk -- Shrink gen-cc-rules
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cfc37c119c nmk: build.mk -- Drop any-match rule
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cb32e353bb nmk: build.mk -- Fix deps for target mode
Don't forget to call objectify.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cd5f7df520 nmk: build.mk -- Squash gen-rule-x into gen-cc-rules
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
0d1eac7ed4 nmk: Drop rules.mk
No much point in carrying it in a separate file.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
580ca3dd68 nmk: rules.mk -- Fix AFLAGS typo
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
06cc12a275 nmk: build.mk -- Fix ar rule for external libs
A typo.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
8994edebe1 nmk: build.mk -- Make process depend on Makefile itself
If makefile is changed itself we've been not detecting it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
4527341928 nmk: build.mk -- On cleanup use cleanup-y only
With cleanify helper we remove only they files
we've been generating, not anything else.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
b07d304905 nmk: utils.mk -- Add cleanify helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
6efe63109c nmk: utils.mk -- Drop redundant spaces
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
95f3f22e6e nmk: build.mk -- Fix typo in gen-ar-target-rule
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Cyrill Gorcunov
7beccce4b4 nmk: rules.mk -- Add per-obj flags
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Cyrill Gorcunov
c0ba98fd30 nmk: build.mk -- Drop unused objlist target
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Cyrill Gorcunov
f4ac56c0dd nmk: rules.mk -- Drop @CFLAGS_ and @ASFLAGS_ but add ability to bring them via param
Both never worked, we need to pass them as explicit parameter.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Dmitry Safonov
19bd013a1e build/nmk: add mrproper-y
This will separate clean process on two parts:
- deleting binaries/objects/temp
- deleting generated files

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Cyrill Gorcunov
3ddf271a5b nmk: scritps/macro.mk -- Enhance gen-built-in
Add ability to specify prerequsites and phony targets.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-23 13:10:45 +03:00
Kir Kolyshkin
eac393431e nmk: remove no-print-directory from MAKEFLAGS
The problem with --no-print-directory set by default is when we
run :make from vim and compilation performed by a sub-make fails,
vim can't figure out the correct path to a file with error, so
instead of jumping to the position of the first error, it opens
a new empty file.

When make prints "Entering directory ..." and "Leaving directory ..."
messages, vim :make works as intended.

[Alternatively, we could add -w to $(MAKE) invocations where needed,
but the problem is --no-print-directory overrides -w even if -w comes
later in the options list, so -w is not working. I was also thinking
about detecting whether we are running from vim, but when we'll need
to add detection for emacs etc., so let's keep things simple.]

Cc: Andrey Vagin <avagin@openvz.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-26 14:57:44 +03:00
Kir Kolyshkin
60404df396 nmk: don't use the FORCE, Luke!
With GNU make, using .PHONY leads to the same result as using
the "FORCE" hack, but unlike FORCE is not a hack. Since we do not
plan to use any other make implementation than GNU make, let's not
provide FORCE in nmk.

For more details about why PHONY is better than FORCE, see
http://www.gnu.org/software/make/manual/make.html#index-FORCE

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 23:48:25 +03:00
Laurent Dufour
581c3f1145 nmk: add cscope, etags and ctags wrappers
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 23:25:40 +03:00
Laurent Dufour
64144b92d5 nmk: Use ppc64 for PowerPC 64 bits architecture
This is usual to reference PowerPC 64 bits architectures as 'ppc64',
and let 'powerpc' define PowerPC 32 bits ones.

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 23:15:45 +03:00
Dmitry Safonov
efe35aa39f build/nmk: rename $@-ldflags-y to LDFLAGS_$@
That will complement existing CFLAGS_ and ASFLAGS_.
As no one use it yet (I will use it, do not remove) - no need
for convert-everything patch.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:12:19 +03:00
Dmitry Safonov
e85638fd38 build/nmk: define map and newline
map is very good at generating rules.
Just map gen function to array of it's parameters.
Don't forget to eval the result.

I'll use it in feature-tests generation and in someday coming
compat 32-bit mode - in x86 makefiles.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:38:26 +03:00
Dmitry Safonov
5f6c2eb92c nmk/build: separate msg-* printing from .mk files
Some places in criu need printing support, but do not need
common variables redefining, therefore separate msg printing
to msg.mk

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:12:10 +03:00
Pavel Emelyanov
64cce1ccba nmk: Define FIND variable
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-16 10:43:18 +03:00
Cyrill Gorcunov
d7016f1475 build: nmk -- Initial import
This is initial import of NMK engine which we gonna use for
CRIU and related tools building.

It's very tiny and while here we merge it as is in future
it gonna be rather a submodule from

	https://github.com/cyrillos/nmk

An idea is to have unified build engine for most tools
we're gonna use.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-15 15:32:20 +03:00