From: gatieme <gati...@163.com>

There are several issues when building plugin_traceevent.

First, We can specify a directory compiled by OUTPUT,
but make clean ignores this and uses the current directory.

Second, It generate a dynamic link library
libtraceevent.so.$(EP_VERSION) with the version
number as a suffix, but it can't clean by the clean rules.

Finaly, The locale specified by the environment affects sort order.

$export LC_ALL=C
$echo "U w W" | tr ' ' '\n' | sort -u

        U W w

$export LC_ALL="en_US.UTF-8"
$echo "U w W" | tr ' ' '\n' | sort -u

        U w W

It will always show the next message when build on some machine
        GEN      libtraceevent-dynamic-list
        Either missing one of [ plugin_jbd2.so plugin_hrtimer.so
        plugin_kmem.so plugin_kvm.so plugin_mac80211.so
        plugin_sched_switch.so plugin_function.so plugin_xen.so
        plugin_scsi.so plugin_cfg80211.so] or bad version of nm

So just use the LC_ALL=C (POSIX) default when sort.

Signed-off-by: Cheng Jian <cj.chengj...@huawei.com>
---
 tools/lib/traceevent/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 46cd5f8..6ef1e28 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -259,7 +259,7 @@ endef
 
 define do_generate_dynamic_list_file
        symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \
-       xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\
+       xargs echo "U W w" | tr ' ' '\n' | env LC_ALL=C sort -u | xargs echo`;\
        if [ "$$symbol_type" = "U W w" ];then                           \
                (echo '{';                                              \
                $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
@@ -289,7 +289,8 @@ install: install_lib
 
 clean:
        $(call QUIET_CLEAN, libtraceevent) \
-               $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
+               $(RM) $(OUTPUT)*.o *~ $(TARGETS) $(OUTPUT)*.a $(OUTPUT)*.so*    
\
+               $(RM) $(VERSION_FILES) $(OUTPUT).*.d $(OUTPUT).*.cmd            
\
                $(RM) TRACEEVENT-CFLAGS tags TAGS
 
 PHONY += force plugins
-- 
1.8.3.1

Reply via email to