From 6e159ab71116e26ce7d2989d4f4e9c52915b8d2d Mon Sep 17 00:00:00 2001 From: jesusc Date: Sun, 1 Oct 2006 03:47:36 +0000 Subject: [PATCH] Improved -l option. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4394 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- support/librarian/sdcclib.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/support/librarian/sdcclib.c b/support/librarian/sdcclib.c index 95817b2e..b6760c6d 100644 --- a/support/librarian/sdcclib.c +++ b/support/librarian/sdcclib.c @@ -533,6 +533,10 @@ int fileexist(char * fname) void AddList(void) { FILE * list; + char *cc; + char *as; + char CmdLine[1024]; + char SrcName[PATH_MAX]; list=fopen(ListName, "r"); if(list==NULL) @@ -541,6 +545,9 @@ void AddList(void) return; } + cc = getenv("SDCCLIB_CC"); + as = getenv("SDCCLIB_AS"); + action=OPT_ADD_REL; while(!feof(list)) { @@ -549,6 +556,34 @@ void AddList(void) CleanLine(RelName); if(strlen(RelName)>0) //Skip empty lines { + if((cc!=NULL)||(as!=NULL)) + { + strcpy(SrcName, RelName); + if(strchr(SrcName,'.')==NULL) + strcat(SrcName,".src"); + } + + if(cc!=NULL) + { + ChangeExtension(SrcName, "c"); + if(fileexist(SrcName)) + { + sprintf(CmdLine, "%s %s", cc, SrcName); + printf("%s\n", CmdLine); + system(CmdLine); + } + } + else if(as!=NULL) + { + ChangeExtension(SrcName, "asm"); + if(fileexist(SrcName)) + { + sprintf(CmdLine, "%s %s", as, SrcName); + printf("%s\n", CmdLine); + system(CmdLine); + } + } + if(strchr(RelName,'.')==NULL) { //Try adding the default sdcc extensions @@ -556,6 +591,7 @@ void AddList(void) if(!fileexist(RelName)) ChangeExtension(RelName, "rel"); } + printf("Adding: %s\n", RelName); AddRel(); } -- 2.47.2