Skip to content

Commit

Permalink
fix: no error report when 'build' folder is already exists on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
NichtsHsu committed Feb 18, 2024
1 parent e489a9e commit a156689
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ build-tests cc=default_cc:
#!/bin/bash
set -e
set -x
mkdir -p {{ outpath }}
mkdir -p "{{ outpath }}"
for src in {{ srcs }}; do
file=`basename $src`;
outbin="{{ outpath }}/${file%.*}";
{{ cc }} $src -I{{ include }} -o $outbin {{ cppflags }};
{{ cc }} $src -I"{{ include }}" -o "$outbin" {{ cppflags }};
done

run-tests cc=default_cc: (build-tests cc)
#!/bin/bash
set -e
set -x
for bin in {{ outpath }}/*; do
for bin in "{{ outpath }}"/*; do
$bin;
done

nmake-tests:
nmake -f nmakefile
Get-ChildItem build -Filter *.exe | Foreach-Object { & $_.FullName }
Get-ChildItem "{{ outpath }}" -Filter *.exe | Foreach-Object { & $_.FullName }

clean:
rm -r ./build
rm -r "{{ outpath }}"
10 changes: 5 additions & 5 deletions nmakefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

CC = cl
INCLUDES = ./include
CXXFLAGS = /std:c++20 /EHs /Wall /Fo./build/
OUTPATH = ./build
CXXFLAGS = /std:c++20 /EHs /Wall /Fo"$(OUTPATH)"

EXES = $(**:.cpp=.exe)

.SUFFIXES: .cpp .exe
all: tests\*.cpp
mkdir build
IF NOT EXIST "$(OUTPATH)" md "$(OUTPATH)"
$(MAKE) /f nmakefile $(EXES:tests=build)

{tests\}.cpp{build\}.exe:
$(CC) /I $(INCLUDES) $(CXXFLAGS) /Fe$@ $<
$(CC) /I "$(INCLUDES)" $(CXXFLAGS) /Fe"$@" "$<"

clean:
del /Q build
rd /s /q "$(OUTPATH)"

0 comments on commit a156689

Please sign in to comment.