From 9776fa5021b56f8847127138a37c7b5824305ba0 Mon Sep 17 00:00:00 2001 From: iysheng Date: Fri, 4 Jun 2021 23:53:29 +0800 Subject: [PATCH] [tools] Optimization the EXTERN_LIB variable use --- tools/makefile.py | 8 ++++++++ tools/rtthread.mk | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/makefile.py b/tools/makefile.py index 655e294575..97001892c9 100644 --- a/tools/makefile.py +++ b/tools/makefile.py @@ -51,6 +51,14 @@ def TargetMakefile(env): if 'CXXFLAGS' in dir(rtconfig): make.write('CXXFLAGS :=%s' % (rtconfig.CXXFLAGS)) make.write('\n') + if env.has_key('LIBS'): + make.write('EXTERN_LIB := ') + for tlib in env['LIBS']: + make.write('-l%s ' % (tlib)) + if env.has_key('LIBPATH'): + for tlibpath in env['LIBPATH']: + make.write('-L%s ' % (tlibpath)) + make.write('\n') make.write('\n') diff --git a/tools/rtthread.mk b/tools/rtthread.mk index 7cf018cb52..4bb3e2754d 100644 --- a/tools/rtthread.mk +++ b/tools/rtthread.mk @@ -122,10 +122,10 @@ $(TARGET): $(OBJS) @echo ar $(TARGET) @$(CROSS_COMPILE)ar -rv $@ $(OBJS) else -$(TARGET): $(OBJS) $(EXTERN_LIB) +$(TARGET): $(OBJS) @echo ------------------------------------------------ @echo link $(TARGET) - @$(CROSS_COMPILE)g++ -o $@ $(LFLAGS) $(OBJS) $(EXTERN_LIB) -lc -lm + @$(CROSS_COMPILE)g++ -o $@ $(LFLAGS) $(OBJS) $(EXTERN_LIB) @echo ------------------------------------------------ @$(CROSS_COMPILE)objcopy -O binary $@ rtthread.bin @$(CROSS_COMPILE)size $@