Add bootstrap Makefile create premake initial executable

On a fresh clone, Bootstrap.mak can be used to prepare the initial premake executable on Windows, OSX and Linux.
This commit is contained in:
Tim Wharton 2015-06-06 02:56:39 +01:00
parent 913245013e
commit 42b3ca2c51
4 changed files with 81 additions and 2 deletions

View File

@ -26,7 +26,18 @@ BUILDING FROM A SOURCE PACKAGE
BUILDING FROM THE REPOSITORY
If you have pulled sources from the Premake source repository, you will need
If you have pulled sources from the Premake source repository, you can
use `Bootstrap.mak` to generate your first premake executable:
$ git submodule init
$ git submodule update
$ make -f Bootstrap.mak PLATFORM
Where PLATFORM can be osx or linux. On Windows use nmake:
$ nmake -f Bootstrap.mak windows
If your toolset is not supported by the bootstrap Makefile, you will need
to embed the scripts into a C source file so they may be built into the
executable, and also generate the project files for your chosen toolset. In
order do either of these things, you will need a working Premake executable.

64
Bootstrap.mak Normal file
View File

@ -0,0 +1,64 @@
LUA_DIR=src/host/lua-5.1.4/src
SRC= src/host/*.c \
$(LUA_DIR)/lapi.c \
$(LUA_DIR)/lcode.c \
$(LUA_DIR)/ldebug.c \
$(LUA_DIR)/ldump.c \
$(LUA_DIR)/lgc.c \
$(LUA_DIR)/liolib.c \
$(LUA_DIR)/lmathlib.c \
$(LUA_DIR)/loadlib.c \
$(LUA_DIR)/lopcodes.c \
$(LUA_DIR)/lparser.c \
$(LUA_DIR)/lstring.c \
$(LUA_DIR)/ltable.c \
$(LUA_DIR)/ltm.c \
$(LUA_DIR)/lvm.c \
$(LUA_DIR)/lbaselib.c \
$(LUA_DIR)/ldblib.c \
$(LUA_DIR)/ldo.c \
$(LUA_DIR)/lfunc.c \
$(LUA_DIR)/linit.c \
$(LUA_DIR)/llex.c \
$(LUA_DIR)/lmem.c \
$(LUA_DIR)/lobject.c \
$(LUA_DIR)/loslib.c \
$(LUA_DIR)/lstate.c \
$(LUA_DIR)/lstrlib.c \
$(LUA_DIR)/ltablib.c \
$(LUA_DIR)/lundump.c \
$(LUA_DIR)/lzio.c
PLATFORM= none
default: $(PLATFORM)
none:
@echo "Please do"
@echo " nmake -f Bootstrap.mak windows"
@echo "or"
@echo " make -f Bootstrap.mak PLATFORM"
@echo "where PLATFORM is one of these:"
@echo " osx linux"
osx: $(SRC)
mkdir -p build/bootstrap
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -I"$(LUA_DIR)" -framework CoreServices $?
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN`
linux: $(SRC)
mkdir -p build/bootstrap
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -I"$(LUA_DIR)" $? -lm
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN`
windows: $(SRC)
if not exist build\bootstrap (mkdir build\bootstrap)
cl /Fo.\build\bootstrap\ /Fe.\build\bootstrap\premake_bootstrap.exe /DPREMAKE_NO_BUILTIN_SCRIPTS /I"$(LUA_DIR)" user32.lib ole32.lib $**
.\build\bootstrap\premake_bootstrap.exe embed
.\build\bootstrap\premake_bootstrap --to=build/bootstrap vs2012
devenv .\build\bootstrap\Premake5.sln /Upgrade
devenv .\build\bootstrap\Premake5.sln /Build Release

View File

@ -129,7 +129,7 @@
for _, name in ipairs { ".git" } do
os.rmdir(path.join(module, name))
end
for _, name in ipairs { ".DS_Store", ".git", ".gitignore", ".gitmodules", ".travis.yml", ".editorconfig" } do
for _, name in ipairs { ".DS_Store", ".git", ".gitignore", ".gitmodules", ".travis.yml", ".editorconfig", "Bootstrap.mak" } do
os.remove(path.join(module, name))
end
end

View File

@ -293,6 +293,7 @@ int premake_test_file(lua_State* L, const char* filename, int searchMask)
if (path && do_locate(L, filename, path)) return OKAY;
}
#if !defined(PREMAKE_NO_BUILTIN_SCRIPTS)
if ((searchMask & TEST_EMBEDDED) != 0) {
/* Try to locate a record matching the filename */
for (i = 0; builtin_scripts_index[i] != NULL; ++i) {
@ -304,6 +305,7 @@ int premake_test_file(lua_State* L, const char* filename, int searchMask)
}
}
}
#endif
return !OKAY;
}
@ -475,12 +477,14 @@ int premake_load_embedded_script(lua_State* L, const char* filename)
#endif
/* Try to locate a record matching the filename */
#if !defined(PREMAKE_NO_BUILTIN_SCRIPTS)
for (i = 0; builtin_scripts_index[i] != NULL; ++i) {
if (strcmp(builtin_scripts_index[i], filename) == 0) {
chunk = builtin_scripts[i];
break;
}
}
#endif
if (chunk == NULL) {
return !OKAY;