diff --git uppsrc/umk/umake.cpp uppsrc/umk/umake.cpp --- uppsrc/umk/umake.cpp +++ uppsrc/umk/umake.cpp @@ -85,6 +85,7 @@ CONSOLE_APP_MAIN int exporting = 0; bool run = false; String mkf; + String platformFlags; Vector param, runargs; @@ -129,9 +130,38 @@ CONSOLE_APP_MAIN ide.console.SetSlots(n); break; } + case 't': { + if(s[1] == '=') { + static const VectorMap flags = { + {"windows", "WIN32"}, + {"linux", "POSIX LINUX"}, + {"android", "POSIX LINUX ANDROID"}, + {"osx", "POSIX BSD OSX"}, + {"osx11", "POSIX BSD OSX OSX11 X11"}, + {"freebsd", "POSIX BSD FREEBSD"}, + {"openbsd", "POSIX BSD OPENBSD"}, + {"netbsd", "POSIX BSD NETBSD"}, + {"dragonfly", "POSIX BSD DRAGONFLY"}, + {"solaris", "POSIX SOLARIS"} + }; + String p(s += 2); + int q = flags.Find(ToLower(p)); + if(q >= 0) + platformFlags = flags[q]; + else { + SilentMode = false; + Puts("Invalid target platform option: " << p << '\n'); + Puts("Available target platform options:\n" << Join(flags.GetKeys(), ", ") << '\n'); + SetExitCode(3); + return; + } + s += p.GetCount(); + } + break; + } default: SilentMode = false; - Puts("Invalid build option(s)"); + Puts("Invalid build option(s)\n"); SetExitCode(3); return; } @@ -202,6 +232,22 @@ CONSOLE_APP_MAIN if(f.GetCount()) ide.mainconfigparam = f[0].param; } + if(!IsNull(platformFlags)) { + if(!IsNull(ide.mainconfigparam)) { + Vector a = Split(platformFlags, ' '), + b = Split(ide.mainconfigparam, ' '); + const int n = b.GetCount(); + for(int i = n - 1; i >= 0; --i) + for(const String& p : a) + if(p == b[i]) + b.Remove(i); + if(n != b.GetCount()) + ide.mainconfigparam = Join(b, " "); + if(!IsNull(ide.mainconfigparam)) + ide.mainconfigparam.Insert(0, ' '); + } + ide.mainconfigparam.Insert(0, platformFlags); + } PutVerbose("Build flags: " << ide.mainconfigparam); String m = 2 < param.GetCount() ? param[2] : "CLANG"; String bp = GetBuildMethodPath(m); @@ -260,7 +306,7 @@ CONSOLE_APP_MAIN SetExitCode(1); } else - Puts("Usage: [-options] umk assembly main_package [build_method] [+flags] [output]\n\n" + Puts("Usage: umk assembly main_package [build_method] [-options] [+flags] [output]\n\n" "Examples: umk examples Bombs GCC -ab +GUI,SHARED ~/bombs\n" " umk examples,uppsrc Bombs ~/GCC.bm -rv +GUI,SHARED ~/bin\n\n" "See http://www.ultimatepp.org/app$ide$umk$en-us.html for details\n");