make/export: support export extra library
Change-Id: Iaab5dc8fd61b55888dad59d9b1d8380d7bd44a58 Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
41f434015b
commit
fd3be9eb37
@ -61,40 +61,48 @@ default: all
|
||||
$(EXPORTDIR)/makeinfo.sh: $(TOPDIR)/.config $(EXPORTDIR)/Make.defs
|
||||
@echo "#!/bin/bash" > $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHSUBDIR=\"$(ARCHSUBDIR)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "AR=\"$(AR)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHCFLAGS=\"$(ARCHCFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHCPUFLAGS=\"$(ARCHCPUFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHCXXFLAGS=\"$(ARCHCXXFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHDIR=\"$(ARCHDIR)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
ifdef ARCHSCRIPT
|
||||
@echo "LDNAME=\"$(LDNAME)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDDIR=\"$(LDDIR)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDPATH=\"$(LDPATH)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
endif
|
||||
@echo "ARCHCFLAGS=\"$(ARCHCFLAGS) $(ARCHCPUFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHCXXFLAGS=\"$(ARCHCXXFLAGS) $(ARCHCPUFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHOPTIMIZATION=\"$(ARCHOPTIMIZATION)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHPICFLAGS=\"$(ARCHPICFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHSUBDIR=\"$(ARCHSUBDIR)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHWARNINGS=\"$(ARCHWARNINGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHWARNINGSXX=\"$(ARCHWARNINGSXX)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "ARCHOPTIMIZATION=\"$(ARCHOPTIMIZATION)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "CROSSDEV=\"$(CROSSDEV)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "CC=\"$(CC)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "CXX=\"$(CXX)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "CPP=\"$(CPP)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "CROSSDEV=\"$(CROSSDEV)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "CXX=\"$(CXX)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "EXEEXT=\"$(EXEEXT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "EXTRA_LIBPATHS=\"$(EXTRA_LIBPATHS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "EXTRA_LIBS=\"$(EXTRA_LIBS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "EXTRA_OBJS=\"$(EXTRA_OBJS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTCC=\"$(HOSTCC)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTCFLAGS=\"$(HOSTCFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTEXEEXT=\"$(HOSTEXEEXT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTINCLUDES=\"$(HOSTINCLUDES)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTLDFLAGS=\"$(HOSTLDFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
ifdef ARCHSCRIPT
|
||||
@echo "LDDIR=\"$(LDDIR)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDNAME=\"$(LDNAME)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDPATH=\"$(LDPATH)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
endif
|
||||
@echo "LD=\"$(LD)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "AR=\"$(AR)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDENDGROUP=\"$(LDENDGROUP)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDFLAGS=\"$(LDFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDLIBS=\"$(LDLIBS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDSCRIPT=\"$(LDSCRIPT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDSTARTGROUP=\"$(LDSTARTGROUP)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LIBEXT=\"$(LIBEXT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "NM=\"$(NM)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "STRIP=\"$(STRIP)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "OBJCOPY=\"$(OBJCOPY)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "OBJDUMP=\"$(OBJDUMP)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "NXFLATLDFLAGS1=\"$(NXFLATLDFLAGS1)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "NXFLATLDFLAGS2=\"$(NXFLATLDFLAGS2)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "OBJCOPY=\"$(OBJCOPY)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "OBJDUMP=\"$(OBJDUMP)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "OBJEXT=\"$(OBJEXT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LIBEXT=\"$(LIBEXT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "EXEEXT=\"$(EXEEXT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTCC=\"$(HOSTCC)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTINCLUDES=\"$(HOSTINCLUDES)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTCFLAGS=\"$(HOSTCFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTLDFLAGS=\"$(HOSTLDFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "HOSTEXEEXT=\"$(HOSTEXEEXT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "LDSCRIPT=\"$(LDSCRIPT)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
@echo "STRIP=\"$(STRIP)\"" >> $(EXPORTDIR)/makeinfo.sh
|
||||
$(Q) chmod 755 $(EXPORTDIR)/makeinfo.sh
|
||||
|
||||
clean:
|
||||
|
@ -233,6 +233,7 @@ fi
|
||||
# Save the compilation options
|
||||
|
||||
echo "ARCHCFLAGS = ${ARCHCFLAGS}" >"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "ARCHCPUFLAGS = ${ARCHCPUFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "ARCHCXXFLAGS = ${ARCHCXXFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "ARCHPICFLAGS = ${ARCHPICFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "ARCHWARNINGS = ${ARCHWARNINGS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
@ -263,13 +264,13 @@ echo "LDSCRIPT = ${LDSCRIPT}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
# Additional compilation options when the kernel is built
|
||||
|
||||
if [ "X${USRONLY}" != "Xy" ]; then
|
||||
echo "LDFLAGS = ${LDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "HEAD_OBJ = ${HEAD_OBJ}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "EXTRA_OBJS = ${EXTRA_OBJS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "LDSTARTGROUP = ${LDSTARTGROUP}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "EXTRA_LIBS = ${EXTRA_LIBS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "LIBGCC = ${LIBGCC}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "LDENDGROUP = ${LDENDGROUP}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "EXTRA_LIBS = ${EXTRA_LIBS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "EXTRA_OBJS = ${EXTRA_OBJS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "HEAD_OBJ = ${HEAD_OBJ}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "LDENDGROUP = ${LDENDGROUP}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "LDFLAGS = ${LDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "LDSTARTGROUP = ${LDSTARTGROUP}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
echo "LIBGCC = ${LIBGCC}" >>"${EXPORTDIR}/scripts/Make.defs"
|
||||
fi
|
||||
|
||||
# Copy the system map file(s)
|
||||
@ -378,6 +379,36 @@ for lib in ${LIBLIST}; do
|
||||
cp ${TOPDIR}/${lib} ${EXPORTDIR}/libs
|
||||
done
|
||||
|
||||
# Process extra librarys
|
||||
|
||||
for lib in ${EXTRA_LIBS}; do
|
||||
|
||||
# Convert library name
|
||||
|
||||
if [ ${lib:0:2} = "-l" ]; then
|
||||
lib=`echo "${lib}" | sed -e "s/-l/lib/" -e "s/$/${LIBEXT}/"`
|
||||
fi
|
||||
|
||||
for path in ${EXTRA_LIBPATHS}; do
|
||||
|
||||
# Skip the library path options
|
||||
|
||||
if [ ${#path} == 2 ]; then continue; fi
|
||||
|
||||
if [ ${path:0:2} = "-l" ] || [ ${path:0:2} = "-L" ]; then
|
||||
path=${path:2}
|
||||
fi
|
||||
|
||||
# Export the extra librarys
|
||||
|
||||
if [ -f "${path}/${lib}" ]; then
|
||||
cp -a ${path}/${lib} ${EXPORTDIR}/libs
|
||||
break
|
||||
fi
|
||||
|
||||
done
|
||||
done
|
||||
|
||||
# Copy the essential build script file(s)
|
||||
|
||||
cp -f "${TOPDIR}/tools/Config.mk" "${EXPORTDIR}/tools/"
|
||||
|
Loading…
Reference in New Issue
Block a user