umk: support for 'inline' assembly and build method

git-svn-id: svn://ultimatepp.org/upp/trunk@3742 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-08-06 12:40:43 +00:00
parent 58b267b534
commit 97b77bb87c
6 changed files with 55 additions and 11 deletions

View file

@ -4,12 +4,12 @@
#define LDUMP(x) // DUMP(x)
String GetDefaultMethod()
String MakeBuild::GetDefaultMethod()
{
return LoadFile(ConfigFile("default_method"));
}
VectorMap<String, String> GetMethodVars(const String& method)
VectorMap<String, String> MakeBuild::GetMethodVars(const String& method)
{
VectorMap<String, String> map;
LoadVarFile(ConfigFile((String)~method + ".bm"), map);
@ -335,7 +335,7 @@ String MakeBuild::OutDir(const Index<String>& cfg, const String& package, const
outdir = AppendFileName(outdir, GetVarsName());
if(!use_target)
outdir = AppendFileName(outdir, package);
outdir = AppendFileName(outdir, method + "." + Join(x, "."));
outdir = AppendFileName(outdir, GetFileTitle(method) + "." + Join(x, "."));
outdir = Filter(outdir, CharFilterSlash);
return outdir;
}

View file

@ -40,6 +40,8 @@ struct MakeBuild {
virtual void ReQualifyCodeBase() = 0;
virtual void SetErrorEditor() = 0;
virtual String GetMain() = 0;
virtual String GetDefaultMethod();
virtual VectorMap<String, String> GetMethodVars(const String& method);
struct TransferFileInfo
{

View file

@ -176,7 +176,7 @@ String GetVarsName();
String VarFilePath();
Vector<String> GetUppDirs();
String GetUppDir();
void SetVar(const String& var, const String& value);
void SetVar(const String& var, const String& val, bool save = true);
String GetAnyFileName(const char *path);
String GetAnyFileTitle(const char *path);

View file

@ -66,6 +66,9 @@ String VarFilePath(String name) {
}
String VarFilePath() {
String p = varsname;
if(IsFullPath(varsname))
return varsname;
return VarFilePath(GetVarsName());
}
@ -181,9 +184,10 @@ String GetVar(const String& var) {
return MainNest().Get(var);
}
void SetVar(const String& var, const String& val) {
void SetVar(const String& var, const String& val, bool save) {
MainNest().Set(var, val);
SaveVars(GetVarsName());
if(save)
SaveVars(GetVarsName());
}
Vector<String> GetUppDirs() {

View file

@ -2,6 +2,34 @@
bool SilentMode;
String GetUmkFile(const char *fn)
{
return GetFileOnPath(fn,
GetHomeDirFile(".upp/umk") + ';' +
GetHomeDirFile(".upp/theide") + ';' +
GetHomeDirFile(".upp/ide") + ';' +
GetHomeDirectory());
}
String GetBuildMethodPath(String method)
{
if(GetFileExt(method) != ".bm")
method << ".bm";
return GetUmkFile(method);
}
String Ide::GetDefaultMethod()
{
return "GCC";
}
VectorMap<String, String> Ide::GetMethodVars(const String& method)
{
VectorMap<String, String> map;
LoadVarFile(GetBuildMethodPath(method), map);
return map;
}
void Puts(const char *s)
{
Cout() << s;
@ -28,11 +56,18 @@ CONSOLE_APP_MAIN
if(x[i] == 'l')
SilentMode = true;
}
if(!LoadVars(arg[0])) {
Puts("Invalid assembly\n");
SetExitCode(2);
return;
if(!FileExists(GetUmkFile(arg[0] + ".var"))) {
SetVar("UPP", arg[0], false);
String outdir = ConfigFile("_out");
RealizeDirectory(outdir);
SetVar("OUTPUT", outdir, false);
}
else
if(!LoadVars(arg[0])) {
Puts("Invalid assembly\n");
SetExitCode(2);
return;
}
if(!FileExists(SourcePath(arg[1], GetFileTitle(arg[1]) + ".upp"))) {
Puts("Package does not exist\n");
SetExitCode(2);
@ -53,7 +88,7 @@ CONSOLE_APP_MAIN
if(f.GetCount())
ide.mainconfigparam = f[0].param;
String m = arg[2];
if(!FileExists(ConfigFile((String)m + ".bm"))) {
if(GetBuildMethodPath(m).GetCount() == 0) {
SilentMode = false;
Puts("Invalid build method\n");
SetExitCode(3);

View file

@ -138,6 +138,9 @@ struct Ide : public IdeContext, public MakeBuild {
virtual void SetErrorEditor();
virtual String GetMain();
virtual String GetDefaultMethod();
virtual VectorMap<String, String> GetMethodVars(const String& method);
void ExportMakefile(const String& ep);
void ExportProject(const String& ep, bool all);