summaryrefslogtreecommitdiffstats
path: root/src/Makefile.housekeeping
diff options
context:
space:
mode:
authorMichael Brown2009-04-29 09:51:27 +0200
committerMichael Brown2009-05-18 09:29:24 +0200
commit41307f2874989048679c83686527a3887ed485b3 (patch)
tree24464edc273fd4f5dab7d8d4212d3c03fca38997 /src/Makefile.housekeeping
parent[legal] Add mechanism for explicit per-file licence declarations (diff)
downloadipxe-41307f2874989048679c83686527a3887ed485b3.tar.gz
ipxe-41307f2874989048679c83686527a3887ed485b3.tar.xz
ipxe-41307f2874989048679c83686527a3887ed485b3.zip
[legal] Add licence.pl and %.licence make target
It is now possible to run e.g. make bin/rtl8139.dsk.licence in order to see a licensing assessment for any given gPXE build. The assessment will either produce a single overall licence for the build (based on combining all the licences used within the source files for that build), or will exit with an error stating why a licence assessment is not possible (for example, if there are files involved that do not yet contain an explicit FILE_LICENCE() declaration).
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r--src/Makefile.housekeeping20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 45020179..e886c4b2 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -672,13 +672,31 @@ $(BIN)/%.deps : $(BIN)/%.tmp
# Get unneeded source files for the specified target
#
define nodeps_list
- $(sort $(filter-out $(call deps_list,$<),\
+ $(sort $(filter-out $(call deps_list,$(1)),\
$(foreach BOBJ,$(BOBJS),\
$($(basename $(notdir $(BOBJ)))_DEPS))))
endef
$(BIN)/%.nodeps : $(BIN)/%.tmp
$(Q)$(ECHO) $(call nodeps_list,$<)
+# Get licensing verdict for the specified target
+#
+define unlicensed_deps_list
+ $(shell grep -L FILE_LICENCE $(call deps_list,$(1)))
+endef
+define licence_list
+ $(patsubst __licence_%,%,\
+ $(filter __licence_%,$(shell $(NM) $(1) | cut -d" " -f3)))
+endef
+$(BIN)/%.licence : $(BIN)/%.tmp
+ $(QM)$(ECHO) " [LICENCE] $@"
+ $(Q)$(if $(strip $(call unlicensed_deps_list,$<)),\
+ echo -n "Unable to determine licence because the following " ;\
+ echo "files are missing a licence declaration:" ;\
+ echo $(call unlicensed_deps_list,$<);\
+ exit 1,\
+ $(LICENCE) $(call licence_list,$<))
+
# Extract compression information from intermediate object file
#
$(BIN)/%.zinfo : $(BIN)/%.tmp