From: John Hodge Date: Tue, 1 Oct 2013 14:58:21 +0000 (+0800) Subject: Tools/udibuild - Fixing linking X-Git-Tag: rel0.15~154 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=5a6a8c4210e3d8124f69bf5bede6ec144aaeddf4;p=tpg%2Facess2.git Tools/udibuild - Fixing linking --- diff --git a/Tools/udibuild/src/build.c b/Tools/udibuild/src/build.c index 2ccd2b2a..feeb3b78 100644 --- a/Tools/udibuild/src/build.c +++ b/Tools/udibuild/src/build.c @@ -76,10 +76,12 @@ int Build_LinkObjects(tIniFile *opts, const char *abi, tUdiprops *udiprops) mkdir(abidir, 0755); free(abidir); - char *cmd = mkstr("%s %s -o bin/%s/%s -r %s", + char *cmd = mkstr("%s -r %s -o bin/%s/%s -s %s", linker, IniFile_Get(opts, abi, "LDFLAGS", ""), - abi, udiprops->ModuleName, objfiles_str); + abi, udiprops->ModuleName, objfiles_str + ); printf("--- Linking: bin/%s/%s\n", abi, udiprops->ModuleName); + printf("%s\n", cmd); int rv = system(cmd); free(cmd); free(objfiles_str); diff --git a/Tools/udibuild/src/inifile.c b/Tools/udibuild/src/inifile.c index ce91c625..d52a845d 100644 --- a/Tools/udibuild/src/inifile.c +++ b/Tools/udibuild/src/inifile.c @@ -60,6 +60,8 @@ tIniFile *IniFile_Load(const char *Path) char buf[512]; while( fgets(buf, sizeof(buf)-1, fp) ) { + if( strchr(buf, '#') ) + *strchr(buf, '#') = '\0'; rtrim(buf); char name[64]; size_t ofs = 0; diff --git a/Tools/udibuild/src/main.c b/Tools/udibuild/src/main.c index 1f43cec3..ff6b8f43 100644 --- a/Tools/udibuild/src/main.c +++ b/Tools/udibuild/src/main.c @@ -16,10 +16,11 @@ #include "include/inifile.h" #include "include/udiprops.h" +#define CONFIG_FILENAME "udibuild.ini" #ifdef __ACESS__ -#define CONFIG_FILE "/Acess/Conf/UDI/udibuild.ini" +#define RUNTIME_DIR "/Acess/Conf/UDI" #else -#define CONFIG_FILE "/etc/udi/udibuild.ini" +#define RUNTIME_DIR "/etc/udi" #endif // === PROTOTYPES === @@ -28,6 +29,7 @@ void Usage(const char *progname); // === GLOBALS === +const char *gsRuntimeDir = RUNTIME_DIR; const char *gsOpt_ConfigFile; const char *gsOpt_WorkingDir; const char *gsOpt_UdipropsFile; @@ -54,8 +56,8 @@ int main(int argc, char *argv[]) if( !gsOpt_ConfigFile && (argv[0][0] == '.' || argv[0][0] == '/') ) { char *last_slash = strrchr(argv[0], '/'); if( last_slash ) { - gsOpt_ConfigFile = mkstr("%.*s/udibuild.ini", - last_slash-argv[0], argv[0]); + gsOpt_ConfigFile = mkstr("%.*s/%s", + last_slash-argv[0], argv[0], CONFIG_FILENAME); } //if( !file_exists(gsOpt_ConfigFile) ) { // free(gsOpt_ConfigFile); @@ -63,11 +65,11 @@ int main(int argc, char *argv[]) //} } // 3. Check ~/.config/udi/udibuild.ini - // 4. Check CONFIGNAME + // 4. Check RUNTIME_DIR/udibuild.ini // #. Oh well if( !gsOpt_ConfigFile ) { - fprintf(stderr, "Can't locate udibuild.ini file, please specify using '-c'\n"); + fprintf(stderr, "Can't locate "CONFIG_FILENAME" file, please specify using '-c'\n"); exit(2); }