Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions make/compiler_flags
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions make/libraries
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions make/tests
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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)


Expand All @@ -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)


Expand All @@ -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
Expand All @@ -86,6 +86,7 @@ test/dummy.cpp:
.PHONY: test-headers
test-headers: $(HEADER_TESTS)

ifdef GENERATE_DISTRIBUTION_TESTS
############################################################
##
# Test generator for distribution tests
Expand All @@ -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
26 changes: 15 additions & 11 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,29 @@ 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'
$(RM) -r doc/api

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

Expand Down