diff --git a/src/app/main.cpp b/src/app/main.cpp
index d838c0b..d00cba2 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -157,7 +157,7 @@ int main(int argc, char* argv[])
     }
 
     // ### HACK: pass the modified MAKEFLAGS variable to our environment.
-    if (g_options.isMaxNumberOfJobsSet) {
+    if (g_options().isMaxNumberOfJobsSet) {
         ProcessEnvironment environment = mkfile->macroTable()->environment();
         environment[QLatin1String("MAKEFLAGS")] = mkfile->macroTable()->macroValue(QLatin1String("MAKEFLAGS"));
         MacroTable *mt = const_cast<MacroTable *>(mkfile->macroTable());
diff --git a/src/jomlib/makefile.cpp b/src/jomlib/makefile.cpp
index c54f30a..384edbe 100644
--- a/src/jomlib/makefile.cpp
+++ b/src/jomlib/makefile.cpp
@@ -515,7 +515,7 @@ void Makefile::applyInferenceRules(QList<DescriptionBlock*> targets)
     if (!m_batchModeTargets.isEmpty()) {
         foreach (const InferenceRule *rule, m_batchModeRules) {
             QList<DescriptionBlock*> allBatchTargets = m_batchModeTargets.values(rule);
-            int filesPerBatch = qMax(1, qRound(float(allBatchTargets.count()) / float(g_options.maxNumberOfJobs)));
+            int filesPerBatch = qMax(1, qRound(float(allBatchTargets.count()) / float(g_options().maxNumberOfJobs)));
             do {
                 QList<DescriptionBlock*> batch;
                 for (int i=0; i < filesPerBatch && !allBatchTargets.isEmpty(); ++i)
diff --git a/src/jomlib/options.cpp b/src/jomlib/options.cpp
index df0848b..5ec4557 100644
--- a/src/jomlib/options.cpp
+++ b/src/jomlib/options.cpp
@@ -32,7 +32,14 @@
 
 namespace NMakeFile {
 
-GlobalOptions g_options;
+
+GlobalOptions& g_options()
+{
+    static GlobalOptions instance;
+    printf("GlobalOptions::isMaxNumberOfJobsSet : %s\n", instance.isMaxNumberOfJobsSet ? "true" : "false");
+    return instance;
+}
+
 
 GlobalOptions::GlobalOptions()
 :   maxNumberOfJobs(QThread::idealThreadCount()),
@@ -286,12 +293,12 @@ bool Options::handleCommandLineOption(const QStringList &originalArguments, QStr
                         arg.clear();
                     }
                     bool ok;
-                    g_options.maxNumberOfJobs = nJobsStr.toUInt(&ok);
+                    g_options().maxNumberOfJobs = nJobsStr.toUInt(&ok);
                     if (!ok) {
                         fprintf(stderr, "Error: option -j expects a numerical argument\n");
                         return false;
                     }
-                    g_options.isMaxNumberOfJobsSet = true;
+                    g_options().isMaxNumberOfJobsSet = true;
                     if (makeflags.at(makeflags.count() - 1).toUpper() == QLatin1Char('J'))
                         makeflags += nJobsStr;
                     break;
diff --git a/src/jomlib/options.h b/src/jomlib/options.h
index f5d8cbb..57ce161 100644
--- a/src/jomlib/options.h
+++ b/src/jomlib/options.h
@@ -77,6 +77,6 @@ public:
     bool isMaxNumberOfJobsSet;
 };
 
-extern GlobalOptions g_options;
+GlobalOptions& g_options();
 
 } // namespace NMakeFile
diff --git a/src/jomlib/targetexecutor.cpp b/src/jomlib/targetexecutor.cpp
index 4fe2d8a..d6afaa9 100644
--- a/src/jomlib/targetexecutor.cpp
+++ b/src/jomlib/targetexecutor.cpp
@@ -40,7 +40,7 @@ TargetExecutor::TargetExecutor(const ProcessEnvironment &environment)
     m_makefile = 0;
     m_depgraph = new DependencyGraph();
 
-    for (int i=0; i < g_options.maxNumberOfJobs; ++i) {
+    for (int i=0; i < g_options().maxNumberOfJobs; ++i) {
         CommandExecutor* process = new CommandExecutor(this, environment);
         if (i == 0) process->setBufferedOutput(false);
         connect(process, SIGNAL(finished(CommandExecutor*, bool)), this, SLOT(onChildFinished(CommandExecutor*, bool)));
@@ -121,8 +121,7 @@ void TargetExecutor::startProcesses()
             if (m_bAborted || m_blockingCommand)
                 return;
         }
-
-        if (m_availableProcesses.count() == g_options.maxNumberOfJobs) {
+        if (m_availableProcesses.count() == g_options().maxNumberOfJobs) {
             if (m_pendingTargets.isEmpty()) {
                 finishBuild(0);
             } else {
