Skip to content

Commit

Permalink
Makefile: Platform independent OS detectio
Browse files Browse the repository at this point in the history
  • Loading branch information
eric15342335 committed Jun 8, 2024
1 parent 9fe547c commit ddc343f
Showing 1 changed file with 5 additions and 39 deletions.
44 changes: 5 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,11 @@ endif
# Set the number of jobs for parallel execution
MAKEFLAGS += --jobs=$(NUM_PROCESSORS)



# make \
compile program
# make all \
compile and run program
# make clean \
removes executable, object files, saves, and docs

# developer commands:
# make docs \
generates the html docs using Doxygen
# make fix \
formats the code using clang-format, commits, and pushes the changes
# make goto \
proceed several rounds automatically and print the price history graph
# make msvc \
compile the program using the Microsoft Visual C++ compiler
# make check \
check the code for formatting and static analysis issues

# Edit C++ compiler name you want to use.
CXX = g++

INCLUDES = -Iinclude
OUTPUT = stocksim
CXXFLAGS += -Wall -Wextra -pedantic -std=c++17 -Werror -g \
-Wcast-qual -Wundef -mtune=generic -Wswitch -Wshadow -Wformat=2
# -Wconversion -Wfloat-equal
# -fsanitize=address -fsanitize=undefined

# macOS uses clang++, which does not support these flag:
# -Wduplicated-cond -Wduplicated-branches
ifeq ($(CXX),g++)
# do not change $(OS) to $(shell uname) because on Windows
# it might be MinGW or MSYS2, not Windows_NT
ifneq ($(OS),Darwin)
CXXFLAGS += -Wduplicated-cond -Wduplicated-branches
endif
# Set the OS variable using uname
ifeq ($(shell uname),)
OS := Windows_NT
else
OS := $(shell uname)
endif

# eric15342335 will use the static flag on Windows.
Expand Down

0 comments on commit ddc343f

Please sign in to comment.