License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2012-04-06 06:47:53 +08:00
|
|
|
# trace-cmd version
|
|
|
|
EP_VERSION = 1
|
|
|
|
EP_PATCHLEVEL = 1
|
|
|
|
EP_EXTRAVERSION = 0
|
|
|
|
|
|
|
|
# file format version
|
|
|
|
FILE_VERSION = 6
|
|
|
|
|
|
|
|
MAKEFLAGS += --no-print-directory
|
|
|
|
|
|
|
|
|
|
|
|
# Makefiles suck: This macro sets a default value of $(2) for the
|
|
|
|
# variable named by $(1), unless the variable has been set by
|
|
|
|
# environment or command line. This is necessary for CC and AR
|
|
|
|
# because make sets default values, so the simpler ?= approach
|
|
|
|
# won't work as expected.
|
|
|
|
define allow-override
|
|
|
|
$(if $(or $(findstring environment,$(origin $(1))),\
|
|
|
|
$(findstring command line,$(origin $(1)))),,\
|
|
|
|
$(eval $(1) = $(2)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
|
|
|
|
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
|
|
|
|
$(call allow-override,AR,$(CROSS_COMPILE)ar)
|
2015-05-28 21:28:54 +08:00
|
|
|
$(call allow-override,NM,$(CROSS_COMPILE)nm)
|
2018-11-30 23:44:05 +08:00
|
|
|
$(call allow-override,PKG_CONFIG,pkg-config)
|
2012-04-06 06:47:53 +08:00
|
|
|
|
|
|
|
EXT = -std=gnu99
|
|
|
|
INSTALL = install
|
|
|
|
|
|
|
|
# Use DESTDIR for installing into a different root directory.
|
|
|
|
# This is useful for building a package. The program will be
|
|
|
|
# installed in this directory as if it was the root directory.
|
|
|
|
# Then the build tool can move it later.
|
|
|
|
DESTDIR ?=
|
|
|
|
DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
|
|
|
|
|
2015-05-17 18:56:28 +08:00
|
|
|
LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
|
|
|
|
ifeq ($(LP64), 1)
|
|
|
|
libdir_relative = lib64
|
|
|
|
else
|
|
|
|
libdir_relative = lib
|
|
|
|
endif
|
|
|
|
|
2012-04-06 06:47:53 +08:00
|
|
|
prefix ?= /usr/local
|
2015-05-17 18:56:28 +08:00
|
|
|
libdir = $(prefix)/$(libdir_relative)
|
2012-04-06 06:47:53 +08:00
|
|
|
man_dir = $(prefix)/share/man
|
|
|
|
man_dir_SQ = '$(subst ','\'',$(man_dir))'
|
2018-11-30 23:44:05 +08:00
|
|
|
pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) \
|
|
|
|
--variable pc_path pkg-config | tr ":" " "))
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2013-06-04 13:20:16 +08:00
|
|
|
export man_dir man_dir_SQ INSTALL
|
2012-04-06 06:47:53 +08:00
|
|
|
export DESTDIR DESTDIR_SQ
|
|
|
|
|
2013-12-03 21:09:17 +08:00
|
|
|
set_plugin_dir := 1
|
|
|
|
|
|
|
|
# Set plugin_dir to preffered global plugin location
|
|
|
|
# If we install under $HOME directory we go under
|
|
|
|
# $(HOME)/.traceevent/plugins
|
|
|
|
#
|
|
|
|
# We dont set PLUGIN_DIR in case we install under $HOME
|
|
|
|
# directory, because by default the code looks under:
|
|
|
|
# $(HOME)/.traceevent/plugins by default.
|
|
|
|
#
|
|
|
|
ifeq ($(plugin_dir),)
|
|
|
|
ifeq ($(prefix),$(HOME))
|
|
|
|
override plugin_dir = $(HOME)/.traceevent/plugins
|
|
|
|
set_plugin_dir := 0
|
|
|
|
else
|
2015-05-17 18:56:28 +08:00
|
|
|
override plugin_dir = $(libdir)/traceevent/plugins
|
2013-12-03 21:09:17 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(set_plugin_dir),1)
|
2014-01-22 23:01:48 +08:00
|
|
|
PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
|
2013-12-03 21:09:17 +08:00
|
|
|
PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
|
|
|
|
endif
|
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
include ../../scripts/Makefile.include
|
2013-12-19 21:42:02 +08:00
|
|
|
|
2012-04-06 06:47:53 +08:00
|
|
|
# copy a bit from Linux kbuild
|
|
|
|
|
|
|
|
ifeq ("$(origin V)", "command line")
|
|
|
|
VERBOSE = $(V)
|
|
|
|
endif
|
|
|
|
ifndef VERBOSE
|
|
|
|
VERBOSE = 0
|
|
|
|
endif
|
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
ifeq ($(srctree),)
|
2016-11-22 16:30:26 +08:00
|
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
2015-01-08 01:39:45 +08:00
|
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
|
|
#$(info Determined 'srctree' to be $(srctree))
|
2012-04-06 06:47:53 +08:00
|
|
|
endif
|
|
|
|
|
2015-05-17 18:56:28 +08:00
|
|
|
export prefix libdir src obj
|
2012-04-06 06:47:53 +08:00
|
|
|
|
|
|
|
# Shell quotes
|
2015-05-17 18:56:28 +08:00
|
|
|
libdir_SQ = $(subst ','\'',$(libdir))
|
|
|
|
libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
|
2013-12-03 21:09:17 +08:00
|
|
|
plugin_dir_SQ = $(subst ','\'',$(plugin_dir))
|
2012-04-06 06:47:53 +08:00
|
|
|
|
|
|
|
CONFIG_INCLUDES =
|
|
|
|
CONFIG_LIBS =
|
|
|
|
CONFIG_FLAGS =
|
|
|
|
|
|
|
|
VERSION = $(EP_VERSION)
|
|
|
|
PATCHLEVEL = $(EP_PATCHLEVEL)
|
|
|
|
EXTRAVERSION = $(EP_EXTRAVERSION)
|
|
|
|
|
|
|
|
OBJ = $@
|
|
|
|
N =
|
|
|
|
|
|
|
|
EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION)
|
|
|
|
|
2016-07-31 22:52:34 +08:00
|
|
|
LIB_TARGET = libtraceevent.a libtraceevent.so.$(EVENT_PARSE_VERSION)
|
|
|
|
LIB_INSTALL = libtraceevent.a libtraceevent.so*
|
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
INCLUDES = -I. -I $(srctree)/tools/include $(CONFIG_INCLUDES)
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
# Set compile option CFLAGS
|
|
|
|
ifdef EXTRA_CFLAGS
|
|
|
|
CFLAGS := $(EXTRA_CFLAGS)
|
|
|
|
else
|
|
|
|
CFLAGS := -g -Wall
|
|
|
|
endif
|
2012-04-06 06:47:53 +08:00
|
|
|
|
|
|
|
# Append required CFLAGS
|
2015-01-08 01:39:45 +08:00
|
|
|
override CFLAGS += -fPIC
|
2012-04-06 06:47:53 +08:00
|
|
|
override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
|
2012-09-13 01:29:40 +08:00
|
|
|
override CFLAGS += $(udis86-flags) -D_GNU_SOURCE
|
2012-04-06 06:47:53 +08:00
|
|
|
|
|
|
|
ifeq ($(VERBOSE),1)
|
|
|
|
Q =
|
|
|
|
else
|
|
|
|
Q = @
|
|
|
|
endif
|
|
|
|
|
2017-03-10 08:16:33 +08:00
|
|
|
# Disable command line variables (CFLAGS) override from top
|
2015-01-08 01:39:45 +08:00
|
|
|
# level Makefile (perf), otherwise build Makefile will get
|
|
|
|
# the same command line setup.
|
|
|
|
MAKEOVERRIDES=
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
export srctree OUTPUT CC LD CFLAGS V
|
|
|
|
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
PLUGINS = plugin_jbd2.so
|
|
|
|
PLUGINS += plugin_hrtimer.so
|
|
|
|
PLUGINS += plugin_kmem.so
|
|
|
|
PLUGINS += plugin_kvm.so
|
|
|
|
PLUGINS += plugin_mac80211.so
|
|
|
|
PLUGINS += plugin_sched_switch.so
|
|
|
|
PLUGINS += plugin_function.so
|
|
|
|
PLUGINS += plugin_xen.so
|
|
|
|
PLUGINS += plugin_scsi.so
|
|
|
|
PLUGINS += plugin_cfg80211.so
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
PLUGINS := $(addprefix $(OUTPUT),$(PLUGINS))
|
|
|
|
PLUGINS_IN := $(PLUGINS:.so=-in.o)
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2016-08-01 15:55:51 +08:00
|
|
|
TE_IN := $(OUTPUT)libtraceevent-in.o
|
|
|
|
LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
|
2015-05-28 21:28:54 +08:00
|
|
|
DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2016-08-01 15:55:51 +08:00
|
|
|
CMD_TARGETS = $(LIB_TARGET) $(PLUGINS) $(DYNAMIC_LIST_FILE)
|
2012-04-06 06:47:53 +08:00
|
|
|
|
|
|
|
TARGETS = $(CMD_TARGETS)
|
|
|
|
|
|
|
|
all: all_cmd
|
|
|
|
|
|
|
|
all_cmd: $(CMD_TARGETS)
|
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
$(TE_IN): force
|
|
|
|
$(Q)$(MAKE) $(build)=libtraceevent
|
|
|
|
|
2016-07-31 22:52:34 +08:00
|
|
|
$(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
|
2018-12-12 17:12:14 +08:00
|
|
|
$(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
|
2016-07-31 22:52:34 +08:00
|
|
|
@ln -sf $(@F) $(OUTPUT)libtraceevent.so
|
|
|
|
@ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
$(OUTPUT)libtraceevent.a: $(TE_IN)
|
2013-12-19 21:42:04 +08:00
|
|
|
$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2015-05-28 21:28:54 +08:00
|
|
|
$(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS)
|
|
|
|
$(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@)
|
|
|
|
|
2013-12-03 21:09:17 +08:00
|
|
|
plugins: $(PLUGINS)
|
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
__plugin_obj = $(notdir $@)
|
|
|
|
plugin_obj = $(__plugin_obj:-in.o=)
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
$(PLUGINS_IN): force
|
|
|
|
$(Q)$(MAKE) $(build)=$(plugin_obj)
|
2013-12-03 21:09:17 +08:00
|
|
|
|
2015-01-08 01:39:45 +08:00
|
|
|
$(OUTPUT)%.so: $(OUTPUT)%-in.o
|
2018-12-12 17:12:14 +08:00
|
|
|
$(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^
|
2013-12-03 21:09:17 +08:00
|
|
|
|
2012-04-06 06:47:53 +08:00
|
|
|
define make_version.h
|
2014-01-02 17:53:04 +08:00
|
|
|
(echo '/* This file is automatically generated. Do not modify. */'; \
|
|
|
|
echo \#define VERSION_CODE $(shell \
|
|
|
|
expr $(VERSION) \* 256 + $(PATCHLEVEL)); \
|
|
|
|
echo '#define EXTRAVERSION ' $(EXTRAVERSION); \
|
|
|
|
echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"'; \
|
|
|
|
echo '#define FILE_VERSION '$(FILE_VERSION); \
|
|
|
|
) > $1
|
2012-04-06 06:47:53 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define update_version.h
|
2014-01-02 17:53:04 +08:00
|
|
|
($(call make_version.h, $@.tmp); \
|
|
|
|
if [ -r $@ ] && cmp -s $@ $@.tmp; then \
|
|
|
|
rm -f $@.tmp; \
|
|
|
|
else \
|
|
|
|
echo ' UPDATE $@'; \
|
|
|
|
mv -f $@.tmp $@; \
|
|
|
|
fi);
|
2012-04-06 06:47:53 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
ep_version.h: force
|
|
|
|
$(Q)$(N)$(call update_version.h)
|
|
|
|
|
|
|
|
VERSION_FILES = ep_version.h
|
|
|
|
|
|
|
|
define update_dir
|
2014-01-02 17:53:04 +08:00
|
|
|
(echo $1 > $@.tmp; \
|
|
|
|
if [ -r $@ ] && cmp -s $@ $@.tmp; then \
|
|
|
|
rm -f $@.tmp; \
|
|
|
|
else \
|
|
|
|
echo ' UPDATE $@'; \
|
|
|
|
mv -f $@.tmp $@; \
|
|
|
|
fi);
|
2012-04-06 06:47:53 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
tags: force
|
|
|
|
$(RM) tags
|
2012-06-22 16:10:14 +08:00
|
|
|
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
|
2018-08-09 02:02:58 +08:00
|
|
|
--regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
|
2012-04-06 06:47:53 +08:00
|
|
|
|
|
|
|
TAGS: force
|
|
|
|
$(RM) TAGS
|
2012-06-22 16:10:14 +08:00
|
|
|
find . -name '*.[ch]' | xargs etags \
|
2018-08-09 02:02:58 +08:00
|
|
|
--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2016-07-31 22:49:33 +08:00
|
|
|
define do_install_mkdir
|
|
|
|
if [ ! -d '$(DESTDIR_SQ)$1' ]; then \
|
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
2012-04-06 06:47:53 +08:00
|
|
|
define do_install
|
2016-07-31 22:49:33 +08:00
|
|
|
$(call do_install_mkdir,$2); \
|
2016-07-17 00:57:51 +08:00
|
|
|
$(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2'
|
2012-04-06 06:47:53 +08:00
|
|
|
endef
|
|
|
|
|
2013-12-19 21:42:05 +08:00
|
|
|
define do_install_plugins
|
|
|
|
for plugin in $1; do \
|
|
|
|
$(call do_install,$$plugin,$(plugin_dir_SQ)); \
|
|
|
|
done
|
|
|
|
endef
|
2013-12-03 21:09:17 +08:00
|
|
|
|
2015-05-28 21:28:54 +08:00
|
|
|
define do_generate_dynamic_list_file
|
2017-02-08 13:28:40 +08:00
|
|
|
symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \
|
|
|
|
xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\
|
|
|
|
if [ "$$symbol_type" = "U W w" ];then \
|
|
|
|
(echo '{'; \
|
|
|
|
$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
|
|
|
|
echo '};'; \
|
|
|
|
) > $2; \
|
|
|
|
else \
|
|
|
|
(echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\
|
|
|
|
fi
|
2015-05-28 21:28:54 +08:00
|
|
|
endef
|
|
|
|
|
2018-11-30 23:44:05 +08:00
|
|
|
PKG_CONFIG_FILE = libtraceevent.pc
|
|
|
|
define do_install_pkgconfig_file
|
|
|
|
if [ -n "${pkgconfig_dir}" ]; then \
|
|
|
|
cp -f ${PKG_CONFIG_FILE}.template ${PKG_CONFIG_FILE}; \
|
|
|
|
sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; \
|
|
|
|
sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \
|
|
|
|
$(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); \
|
|
|
|
else \
|
|
|
|
(echo Failed to locate pkg-config directory) 1>&2; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
2018-11-30 23:44:06 +08:00
|
|
|
install_lib: all_cmd install_plugins install_headers install_pkgconfig
|
2016-08-01 15:55:51 +08:00
|
|
|
$(call QUIET_INSTALL, $(LIB_TARGET)) \
|
2016-07-31 22:52:34 +08:00
|
|
|
$(call do_install_mkdir,$(libdir_SQ)); \
|
|
|
|
cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
|
2013-12-03 21:09:17 +08:00
|
|
|
|
2013-12-19 21:42:05 +08:00
|
|
|
install_plugins: $(PLUGINS)
|
|
|
|
$(call QUIET_INSTALL, trace_plugins) \
|
|
|
|
$(call do_install_plugins, $(PLUGINS))
|
2013-12-03 21:09:17 +08:00
|
|
|
|
2018-11-30 23:44:05 +08:00
|
|
|
install_pkgconfig:
|
|
|
|
$(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \
|
|
|
|
$(call do_install_pkgconfig_file,$(prefix))
|
|
|
|
|
2016-07-17 00:57:51 +08:00
|
|
|
install_headers:
|
|
|
|
$(call QUIET_INSTALL, headers) \
|
|
|
|
$(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \
|
|
|
|
$(call do_install,event-utils.h,$(prefix)/include/traceevent,644); \
|
2018-11-30 23:44:06 +08:00
|
|
|
$(call do_install,trace-seq.h,$(prefix)/include/traceevent,644); \
|
2016-07-17 00:57:51 +08:00
|
|
|
$(call do_install,kbuffer.h,$(prefix)/include/traceevent,644)
|
|
|
|
|
2012-04-06 06:47:53 +08:00
|
|
|
install: install_lib
|
|
|
|
|
|
|
|
clean:
|
2013-12-19 21:42:06 +08:00
|
|
|
$(call QUIET_CLEAN, libtraceevent) \
|
2018-11-30 23:44:05 +08:00
|
|
|
$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \
|
|
|
|
$(RM) TRACEEVENT-CFLAGS tags TAGS; \
|
|
|
|
$(RM) $(PKG_CONFIG_FILE)
|
2012-04-06 06:47:53 +08:00
|
|
|
|
2014-01-02 00:50:50 +08:00
|
|
|
PHONY += force plugins
|
2012-04-06 06:47:53 +08:00
|
|
|
force:
|
|
|
|
|
|
|
|
# Declare the contents of the .PHONY variable as phony. We keep that
|
|
|
|
# information in a variable so we can use it in if_changed and friends.
|
|
|
|
.PHONY: $(PHONY)
|