Skip to content

Commit 243c31b

Browse files
authored
Merge pull request #3183 from stan-dev/makefile/no-implicit-suffixes
Makefile: Disable Make's implict suffix rules
2 parents 01fa440 + b029119 commit 243c31b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

make/compiler_flags

+7
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ CXX_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion 2>&1)
7070
CXX_MAJOR := $(word 1,$(subst ., ,$(CXX_VERSION)))
7171
CXX_MINOR := $(word 2,$(subst ., ,$(CXX_VERSION)))
7272

73+
# disable Make's implicit suffix rules
74+
# see: https://www.gnu.org/software/make/manual/html_node/Implicit-Rules.html
75+
# this should make Make slightly faster, as well as avoiding some unexpected
76+
# behavior when there are other files lying around with the same name as
77+
# Stan models
78+
.SUFFIXES: .cpp
79+
7380
################################################################################
7481
# Set optional compiler flags for performance
7582
#

make/libraries

+2-5
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,8 @@ endif
252252
############################################################
253253
# Google Test:
254254
# Build the google test library.
255-
$(GTEST)/src/gtest-all.o: CXXFLAGS += $(CXXFLAGS_GTEST)
256-
$(GTEST)/src/gtest-all.o: CPPFLAGS += $(CPPFLAGS_GTEST)
257-
$(GTEST)/src/gtest-all.o: INC += $(INC_GTEST)
258-
259-
255+
$(GTEST)/src/gtest-all.o: $(GTEST)/src/gtest-all.cc
256+
$(COMPILE.cpp) -x c++ $(CXXFLAGS_GTEST) $(CPPFLAGS_GTEST) $(INC_GTEST) -o $@ -c $<
260257

261258
############################################################
262259
# Clean all libraries

0 commit comments

Comments
 (0)