diff --git a/uppsrc/Core/App.cpp b/uppsrc/Core/App.cpp index 60beecd1d..db8a90275 100644 --- a/uppsrc/Core/App.cpp +++ b/uppsrc/Core/App.cpp @@ -198,7 +198,7 @@ String ConfigFile(const char *file) { return AppendFileName(sConfigFolder, file); #if defined(PLATFORM_WIN32) if(sHomecfg) { - String p = GetHomeDirFile(GetExeTitle()); + String p = GetHomeDirFile(GetAppName()); ONCELOCK RealizeDirectory(p); return AppendFileName(p, file); @@ -211,7 +211,8 @@ String ConfigFile(const char *file) { if(!sHomecfg) while(h.GetCount() > 1 && DirectoryExists(h)) { String pp = AppendFileName(h, ".config"); - if(DirectoryExists(pp)) { + FindFile ff(pp); + if(ff && ff.IsFolder() && ff.CanWrite()) { cfgdir = pp; break; } diff --git a/uppsrc/ide/Builders/Build.cpp b/uppsrc/ide/Builders/Build.cpp index 5352d41b5..d08356dc3 100644 --- a/uppsrc/ide/Builders/Build.cpp +++ b/uppsrc/ide/Builders/Build.cpp @@ -632,7 +632,7 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting) String makefile; Vector uppdirs = GetUppDirs(); - String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/"; + String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : ".cache/upp.out"; String inclist; Index allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, *host, *b); @@ -657,8 +657,6 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting) makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n"; inclist << " -I$(UPPDIR" << (i + 1) << ")"; } - else - inclist << "-I./"; for(String s : pkg_config) inclist << " `pkg-config --cflags " << s << "`"; @@ -666,6 +664,9 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting) Vector includes = SplitDirs(bm.Get("INCLUDE","")); for(int i = 0; i < includes.GetCount(); i++) inclist << " -I" << includes[i]; + + inclist << " -I./"; + inclist << " -I" << uppout; // build_info.h is created there makefile << "\n" "UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32)) << "\n" @@ -702,11 +703,14 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting) output = Nvl(trg, mf.output); if(exporting) output = wspc[i] + ".out"; + else + output = "./" + wspc[0]; StringStream ss; Vector bi = SvnInfo(wspc[i]); String svn_info; + String build_info = '\"' + uppout + "/build_info.h\""; for(int i = 0; i < bi.GetCount(); i++) - svn_info << " echo '" << bi[i] << "' >> build_info.h\n"; + svn_info << " echo '" << bi[i] << "' >> " << build_info << "\n"; install << "\n" "OutDir = " << tdir << "\n" "OutFile = " << output << "\n" @@ -724,7 +728,7 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting) "#define bmSECOND %-S%n" "#define bmTIME Time(%y, %-m, %-d, %-H, %-M, %-S)' && \\\n" " echo '#define bmMACHINE \"'`hostname`'\"' && \\\n" - " echo '#define bmUSER \"'`whoami`'\"') > build_info.h\n" + " echo '#define bmUSER \"'`whoami`'\"') > " << build_info << "\n" << svn_info << "\n" ".PHONY: prepare\n" diff --git a/uppsrc/ide/Builders/Builders.h b/uppsrc/ide/Builders/Builders.h index 55f229fc0..afbb7c9ce 100644 --- a/uppsrc/ide/Builders/Builders.h +++ b/uppsrc/ide/Builders/Builders.h @@ -162,7 +162,8 @@ private: void DeletePCHFile(const String& pch_file); #ifdef PLATFORM_POSIX -void CreateBuildMethods(); +void CreateBuildMethods(); +String GetDefaultUppOut(); #endif INITIALIZE(GccBuilder) diff --git a/uppsrc/ide/Builders/Install.cpp b/uppsrc/ide/Builders/Install.cpp index 18ce6ac61..dbc0e5736 100644 --- a/uppsrc/ide/Builders/Install.cpp +++ b/uppsrc/ide/Builders/Install.cpp @@ -107,4 +107,24 @@ void CreateBuildMethods() } #endif } + +String GetDefaultUppOut() +{ + String out; + String p = GetExeFolder(); + while(p.GetCount() > 1 && DirectoryExists(p)) { + String h = AppendFileName(p, ".cache"); + if(DirectoryExists(h)) { + out = h; + break; + } + p = GetFileFolder(p); + } + + out = Nvl(out, GetHomeDirFile(".cache")) + "/upp.out"; + + RealizeDirectory(out); + return out; +} + #endif diff --git a/uppsrc/ide/Install.cpp b/uppsrc/ide/Install.cpp index 24a53840c..ae6171eff 100644 --- a/uppsrc/ide/Install.cpp +++ b/uppsrc/ide/Install.cpp @@ -11,20 +11,7 @@ bool Install(bool& hasvars) String uppsrc; - String out; - String p = GetExeFolder(); - while(p.GetCount() > 1 && DirectoryExists(p)) { - String h = AppendFileName(p, ".cache"); - if(DirectoryExists(h)) { - out = h; - break; - } - p = GetFileFolder(p); - } - - out = Nvl(out, GetHomeDirFile(".cache")) + "/upp.out"; - - RealizeDirectory(out); + String out = GetDefaultUppOut(); auto MakeAssembly = [&](String b, String name = Null) { name = Nvl(name, GetFileTitle(b)); diff --git a/uppsrc/umk/umake.cpp b/uppsrc/umk/umake.cpp index 8d42ce6ad..61ef5f4d0 100644 --- a/uppsrc/umk/umake.cpp +++ b/uppsrc/umk/umake.cpp @@ -4,10 +4,16 @@ bool SilentMode; String GetUmkFile(const char *fn) { + String h = ConfigFile(fn); + if(FileExists(h)) + return h; + String cfgdir = GetFileFolder(GetFileFolder(ConfigFile("x"))); + ONCELOCK + PutVerbose("Config directory: " << cfgdir); return GetFileOnPath(fn, - GetHomeDirFile(".upp/umk") + ';' + - GetHomeDirFile(".upp/theide") + ';' + - GetHomeDirFile(".upp/ide") + ';' + + cfgdir + "/umk" + ';' + + cfgdir + "/theide" + ';' + + cfgdir + "/ide" + ';' + GetHomeDirectory() + ';' + GetFileFolder(GetExeFilePath())); } @@ -100,7 +106,7 @@ CONSOLE_APP_MAIN String x = Join(h, ";"); SetVar("UPP", x, false); PutVerbose("Inline assembly: " + x); - String outdir = ConfigFile("_out"); + String outdir = GetDefaultUppOut(); RealizeDirectory(outdir); SetVar("OUTPUT", outdir, false); } @@ -220,7 +226,8 @@ CONSOLE_APP_MAIN } else { ide.debug.target_override = ide.release.target_override = true; - ide.debug.target = ide.release.target = mkf = arg[i]; + ide.debug.target = ide.release.target = NormalizePath(arg[i]); + PutVerbose("Target override: " << ide.debug.target); } if(clean) ide.Clean();