diff --git a/make/compiler_flags b/make/compiler_flags index 60ede66b68c..929647ee77d 100644 --- a/make/compiler_flags +++ b/make/compiler_flags @@ -1,3 +1,11 @@ +# Find files subroutine for different operating system +# This is recursive version of the makefiles wildcard function +findfiles = $(foreach d,$(wildcard $(addsuffix *,$(1))),$(call findfiles,$(d)/,$(2)) $(wildcard $(d)/$(2))) + +ifneq ($(OS),Windows_NT) +GENERATE_DISTRIBUTION_TESTS=true +endif + # Detect operating system, set default compiler, and detect compiler type # The defaults are configured for the compilers we test: # https://github.com/stan-dev/stan/wiki/Supported-C---Compilers-and-Language-Features diff --git a/make/libraries b/make/libraries index 5f38b06a20a..c50b9793dcb 100644 --- a/make/libraries +++ b/make/libraries @@ -74,7 +74,7 @@ $(SUNDIALS)/lib/libsundials_nvecserial.a: $(SUNDIALS_NVECSERIAL) LIBSUNDIALS := $(SUNDIALS)/lib/libsundials_nvecserial.a $(SUNDIALS)/lib/libsundials_cvodes.a $(SUNDIALS)/lib/libsundials_idas.a $(SUNDIALS)/lib/libsundials_kinsol.a -STAN_SUNDIALS_HEADERS := $(shell find $(MATH)stan -name *cvodes*.hpp) $(shell find $(MATH)stan -name *idas*.hpp) $(shell find $(MATH)stan -name *kinsol*.hpp) +STAN_SUNDIALS_HEADERS := $(call findfiles,$(MATH)stan,*cvodes*.hpp) $(call findfiles,$(MATH)stan,*idas*.hpp) $(call findfiles,$(MATH)stan,*kinsol*.hpp) $(STAN_SUNDIALS_HEADERS) : $(LIBSUNDIALS) clean-sundials: @@ -196,7 +196,7 @@ $(BOOST)/stage/lib/libboost_mpi.dylib: $(BOOST)/stage/lib/mpi.so $(BOOST)/stage/ install_name_tool -change libboost_serialization.dylib @rpath/libboost_serialization.dylib "$(BOOST)/stage/lib/libboost_mpi.dylib" install_name_tool -id @rpath/libboost_mpi.dylib "$(BOOST)/stage/lib/libboost_mpi.dylib" -MPI_TEMPLATE_INSTANTIATION_CPP := $(shell find $(MATH)stan -type f -name 'mpi_*_inst.cpp') $(shell find $(MATH)stan -type f -name 'mpi_*_def.cpp') +MPI_TEMPLATE_INSTANTIATION_CPP := $(call findfiles,$(MATH)stan,mpi_*_inst.cpp) $(call findfiles,$(MATH)stan,mpi_*_def.cpp) MPI_TEMPLATE_INSTANTIATION := $(MPI_TEMPLATE_INSTANTIATION_CPP:%.cpp=%.o) $(MPI_TEMPLATE_INSTANTIATION) : CXXFLAGS += -fPIC diff --git a/make/tests b/make/tests index 0b0095ebf68..25344579189 100644 --- a/make/tests +++ b/make/tests @@ -40,7 +40,7 @@ test/unit/multiple_translation_units_test$(EXE): test/unit/libmultiple.so # CVODES tests ## -CVODES_TESTS := $(subst .cpp,$(EXE),$(shell find test -name *cvodes*_test.cpp) $(shell find test -name *_bdf_*_test.cpp) $(shell find test -name *_adams_*_test.cpp)) +CVODES_TESTS := $(subst .cpp,$(EXE),$(call findfiles,test,*cvodes*_test.cpp) $(call findfiles,test,*_bdf_*_test.cpp) $(call findfiles,test,*_adams_*_test.cpp)) $(CVODES_TESTS) : $(LIBSUNDIALS) @@ -49,7 +49,7 @@ $(CVODES_TESTS) : $(LIBSUNDIALS) # IDAS tests ## -IDAS_TESTS := $(subst .cpp,$(EXE),$(shell find test -name *idas*_test.cpp) $(shell find test -name *_dae*_test.cpp)) +IDAS_TESTS := $(subst .cpp,$(EXE),$(call findfiles,test,*idas*_test.cpp) $(call findfiles,test,*_dae*_test.cpp)) $(IDAS_TESTS) : $(LIBSUNDIALS) @@ -58,7 +58,7 @@ $(IDAS_TESTS) : $(LIBSUNDIALS) # KINSOL tests ## -ALGEBRA_SOLVER_TESTS := $(subst .cpp,$(EXE),$(shell find test -name *algebra_solver*_test.cpp)) +ALGEBRA_SOLVER_TESTS := $(subst .cpp,$(EXE),$(call findfiles,test,*algebra_solver*_test.cpp)) $(ALGEBRA_SOLVER_TESTS) : $(LIBSUNDIALS) @@ -67,7 +67,7 @@ $(ALGEBRA_SOLVER_TESTS) : $(LIBSUNDIALS) # Target to verify header files within Stan has # enough include calls ## -HEADER_TESTS := $(addsuffix -test,$(shell find stan -name '*.hpp' -type f)) +HEADER_TESTS := $(addsuffix -test,$(call findfiles,stan,*.hpp)) ifeq ($(OS),Windows_NT) DEV_NULL = nul @@ -86,6 +86,7 @@ test/dummy.cpp: .PHONY: test-headers test-headers: $(HEADER_TESTS) +ifdef GENERATE_DISTRIBUTION_TESTS ############################################################ ## # Test generator for distribution tests @@ -108,3 +109,4 @@ LIST_OF_GENERATED_TESTS := $(shell find test/prob -type f -name '*_test.hpp' | s .PHONY: generate-tests generate-tests: $(LIST_OF_GENERATED_TESTS) +endif diff --git a/makefile b/makefile index 96d19852704..cba287ce86e 100644 --- a/makefile +++ b/makefile @@ -98,15 +98,15 @@ doxygen: .PHONY: clean clean-doxygen clean-deps clean-all clean: @echo ' removing test executables' - $(shell find test -type f -name "*_test$(EXE)" -exec rm {} +) - $(shell find test -type f -name "*_test.d" -exec rm {} +) - $(shell find test -type f -name "*_test.d.*" -exec rm {} +) - $(shell find test -type f -name "*_test.xml" -exec rm {} +) - $(shell find test -type f -name "*.o" -exec rm {} +) - $(RM) $(wildcard $(GTEST)/src/gtest-all.o) + @$(RM) $(call findfiles,test,*_test$(EXE)) + @$(RM) $(call findfiles,test,*_test.d) + @$(RM) $(call findfiles,test,*_test.d.*) + @$(RM) $(call findfiles,test,*_test.xml) + @$(RM) $(call findfiles,test,*.o) + @$(RM) $(wildcard $(GTEST)/src/gtest-all.o) @echo ' removing generated test files' - $(RM) $(wildcard test/prob/generate_tests$(EXE)) - $(shell find test/prob -name '*_generated_*_test.cpp' -type f -exec rm {} +) + @$(RM) $(wildcard test/prob/generate_tests$(EXE)) + @$(RM) $(call findfiles,test/prob,*_generated_*_test.cpp) clean-doxygen: @echo ' removing doxygen' @@ -114,9 +114,13 @@ clean-doxygen: clean-deps: @echo ' removing dependency files' - $(shell find stan test lib -type f -name '*.d' -exec rm {} +) - $(shell find stan test lib -type f -name '*.d.*' -exec rm {} +) - $(shell find stan -type f -name '*.dSYM' -exec rm {} +) + @$(RM) $(call findfiles,stan,*.d) + @$(RM) $(call findfiles,test,*.d) + @$(RM) $(call findfiles,lib,*.d) + @$(RM) $(call findfiles,stan,*.d.*) + @$(RM) $(call findfiles,test,*.d.*) + @$(RM) $(call findfiles,lib,*.d.*) + @$(RM) $(call findfiles,stan,*.dSYM) clean-all: clean clean-doxygen clean-deps clean-libraries