# Get licensing verdict for the specified target
#
define licensable_deps_list
- $(filter-out config/local/%.h,$(call deps_list,$(1)))
+ $(filter-out config/local/%.h,\
+ $(filter-out $(BIN)/.%.list,\
+ $(call deps_list,$(1))))
endef
define unlicensed_deps_list
$(shell grep -L FILE_LICENCE $(call licensable_deps_list,$(1)))
endef
define licence_list
- $(patsubst __licence_%,%,\
- $(filter __licence_%,$(shell $(NM) $(1) | cut -d" " -f3)))
+ $(sort $(foreach LICENCE,\
+ $(filter __licence__%,$(shell $(NM) $(1) | cut -d" " -f3)),\
+ $(word 2,$(subst __, ,$(LICENCE)))))
endef
+$(BIN)/%.licence_list : $(BIN)/%.tmp
+ $(Q)$(ECHO) $(call licence_list,$<)
$(BIN)/%.licence : $(BIN)/%.tmp
$(QM)$(ECHO) " [LICENCE] $@"
$(Q)$(if $(strip $(call unlicensed_deps_list,$<)),\
/** Provide a symbol within this object file */
#ifdef ASSEMBLY
#define PROVIDE_SYMBOL( _sym ) \
+ .section ".provided", "a", @nobits ; \
+ .hidden _sym ; \
.globl _sym ; \
- .comm _sym, 0
+ _sym: ; \
+ .previous
#else /* ASSEMBLY */
#define PROVIDE_SYMBOL( _sym ) \
- extern char _sym[]; \
- char _sym[0]
+ char _sym[0] \
+ __attribute__ (( section ( ".provided" ) ))
#endif /* ASSEMBLY */
/** Require a symbol within this object file
* be in the public domain.
*/
#define FILE_LICENCE_PUBLIC_DOMAIN \
- PROVIDE_SYMBOL ( __licence_public_domain )
+ PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__public_domain__ ) )
/** Declare a file as being under version 2 (or later) of the GNU GPL
*
* (at your option) any later version".
*/
#define FILE_LICENCE_GPL2_OR_LATER \
- PROVIDE_SYMBOL ( __licence_gpl2_or_later )
+ PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl2_or_later__ ) )
/** Declare a file as being under version 2 of the GNU GPL
*
* "or, at your option, any later version" clause.
*/
#define FILE_LICENCE_GPL2_ONLY \
- PROVIDE_SYMBOL ( __licence_gpl2_only )
+ PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl2_only__ ) )
/** Declare a file as being under any version of the GNU GPL
*
* version ever published by the Free Software Foundation".
*/
#define FILE_LICENCE_GPL_ANY \
- PROVIDE_SYMBOL ( __licence_gpl_any )
+ PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl_any__ ) )
/** Declare a file as being under the three-clause BSD licence
*
* functionally equivalent to the standard three-clause BSD licence.
*/
#define FILE_LICENCE_BSD3 \
- PROVIDE_SYMBOL ( __licence_bsd3 )
+ PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__bsd3__ ) )
/** Declare a file as being under the two-clause BSD licence
*
* functionally equivalent to the standard two-clause BSD licence.
*/
#define FILE_LICENCE_BSD2 \
- PROVIDE_SYMBOL ( __licence_bsd2 )
+ PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__bsd2__ ) )
/** Declare a file as being under the one-clause MIT-style licence
*
* permission notice appear in all copies.
*/
#define FILE_LICENCE_MIT \
- PROVIDE_SYMBOL ( __licence_mit )
+ PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__mit__ ) )
/** Declare a particular licence as applying to a file */
#define FILE_LICENCE( _licence ) FILE_LICENCE_ ## _licence