Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions make_msys2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

case "$(uname)" in
*BSD) ccorder='clang gcc'; ldl= ;;
*) ccorder='gcc clang'; ldl='-ldl' ;;
esac

# auto detection of compiler
if [ -z "$CC" ]; then
for cctry in $ccorder; do
if $cctry --version > /dev/null 2>&1; then
CC=$cctry
break;
fi
done

if [ -z "$CC" ]; then
echo "No compiler found. Specify compiler by setting the CC environment variable." >&2
echo "Example: CC=gcc ./$0" >&2
exit 1
fi
fi

# the actual compile
echo "compiling using $CC..." >&2
$CC -Wall -pedantic -O1 src/tools/txt2c.c -o src/tools/txt2c
src/tools/txt2c src/base.lua src/tools.lua src/driver_gcc.lua src/driver_clang.lua src/driver_cl.lua src/driver_solstudio.lua src/driver_xlc.lua > src/internal_base.h
$CC -w -pedantic src/*.c src/lua/*.c -o bam -I src/lua -Os -s -flto $*
2 changes: 1 addition & 1 deletion src/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ end
[ModuleFilename] function.
@END]]--
function Import(filename)
local paths = {"", PathDir(ModuleFilename())}
local paths = {PathDir(ModuleFilename()), ""}

local s = os.getenv("BAM_PACKAGES")
if s then
Expand Down
2 changes: 1 addition & 1 deletion src/driver_gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end
function DriverGCC_Lib(output, inputs, settings)
-- output archive must be removed because ar will update existing archives, possibly leaving stray objects
local e = "rm -f " .. output .. " 2> /dev/null; "
local e = e .. settings.lib.exe .. " rcu " .. output
local e = e .. settings.lib.exe .. " rc " .. output
local e = e .. " " .. TableToString(inputs, '', ' ') .. settings.lib.flags:ToString()
return e
end
Expand Down