Skip to content

Commit

Permalink
Makefile: fix 'make fix' with specified OUTPUT
Browse files Browse the repository at this point in the history
  • Loading branch information
eric15342335 committed Jun 16, 2024
1 parent ec3d2a7 commit 2af9220
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ stocksim: main.o stock.o random_price.o events.o names.o \
$(CXX) $(INCLUDES) $(CXXFLAGS) $^ -o $(OUTPUT)

all: clean
$(MAKE) stocksim
$(MAKE) stocksim OUTPUT=$(OUTPUT)
./$(OUTPUT)

goto: stocksim
Expand Down Expand Up @@ -131,10 +131,16 @@ fix:
git commit -a -m "Formatting: Run clang-format" -m "From Makefile: make fix"
git push

ifeq ($(MAKECMDGOALS),msvc)
ifeq ($(OUTPUT),stocksim)
OUTPUT = stocksim-msvc.exe
endif
endif

msvc: src/*.cpp include/*.h clean
cl -std:c++17 -EHsc -utf-8 -Iinclude -W1 -WX -O1 -guard:cf -MP \
src/*.cpp -Fe:stocksim-msvc.exe
rm *.obj *.ilk || true
src/*.cpp -Fe:$(OUTPUT)
rm *.obj || true

format-check:
clang-format --dry-run --Werror src/*.cpp include/*.h
Expand Down

0 comments on commit 2af9220

Please sign in to comment.