diff --git a/build/premake/premake.lua b/build/premake/premake.lua index cbd70d0f11..870e407735 100755 --- a/build/premake/premake.lua +++ b/build/premake/premake.lua @@ -298,8 +298,9 @@ end function setup_main_exe () create_package_with_cflags("pyrogenesis", "winexe") - - table.insert(package.files, "../../../source/main.cpp") + + package.files = { source_root .. "main.cpp" } + package.includepaths = { source_root } -- For VS2005, tell the linker to use the libraries' .obj files instead of -- the .lib, to allow incremental linking. diff --git a/build/premake/src/Src/gnu_cpp.c b/build/premake/src/Src/gnu_cpp.c index e7cace81fc..a9c3dd24bf 100644 --- a/build/premake/src/Src/gnu_cpp.c +++ b/build/premake/src/Src/gnu_cpp.c @@ -119,10 +119,13 @@ int gnu_cpp() io_print(" -s"); if (os_is("macosx") && prj_has_flag("dylib")) io_print(" -dynamiclib -flat_namespace"); + // Use start-group and end-group to get around the problem with the + // order of link arguments. + io_print(" -Xlinker --start-group"); print_list(prj_get_linkoptions(), " ", "", "", NULL); print_list(prj_get_libpaths(), " -L \"", "\"", "", NULL); print_list(prj_get_links(), " ", "", "", filterLinks); - io_print("\n"); + io_print(" -Xlinker --end-group\n"); /* Build a list of libraries this target depends on */ io_print(" LDDEPS :="); @@ -322,8 +325,9 @@ static const char* listCppTargets(const char* name) if (is_cpp(name)) { const char* ext = path_getextension(name); + const char* basename = path_getbasename(name); - sprintf(g_buffer, "$(OBJDIR)/%s.o: %s\n", path_getbasename(name), name); + sprintf(g_buffer, "$(OBJDIR)/%s.o: %s\n", basename, name); strcat(g_buffer, "\t-"); if (!g_verbose) strcat(g_buffer, "@"); @@ -350,7 +354,7 @@ static const char* listCppTargets(const char* name) if (matches(ext, ".s")) strcat(g_buffer, "$(CC) -x assembler-with-cpp $(CPPFLAGS) -o $@ -c $<\n"); else if (matches(ext, ".c")) - strcat(g_buffer, "$(CC) $(CFLAGS) -MF $(OBJDIR)/$($(OBJDIR)/$($(OBJDIR)/$(