1From d0fa5b259c2dc942d0a43a9cf1bfc32f40c184f9 Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Thu, 7 Jan 2016 22:37:30 -0800
4Subject: [PATCH] libtool: do not use jlibtool
5
6jlibtool is hardcoded to be used but we need to use
7our libtool, so fix the makfiles to make it compatible
8with our libtool.
9
10Upstream-Status: Inappropriate [embedded specific]
11
12Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
13Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
14---
15 Make.inc.in        |  4 ++--
16 scripts/boiler.mk  |  2 ++
17 scripts/install.mk | 14 +++++++-------
18 scripts/libtool.mk | 22 ++++++++++++++++------
19 4 files changed, 27 insertions(+), 15 deletions(-)
20
21diff --git a/Make.inc.in b/Make.inc.in
22index 05f82776ff..e78f3fe9dc 100644
23--- a/Make.inc.in
24+++ b/Make.inc.in
25@@ -57,7 +57,7 @@ CPPFLAGS	= @CPPFLAGS@
26 LIBPREFIX	= @LIBPREFIX@
27 EXEEXT		= @EXEEXT@
28
29-LIBTOOL		= JLIBTOOL
30+LIBTOOL		= @LIBTOOL@
31 ACLOCAL		= @ACLOCAL@
32 AUTOCONF	= @AUTOCONF@
33 AUTOHEADER	= @AUTOHEADER@
34@@ -168,7 +168,7 @@ ANALYZE.c       := @clang_path@
35 #
36 ifeq "$(USE_SHARED_LIBS)" "yes"
37 	TESTBINDIR = ./$(BUILD_DIR)/bin/local
38-	TESTBIN    =  FR_LIBRARY_PATH=./build/lib/.libs $(JLIBTOOL) --quiet --mode=execute $(TESTBINDIR)
39+	TESTBIN    =  FR_LIBRARY_PATH=./build/lib/.libs $(LIBTOOL) --quiet --mode=execute $(TESTBINDIR)
40 else
41 	TESTBINDIR = ./$(BUILD_DIR)/bin
42 	TESTBIN    = ./$(BUILD_DIR)/bin
43diff --git a/scripts/boiler.mk b/scripts/boiler.mk
44index 2ce0c18f34..567cc0f22f 100644
45--- a/scripts/boiler.mk
46+++ b/scripts/boiler.mk
47@@ -272,6 +272,7 @@ define COMPILE_C_CMDS
48 	$(Q)$(ECHO) CC $<
49 	$(Q)$(strip ${COMPILE.c} -o $@ -c -MD ${CPPFLAGS} ${CFLAGS} ${SRC_CFLAGS} ${INCDIRS} \
50 	    $(addprefix -I, ${SRC_INCDIRS}) ${SRC_DEFS} ${DEFS} $<)
51+	${Q}mv $(dir $@)/.libs/$(notdir $*.d) ${BUILD_DIR}/objs/$*.d
52 endef
53 else
54 #
55@@ -287,6 +288,7 @@ define COMPILE_C_CMDS
56 	$(Q)cppcheck --enable=style -q ${CHECKFLAGS} $(filter -isystem%,${SRC_CFLAGS}) \
57 	     $(filter -I%,${SRC_CFLAGS}) $(filter -D%,${SRC_CFLAGS}) ${INCDIRS} \
58 	     $(addprefix -I,${SRC_INCDIRS}) ${SRC_DEFS} ${DEFS} --suppress=variableScope --suppress=invalidscanf $<
59+	${Q}mv $(dir $@)/.libs/$(notdir $*.d) ${BUILD_DIR}/objs/$*.d
60 endef
61 endif
62
63diff --git a/scripts/install.mk b/scripts/install.mk
64index 916411563b..e38c1ed697 100644
65--- a/scripts/install.mk
66+++ b/scripts/install.mk
67@@ -46,7 +46,7 @@ define ADD_INSTALL_RULE.exe
68     install: $${${1}_INSTALLDIR}/$(notdir ${1})
69
70     # Install executable ${1}
71-    $${${1}_INSTALLDIR}/$(notdir ${1}): ${JLIBTOOL} $${${1}_BUILD}/${1} | $${${1}_INSTALLDIR}
72+    $${${1}_INSTALLDIR}/$(notdir ${1}): ${LIBTOOL} $${${1}_BUILD}/${1} | $${${1}_INSTALLDIR}
73 	@$(ECHO) INSTALL ${1}
74 	$(Q)$${PROGRAM_INSTALL} -c -m 755 $${BUILD_DIR}/bin/${1} $${${1}_INSTALLDIR}/
75 	$(Q)$${${1}_POSTINSTALL}
76@@ -65,7 +65,7 @@ define ADD_INSTALL_RULE.a
77     install: $${${1}_INSTALLDIR}/$(notdir ${1})
78
79     # Install static library ${1}
80-    $${${1}_INSTALLDIR}/$(notdir ${1}): ${JLIBTOOL} ${1} | $${${1}_INSTALLDIR}
81+    $${${1}_INSTALLDIR}/$(notdir ${1}): ${LIBTOOL} ${1} | $${${1}_INSTALLDIR}
82 	@$(ECHO) INSTALL ${1}
83 	$(Q)$${PROGRAM_INSTALL} -c -m 755 $${BUILD_DIR}/lib/${1} $${${1}_INSTALLDIR}/
84 	$(Q)$${${1}_POSTINSTALL}
85@@ -87,9 +87,9 @@ define ADD_INSTALL_RULE.la
86     install: $${${1}_INSTALLDIR}/$(notdir ${1})
87
88     # Install libtool library ${1}
89-    $${${1}_INSTALLDIR}/$(notdir ${1}): ${JLIBTOOL} $${${1}_BUILD}/${1} | $${${1}_INSTALLDIR}
90+    $${${1}_INSTALLDIR}/$(notdir ${1}): ${LIBTOOL} $${${1}_BUILD}/${1} | $${${1}_INSTALLDIR}
91 	@$(ECHO) INSTALL ${1}
92-	$(Q)$${PROGRAM_INSTALL} -c -m 755 $${LOCAL_FLAGS_MIN} $${BUILD_DIR}/lib/${1} $${${1}_INSTALLDIR}/
93+	$(Q)$${PROGRAM_INSTALL} -c -m 755 $${BUILD_DIR}/lib/${1} $${${1}_INSTALLDIR}/
94 	$(Q)$${${1}_POSTINSTALL}
95
96 endef
97@@ -107,7 +107,7 @@ define ADD_INSTALL_RULE.man
98     install: ${2}/$(notdir ${1})
99
100     # Install manual page ${1}
101-    ${2}/$(notdir ${1}): ${JLIBTOOL} ${1} | ${2}
102+    ${2}/$(notdir ${1}): ${LIBTOOL} ${1} | ${2}
103 	@$(ECHO) INSTALL $(notdir ${1})
104 	$(Q)$${PROGRAM_INSTALL} -c -m 644 ${1} ${2}/
105
106@@ -122,9 +122,9 @@ endef
107 define ADD_INSTALL_RULE.dir
108     # Install directory
109     .PHONY: ${1}
110-    ${1}: ${JLIBTOOL}
111+    ${1}: ${LIBTOOL}
112 	@$(ECHO) INSTALL -d -m 755 ${1}
113-	$(Q)$${PROGRAM_INSTALL} -d -m 755 ${1}
114+	$(Q)$${INSTALL} -d -m 755 ${1}
115 endef
116
117
118diff --git a/scripts/libtool.mk b/scripts/libtool.mk
119index 381127ec2d..e83d7e6ad7 100644
120--- a/scripts/libtool.mk
121+++ b/scripts/libtool.mk
122@@ -60,7 +60,9 @@ ifeq "${LIBTOOL}" "JLIBTOOL"
123     # Tell GNU Make to use this value, rather than anything specified
124     # on the command line.
125     override LIBTOOL := ${JLIBTOOL}
126-endif    # else we're not using jlibtool
127+else    # else we're not using jlibtool
128+    all install: ${LIBTOOL}
129+endif
130
131 # When using libtool, it produces a '.libs' directory.  Ensure that it
132 # is removed on "make clean", too.
133@@ -74,11 +76,19 @@ clean: .libs_clean
134 # Re-define compilers and linkers
135 #
136 OBJ_EXT = lo
137-COMPILE.c = ${LIBTOOL} --silent --mode=compile ${CC}
138-COMPILE.cxx = ${LIBTOOL} --mode=compile ${CXX}
139-LINK.c = ${LIBTOOL} --silent --mode=link ${CC}
140-LINK.cxx = ${LIBTOOL} --mode=link ${CXX}
141-PROGRAM_INSTALL = ${LIBTOOL} --silent --mode=install ${INSTALL}
142+ifeq "${LIBTOOL}" "JLIBTOOL"
143+    COMPILE.c = ${LIBTOOL} --silent --mode=compile ${CC}
144+    COMPILE.cxx = ${LIBTOOL} --mode=compile ${CXX}
145+    LINK.c = ${LIBTOOL} --silent --mode=link ${CC}
146+    LINK.cxx = ${LIBTOOL} --mode=link ${CXX}
147+    PROGRAM_INSTALL = ${LIBTOOL} --silent --mode=install ${INSTALL}
148+else
149+    COMPILE.c = ${LIBTOOL} --mode=compile --tag=CC ${CC}
150+    COMPILE.cxx = ${LIBTOOL} --mode=compile --tag=CC ${CXX}
151+    LINK.c = ${LIBTOOL} --mode=link --tag=CC ${CC} -module -export-dynamic
152+    LINK.cxx = ${LIBTOOL} --mode=link --tag=CC ${CXX} -module -export-dynamic
153+    PROGRAM_INSTALL = ${LIBTOOL} --mode=install ${INSTALL}
154+endif
155
156
157 # LIBTOOL_ENDINGS - Given a library ending in ".a" or ".so", replace that
158--
1592.25.1
160
161