Merge pull request #4750 from iysheng/extern_lib

[tools] Optimization the EXTERN_LIB variable use
This commit is contained in:
Bernard Xiong 2021-06-10 15:52:35 +08:00 committed by GitHub
commit ed402ec25c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -51,6 +51,14 @@ def TargetMakefile(env):
if 'CXXFLAGS' in dir(rtconfig): if 'CXXFLAGS' in dir(rtconfig):
make.write('CXXFLAGS :=%s' % (rtconfig.CXXFLAGS)) make.write('CXXFLAGS :=%s' % (rtconfig.CXXFLAGS))
make.write('\n') 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') make.write('\n')

View File

@ -122,10 +122,10 @@ $(TARGET): $(OBJS)
@echo ar $(TARGET) @echo ar $(TARGET)
@$(CROSS_COMPILE)ar -rv $@ $(OBJS) @$(CROSS_COMPILE)ar -rv $@ $(OBJS)
else else
$(TARGET): $(OBJS) $(EXTERN_LIB) $(TARGET): $(OBJS)
@echo ------------------------------------------------ @echo ------------------------------------------------
@echo link $(TARGET) @echo link $(TARGET)
@$(CROSS_COMPILE)g++ -o $@ $(LFLAGS) $(OBJS) $(EXTERN_LIB) -lc -lm @$(CROSS_COMPILE)g++ -o $@ $(LFLAGS) $(OBJS) $(EXTERN_LIB)
@echo ------------------------------------------------ @echo ------------------------------------------------
@$(CROSS_COMPILE)objcopy -O binary $@ rtthread.bin @$(CROSS_COMPILE)objcopy -O binary $@ rtthread.bin
@$(CROSS_COMPILE)size $@ @$(CROSS_COMPILE)size $@