2015-03-01 23:19:44 +03:00
f e a t u r e _ d i r : = $ ( s r c t r e e ) / t o o l s / b u i l d / f e a t u r e
2015-03-01 23:12:25 +03:00
2015-03-01 23:04:01 +03:00
i f n e q ( $ ( O U T P U T ) , )
2015-03-01 23:19:44 +03:00
O U T P U T _ F E A T U R E S = $ ( O U T P U T ) f e a t u r e /
2015-03-01 23:04:01 +03:00
$ ( s h e l l m k d i r - p $ ( O U T P U T _ F E A T U R E S ) )
e n d i f
f e a t u r e _ c h e c k = $ ( e v a l $ ( f e a t u r e _ c h e c k _ c o d e ) )
d e f i n e f e a t u r e _ c h e c k _ c o d e
2015-12-15 18:39:32 +03:00
f e a t u r e - $ ( 1 ) : = $ ( s h e l l $ ( M A K E ) O U T P U T = $ ( O U T P U T _ F E A T U R E S ) C F L A G S = " $ ( E X T R A _ C F L A G S ) $ ( F E A T U R E _ C H E C K _ C F L A G S - $ ( 1 ) ) " L D F L A G S = " $ ( L D F L A G S ) $ ( F E A T U R E _ C H E C K _ L D F L A G S - $ ( 1 ) ) " - C $ ( f e a t u r e _ d i r ) $ ( O U T P U T _ F E A T U R E S ) t e s t - $ 1. b i n > / d e v / n u l l 2 > / d e v / n u l l & & e c h o 1 | | e c h o 0 )
2015-03-01 23:04:01 +03:00
e n d e f
f e a t u r e _ s e t = $ ( e v a l $ ( f e a t u r e _ s e t _ c o d e ) )
d e f i n e f e a t u r e _ s e t _ c o d e
f e a t u r e - $ ( 1 ) : = 1
e n d e f
#
# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output:
#
#
# Note that this is not a complete list of all feature tests, just
# those that are typically built on a fully configured system.
#
# [ Feature tests not mentioned here have to be built explicitly in
# the rule that uses them - an example for that is the 'bionic'
# feature check. ]
#
2016-01-25 12:55:50 +03:00
F E A T U R E _ T E S T S _ B A S I C : = \
2015-03-01 23:04:01 +03:00
b a c k t r a c e \
d w a r f \
f o r t i f y - s o u r c e \
s y n c - c o m p a r e - a n d - s w a p \
g l i b c \
g t k 2 \
g t k 2 - i n f o b a r \
l i b a u d i t \
l i b b f d \
l i b e l f \
l i b e l f - g e t p h d r n u m \
l i b e l f - m m a p \
l i b n u m a \
2015-09-17 18:20:28 +03:00
n u m a _ n u m _ p o s s i b l e _ c p u s \
2015-03-01 23:04:01 +03:00
l i b p e r l \
l i b p y t h o n \
l i b p y t h o n - v e r s i o n \
l i b s l a n g \
l i b u n w i n d \
p t h r e a d - a t t r - s e t a f f i n i t y - n p \
s t a c k p r o t e c t o r - a l l \
t i m e r f d \
l i b d w - d w a r f - u n w i n d \
2015-03-04 13:35:47 +03:00
z l i b \
2015-09-17 18:54:30 +03:00
l z m a \
2015-10-14 15:41:12 +03:00
g e t _ c p u i d \
b p f
2015-03-01 23:04:01 +03:00
2016-01-25 12:55:50 +03:00
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
# of all feature tests
F E A T U R E _ T E S T S _ E X T R A : = \
b i o n i c \
c o m p i l e - 32 \
c o m p i l e - x 32 \
c p l u s - d e m a n g l e \
h e l l o \
l i b b a b e l t r a c e \
l i b e r t y \
l i b e r t y - z \
l i b u n w i n d - d e b u g - f r a m e
F E A T U R E _ T E S T S ? = $ ( F E A T U R E _ T E S T S _ B A S I C )
i f e q ( $ ( F E A T U R E _ T E S T S ) , a l l )
F E A T U R E _ T E S T S : = $ ( F E A T U R E _ T E S T S _ B A S I C ) $ ( F E A T U R E _ T E S T S _ E X T R A )
e n d i f
2015-05-17 13:56:29 +03:00
F E A T U R E _ D I S P L A Y ? = \
2015-03-01 23:04:01 +03:00
d w a r f \
g l i b c \
g t k 2 \
l i b a u d i t \
l i b b f d \
l i b e l f \
l i b n u m a \
2015-09-17 18:20:28 +03:00
n u m a _ n u m _ p o s s i b l e _ c p u s \
2015-03-01 23:04:01 +03:00
l i b p e r l \
l i b p y t h o n \
l i b s l a n g \
l i b u n w i n d \
l i b d w - d w a r f - u n w i n d \
2015-03-04 13:35:47 +03:00
z l i b \
2015-09-17 18:54:30 +03:00
l z m a \
2015-10-14 15:41:12 +03:00
g e t _ c p u i d \
b p f
2015-03-01 23:04:01 +03:00
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
# If in the future we need per-feature checks/flags for features not
# mentioned in this list we need to refactor this ;-).
s e t _ t e s t _ a l l _ f l a g s = $ ( e v a l $ ( s e t _ t e s t _ a l l _ f l a g s _ c o d e ) )
d e f i n e s e t _ t e s t _ a l l _ f l a g s _ c o d e
F E A T U R E _ C H E C K _ C F L A G S - a l l + = $ ( F E A T U R E _ C H E C K _ C F L A G S - $ ( 1 ) )
F E A T U R E _ C H E C K _ L D F L A G S - a l l + = $ ( F E A T U R E _ C H E C K _ L D F L A G S - $ ( 1 ) )
e n d e f
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( c a l l s e t _ t e s t _ a l l _ f l a g s , $ ( f e a t ) ) )
#
# Special fast-path for the 'all features are available' case:
#
$ ( c a l l f e a t u r e _ c h e c k , a l l , $ ( M S G ) )
#
# Just in case the build freshly failed, make sure we print the
# feature matrix:
#
i f e q ( $ ( f e a t u r e - a l l ) , 1 )
#
# test-all.c passed - just set all the core feature flags to 1:
#
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( c a l l f e a t u r e _ s e t , $ ( f e a t ) ) )
e l s e
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( c a l l f e a t u r e _ c h e c k , $ ( f e a t ) ) )
e n d i f
#
# Print the result of the feature test:
#
f e a t u r e _ p r i n t _ s t a t u s = $ ( e v a l $ ( f e a t u r e _ p r i n t _ s t a t u s _ c o d e ) ) $ ( i n f o $ ( M S G ) )
d e f i n e f e a t u r e _ p r i n t _ s t a t u s _ c o d e
i f e q ( $ ( f e a t u r e - $ ( 1 ) ) , 1 )
M S G = $ ( s h e l l p r i n t f ' . . . % 30 s : [ \ 033 [ 32 m o n \ 033 [ m ] ' $ ( 1 ) )
e l s e
M S G = $ ( s h e l l p r i n t f ' . . . % 30 s : [ \ 033 [ 31 m O F F \ 033 [ m ] ' $ ( 1 ) )
e n d i f
e n d e f
f e a t u r e _ p r i n t _ t e x t = $ ( e v a l $ ( f e a t u r e _ p r i n t _ t e x t _ c o d e ) ) $ ( i n f o $ ( M S G ) )
d e f i n e f e a t u r e _ p r i n t _ t e x t _ c o d e
M S G = $ ( s h e l l p r i n t f ' . . . % 30 s : % s ' $ ( 1 ) $ ( 2 ) )
e n d e f
2015-12-23 20:58:32 +03:00
#
# generates feature value assignment for name, like:
# $(call feature_assign,dwarf) == feature-dwarf=1
#
f e a t u r e _ a s s i g n = f e a t u r e - $ ( 1 ) = $ ( f e a t u r e - $ ( 1 ) )
2015-09-21 18:24:47 +03:00
F E A T U R E _ D U M P _ F I L E N A M E = $ ( O U T P U T ) F E A T U R E - D U M P $ ( F E A T U R E _ U S E R )
2015-12-23 20:58:33 +03:00
F E A T U R E _ D U M P : = $ ( s h e l l t o u c h $ ( F E A T U R E _ D U M P _ F I L E N A M E ) ; c a t $ ( F E A T U R E _ D U M P _ F I L E N A M E ) )
f e a t u r e _ d u m p _ c h e c k = $ ( e v a l $ ( f e a t u r e _ d u m p _ c h e c k _ c o d e ) )
d e f i n e f e a t u r e _ d u m p _ c h e c k _ c o d e
i f e q ( $ ( f i n d s t r i n g $ ( 1 ) , $ ( F E A T U R E _ D U M P ) ) , )
$ ( 2 ) : = 1
e n d i f
e n d e f
#
# First check if any test from FEATURE_DISPLAY
# and set feature_display := 1 if it does
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ D I S P L A Y ) , $ ( c a l l f e a t u r e _ d u m p _ c h e c k , $ ( c a l l f e a t u r e _ a s s i g n , $ ( f e a t ) ) , f e a t u r e _ d i s p l a y ) )
#
# Now also check if any other test changed,
# so we force FEATURE-DUMP generation
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( c a l l f e a t u r e _ d u m p _ c h e c k , $ ( c a l l f e a t u r e _ a s s i g n , $ ( f e a t ) ) , f e a t u r e _ d u m p _ c h a n g e d ) )
2015-03-01 23:04:01 +03:00
# The $(feature_display) controls the default detection message
# output. It's set if:
# - detected features differes from stored features from
2015-09-21 18:24:47 +03:00
# last build (in $(FEATURE_DUMP_FILENAME) file)
2015-03-01 23:04:01 +03:00
# - one of the $(FEATURE_DISPLAY) is not detected
# - VF is enabled
2015-12-23 20:58:33 +03:00
i f e q ( $ ( f e a t u r e _ d u m p _ c h a n g e d ) , 1 )
$ ( s h e l l r m - f $ ( F E A T U R E _ D U M P _ F I L E N A M E ) )
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( s h e l l e c h o " $ ( c a l l f e a t u r e _ a s s i g n , $ ( f e a t ) ) " > > $ ( F E A T U R E _ D U M P _ F I L E N A M E ) ) )
2015-03-01 23:04:01 +03:00
e n d i f
2015-09-21 17:49:51 +03:00
f e a t u r e _ d i s p l a y _ c h e c k = $ ( e v a l $ ( f e a t u r e _ c h e c k _ d i s p l a y _ c o d e ) )
2015-12-23 20:58:30 +03:00
d e f i n e f e a t u r e _ c h e c k _ d i s p l a y _ c o d e
2015-03-01 23:04:01 +03:00
i f n e q ( $ ( f e a t u r e - $ ( 1 ) ) , 1 )
f e a t u r e _ d i s p l a y : = 1
e n d i f
e n d e f
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ D I S P L A Y ) , $ ( c a l l f e a t u r e _ d i s p l a y _ c h e c k , $ ( f e a t ) ) )
i f e q ( $ ( V F ) , 1 )
f e a t u r e _ d i s p l a y : = 1
f e a t u r e _ v e r b o s e : = 1
e n d i f
i f e q ( $ ( f e a t u r e _ d i s p l a y ) , 1 )
$ ( i n f o )
$ ( i n f o A u t o - d e t e c t i n g s y s t e m f e a t u r e s : )
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ D I S P L A Y ) , $ ( c a l l f e a t u r e _ p r i n t _ s t a t u s , $ ( f e a t ) , ) )
i f n e q ( $ ( f e a t u r e _ v e r b o s e ) , 1 )
$ ( i n f o )
e n d i f
e n d i f
i f e q ( $ ( f e a t u r e _ v e r b o s e ) , 1 )
T M P : = $ ( f i l t e r - o u t $ ( F E A T U R E _ D I S P L A Y ) , $ ( F E A T U R E _ T E S T S ) )
$ ( f o r e a c h f e a t , $ ( T M P ) , $ ( c a l l f e a t u r e _ p r i n t _ s t a t u s , $ ( f e a t ) , ) )
$ ( i n f o )
e n d i f