2019-07-17 21:32:28 +03:00
i f n e q ( c l e a n , $( MAKECMDGOALS ) )
i f n e q ( d i s t c l e a n , $( MAKECMDGOALS ) )
2022-11-23 12:39:50 +07:00
i f e q ( , $( INCLUDED_FUNCTIONS_MK ) )
2019-07-18 19:03:09 +03:00
INCLUDED_FUNCTIONS_MK = 1
2011-10-06 11:46:31 +03:00
# globals
2016-04-07 17:04:49 +03:00
PKGDIR ?= $( GLOBAL_BUILDDIR) /pkg
2011-10-21 20:14:02 +04:00
2011-12-30 12:46:58 +02:00
# duplicated from metaprofile makefiles for the sake of "local" builds
2019-07-09 12:30:26 +03:00
ARCH ?= $( shell arch | sed 's/i686/i586/; s/armv.*/arm/' )
2011-10-06 11:46:31 +03:00
DATE ?= $( shell date +%Y%m%d)
2010-08-28 19:28:42 +03:00
2012-05-08 17:59:57 +03:00
# prefix pkglist name with its directory to form a path (relative/absolute)
image.in/functions.mk: protect the code from spontaneous execution
The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
expanding. So the functions fire spontaneously. The reason for recursive
expanding might be to use $(shell ...).
To protect the code from spontaneous execution, we add a match check
'$(0)' to the function name. The '$(0)' variable must always have the
name of our function at the time of the call. If this is not the case,
then we are out of the $(call ...) context.
From make documentation:
| The syntax of the 'call' function is:
|
| $(call VARIABLE,PARAM,PARAM,...)
|
| When 'make' expands this function, it assigns each PARAM to temporary
| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain
| VARIABLE.
Fix ALT bug 44561
See also:
https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
2022-12-22 00:58:17 +07:00
d e f i n e r l i s t
$(if $(filter rlist,$(0)),$(1 : %=lists /%))
e n d e f
d e f i n e l i s t
$( if $ ( filter list ,$ ( 0) ) ,$ ( addprefix $ ( PKGDIR ) /,$ ( call rlist ,$ ( 1) ) ) )
e n d e f
2010-08-28 19:28:42 +03:00
2012-05-08 17:59:57 +03:00
# prefix/suffix group name to form a path (relative/absolute)
image.in/functions.mk: protect the code from spontaneous execution
The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
expanding. So the functions fire spontaneously. The reason for recursive
expanding might be to use $(shell ...).
To protect the code from spontaneous execution, we add a match check
'$(0)' to the function name. The '$(0)' variable must always have the
name of our function at the time of the call. If this is not the case,
then we are out of the $(call ...) context.
From make documentation:
| The syntax of the 'call' function is:
|
| $(call VARIABLE,PARAM,PARAM,...)
|
| When 'make' expands this function, it assigns each PARAM to temporary
| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain
| VARIABLE.
Fix ALT bug 44561
See also:
https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
2022-12-22 00:58:17 +07:00
d e f i n e r g r o u p
$(if $(filter rgroup,$(0)),$(1 : %=groups /%.directory ))
e n d e f
d e f i n e g r o u p
$( if $ ( filter group ,$ ( 0) ) ,$ ( addprefix $ ( PKGDIR ) /,$ ( call rgroup ,$ ( 1) ) ) )
e n d e f
2010-10-29 12:11:03 +03:00
2016-03-25 13:49:13 +03:00
# prefix/suffix pkg profile name to form a path (relative/absolute)
image.in/functions.mk: protect the code from spontaneous execution
The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
expanding. So the functions fire spontaneously. The reason for recursive
expanding might be to use $(shell ...).
To protect the code from spontaneous execution, we add a match check
'$(0)' to the function name. The '$(0)' variable must always have the
name of our function at the time of the call. If this is not the case,
then we are out of the $(call ...) context.
From make documentation:
| The syntax of the 'call' function is:
|
| $(call VARIABLE,PARAM,PARAM,...)
|
| When 'make' expands this function, it assigns each PARAM to temporary
| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain
| VARIABLE.
Fix ALT bug 44561
See also:
https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
2022-12-22 00:58:17 +07:00
d e f i n e r p r o f i l e
$(if $(filter rprofile,$(0)),$(1 : %=profiles /%.directory ))
e n d e f
d e f i n e p r o f i l e
$( if $ ( filter profile ,$ ( 0) ) ,$ ( addprefix $ ( PKGDIR ) /,$ ( call rprofile ,$ ( 1) ) ) )
e n d e f
2016-03-25 13:49:13 +03:00
2010-10-29 12:11:03 +03:00
# map first argument (a function) onto second one (an argument list)
image.in/functions.mk: protect the code from spontaneous execution
The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
expanding. So the functions fire spontaneously. The reason for recursive
expanding might be to use $(shell ...).
To protect the code from spontaneous execution, we add a match check
'$(0)' to the function name. The '$(0)' variable must always have the
name of our function at the time of the call. If this is not the case,
then we are out of the $(call ...) context.
From make documentation:
| The syntax of the 'call' function is:
|
| $(call VARIABLE,PARAM,PARAM,...)
|
| When 'make' expands this function, it assigns each PARAM to temporary
| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain
| VARIABLE.
Fix ALT bug 44561
See also:
https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
2022-12-22 00:58:17 +07:00
d e f i n e m a p
$( if $ ( filter map ,$ ( 0) ) ,$ ( foreach a ,$ ( 2) ,$ ( call $ ( 1) ,$ ( a ) ) ) )
e n d e f
2010-10-29 12:11:03 +03:00
2016-04-07 17:04:49 +03:00
# happens at least twice, and variables are the same by design
image.in/functions.mk: protect the code from spontaneous execution
The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
expanding. So the functions fire spontaneously. The reason for recursive
expanding might be to use $(shell ...).
To protect the code from spontaneous execution, we add a match check
'$(0)' to the function name. The '$(0)' variable must always have the
name of our function at the time of the call. If this is not the case,
then we are out of the $(call ...) context.
From make documentation:
| The syntax of the 'call' function is:
|
| $(call VARIABLE,PARAM,PARAM,...)
|
| When 'make' expands this function, it assigns each PARAM to temporary
| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain
| VARIABLE.
Fix ALT bug 44561
See also:
https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
2022-12-22 00:58:17 +07:00
d e f i n e g r o u p s 2 l i s t s
$( if $ ( filter groups 2lists ,$ ( 0) ) ,$ ( shell \
if [ -n " $( THE_GROUPS) $( MAIN_GROUPS) " ] ; then \
sed -rn 's,^X-Alterator-PackageList=(.*)$$,\1,p' \
$( call map,group,$( THE_GROUPS) $( MAIN_GROUPS) ) | \
sed 's/;/\n/g' ; \
fi ; \
) )
2016-04-07 17:04:49 +03:00
e n d e f
2024-08-02 14:21:09 +03:00
d e f i n e l i v e _ g r o u p s 2 l i s t s
$( if $ ( filter live_groups 2lists ,$ ( 0) ) ,$ ( shell \
if [ -n " $( THE_GROUPS) $( LIVE_GROUPS) " ] ; then \
sed -rn 's,^X-Alterator-PackageList=(.*)$$,\1,p' \
$( call map,group,$( THE_GROUPS) $( LIVE_GROUPS) ) | \
sed 's/;/\n/g' ; \
fi ; \
) )
e n d e f
2010-10-29 12:11:03 +03:00
# kernel package list generation; see also #24669
NULL :=
SPACE := $( NULL) # the officially documented way of getting a space
2012-05-21 17:33:39 +03:00
COMMA := ,
2011-10-06 11:46:31 +03:00
image.in/functions.mk: protect the code from spontaneous execution
The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
expanding. So the functions fire spontaneously. The reason for recursive
expanding might be to use $(shell ...).
To protect the code from spontaneous execution, we add a match check
'$(0)' to the function name. The '$(0)' variable must always have the
name of our function at the time of the call. If this is not the case,
then we are out of the $(call ...) context.
From make documentation:
| The syntax of the 'call' function is:
|
| $(call VARIABLE,PARAM,PARAM,...)
|
| When 'make' expands this function, it assigns each PARAM to temporary
| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain
| VARIABLE.
Fix ALT bug 44561
See also:
https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
2022-12-22 00:58:17 +07:00
d e f i n e l i s t 2 r e
$( if $ ( filter list 2re ,$ ( 0) ) ,$ ( subst $ ( SPACE ) ,|,$ ( strip $ ( 1) ) ) )
e n d e f
2012-04-25 14:18:23 +03:00
2014-09-18 20:08:08 +04:00
# args: KFLAVOURS, KMODULES
# NB: $(2) could be empty
image.in/functions.mk: protect the code from spontaneous execution
The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
expanding. So the functions fire spontaneously. The reason for recursive
expanding might be to use $(shell ...).
To protect the code from spontaneous execution, we add a match check
'$(0)' to the function name. The '$(0)' variable must always have the
name of our function at the time of the call. If this is not the case,
then we are out of the $(call ...) context.
From make documentation:
| The syntax of the 'call' function is:
|
| $(call VARIABLE,PARAM,PARAM,...)
|
| When 'make' expands this function, it assigns each PARAM to temporary
| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain
| VARIABLE.
Fix ALT bug 44561
See also:
https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
2022-12-22 00:58:17 +07:00
d e f i n e k p a c k a g e s
$( if $ ( filter kpackages ,$ ( 0) ) ,$ ( and $ ( 1) , \
^kernel-( image| modules-( $( call list2re,$( 2) ) ) ) -( $( call list2re,$( 1) ) ) $$ ) )
e n d e f
2012-04-25 14:18:23 +03:00
# arg: branding subpackages
image.in/functions.mk: protect the code from spontaneous execution
The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
expanding. So the functions fire spontaneously. The reason for recursive
expanding might be to use $(shell ...).
To protect the code from spontaneous execution, we add a match check
'$(0)' to the function name. The '$(0)' variable must always have the
name of our function at the time of the call. If this is not the case,
then we are out of the $(call ...) context.
From make documentation:
| The syntax of the 'call' function is:
|
| $(call VARIABLE,PARAM,PARAM,...)
|
| When 'make' expands this function, it assigns each PARAM to temporary
| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain
| VARIABLE.
Fix ALT bug 44561
See also:
https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
2022-12-22 00:58:17 +07:00
d e f i n e b r a n d i n g
$( if $ ( filter branding ,$ ( 0) ) ,$ ( and $ ( 1) ,^branding -$ ( BRANDING ) -( $ ( call list 2re ,$ ( 1) ) ) $ $ ) )
e n d e f
2019-07-17 21:32:28 +03:00
e n d i f
e n d i f
2019-07-18 19:03:09 +03:00
e n d i f