mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-01 13:50:36 +00:00
Allow EXE name to have spaces in it
Makefile's generally hate spaces in filenames, and it's largely impossible to make them work. Due to that, with the change to use a `Makefile` the `EXE=` parameter did not work with spaces, and programs such as "foo bar.bas" would not compile because it produces "foo bar.exe" which has a space in the name. There were options here, but in this very specific case it is actually possible to allow the Makefile to work with spaces. `EXE` is only a single filename, so as long as we always quote it correctly and the provided `EXE=` parameter escapes the spaces with `\` then it will work. Thus, we modified the Makefile to always do the quoting, and modified QB64 to automatically escape the spaces in the executable name provided to the Makefile. I also modified the `compile_tests` to test that spaces in filenames and paths of the executable correctly compile. Fixes: #80
This commit is contained in:
parent
c05ba9cedc
commit
9e2177deff
2
Makefile
2
Makefile
|
@ -342,7 +342,7 @@ clean:
|
|||
$(RM) $(call FIXPATH,$(CLEAN_LIST))
|
||||
|
||||
$(EXE): $(EXE_OBJS) $(EXE_LIBS)
|
||||
$(CXX) $(CXXFLAGS) $(EXE_OBJS) -o $@ $(EXE_LIBS) $(CXXLIBS)
|
||||
$(CXX) $(CXXFLAGS) $(EXE_OBJS) -o "$@" $(EXE_LIBS) $(CXXLIBS)
|
||||
ifneq ($(filter-out osx,$(OS)),)
|
||||
$(OBJCOPY) --only-keep-debug "$@" "$(PATH_INTERNAL_TEMP)/$(notdir $@).sym"
|
||||
$(OBJCOPY) --strip-unneeded "$@"
|
||||
|
|
|
@ -12514,7 +12514,7 @@ END IF
|
|||
|
||||
CxxLibsExtra$ = mylib$ + " " + mylibopt$
|
||||
|
||||
makeline$ = make$ + makedeps$ + " EXE=" + AddQuotes$(path.exe$ + file$ + extension$)
|
||||
makeline$ = make$ + makedeps$ + " EXE=" + AddQuotes$(StrReplace$(path.exe$ + file$ + extension$, " ", "\ "))
|
||||
makeline$ = makeline$ + " CXXFLAGS_EXTRA=" + AddQuotes$(CxxFlagsExtra$)
|
||||
makeline$ = makeline$ + " CFLAGS_EXTRA=" + AddQuotes$(CxxFlagsExtra$) ' Just the -O flag, use for C files as well
|
||||
makeline$ = makeline$ + " CXXLIBS_EXTRA=" + AddQuotes$(CxxLibsExtra$)
|
||||
|
|
|
@ -21,29 +21,31 @@ show_incorrect_result()
|
|||
printf "GOT: '%s'\n" "$2"
|
||||
}
|
||||
|
||||
for test in $(ls ./tests/compile_tests)
|
||||
for test in ./tests/compile_tests/*
|
||||
do
|
||||
TESTCASE=$test
|
||||
EXE="$RESULTS_DIR/$test-output"
|
||||
test=$(basename "$test")
|
||||
|
||||
TESTCASE="$test"
|
||||
EXE="$RESULTS_DIR/$test - output"
|
||||
|
||||
# Clear out temp folder before next compile, avoids stale compilelog files
|
||||
rm -fr ./internal/temp/*
|
||||
|
||||
"$QB64" -x "./tests/compile_tests/$test/test.bas" -o "$EXE" 1>$RESULTS_DIR/$test-compile_result.txt
|
||||
"$QB64" -x "./tests/compile_tests/$test/test.bas" -o "$EXE" 1>"$RESULTS_DIR/$test-compile_result.txt"
|
||||
ERR=$?
|
||||
cp_if_exists ./internal/temp/compilelog.txt $RESULTS_DIR/$test-compilelog.txt
|
||||
cp_if_exists ./internal/temp/compilelog.txt "$RESULTS_DIR/$test-compilelog.txt"
|
||||
|
||||
(exit $ERR)
|
||||
assert_success_named "Compile" "Compilation Error:" show_failure $test
|
||||
assert_success_named "Compile" "Compilation Error:" show_failure "$test"
|
||||
|
||||
test -f "$EXE"
|
||||
assert_success_named "exe exists" "$test-output executable does not exist!" show_failure $test
|
||||
assert_success_named "exe exists" "$test-output executable does not exist!" show_failure "$test"
|
||||
|
||||
if [ ! -f "./tests/compile_tests/$test/test.output" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
expectedResult="$(cat ./tests/compile_tests/$test/test.output)"
|
||||
expectedResult="$(cat "./tests/compile_tests/$test/test.output")"
|
||||
|
||||
pushd . > /dev/null
|
||||
cd "./tests/compile_tests/$test"
|
||||
|
|
Loading…
Reference in a new issue