Skip to content

Commit 1c5fc92

Browse files
committed
Add -Wshadow, improve support for MinGW
1 parent 415f9ae commit 1c5fc92

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
ifeq ($(OS),Windows_NT)
99
UNAME_S := $(OS)
10+
ifeq ($(shell gcc -dumpmachine),mingw32)
11+
MINGW_CXXFLAGS = -U__STRICT_ANSI__
12+
endif
1013
else
1114
UNAME_S := $(shell uname -s)
1215
endif
1316

14-
# For Darwin (Mac OS X) we assume that the default compiler
17+
# For Darwin (Mac OS X / macOS) we assume that the default compiler
1518
# clang++ is used; when $(CXX) is some version of g++, then
1619
# $(CXXSTD) has to be set to -std=c++11 (or newer) so
1720
# that -stdlib=libc++ is not automatically added.
@@ -27,23 +30,25 @@ endif
2730
# changed if desired.
2831

2932
CPPFLAGS ?= -pedantic
30-
CXXFLAGS ?= -Wall -Wextra -Werror -O3
31-
32-
.PHONY: all compile check clean
33+
CXXFLAGS ?= -Wall -Wextra -Wshadow -Werror -O3 $(MINGW_CXXFLAGS)
3334

3435
SOURCES := $(shell find src -name '*.cpp')
3536
DEPENDS := $(SOURCES:%.cpp=build/%.d)
3637
BINARIES := $(SOURCES:%.cpp=build/%)
3738

3839
UNIT_TESTS := $(filter build/src/test/%,$(BINARIES))
3940

41+
.PHONY: all
4042
all: compile check
4143

44+
.PHONY: compile
4245
compile: $(BINARIES)
4346

47+
.PHONY: check
4448
check: $(UNIT_TESTS)
4549
@set -e; for T in $(UNIT_TESTS); do echo $$T; $$T > /dev/null; done
4650

51+
.PHONY: clean
4752
clean:
4853
@rm -rf build
4954
@find . -name '*~' -delete

0 commit comments

Comments
 (0)