diff --git a/make/cpplint b/make/cpplint index faefee164e0..79b977478ea 100644 --- a/make/cpplint +++ b/make/cpplint @@ -2,4 +2,4 @@ PYTHON ?= python .PHONY: cpplint cpplint: - @$(PYTHON) $(CPPLINT)/cpplint.py --output=vs7 --counting=detailed --root=src --extension=hpp,cpp --filter=-runtime/indentation_namespace,-build/c++11,-readability/namespace,-legal/copyright,-whitespace/indent,-runtime/reference,-build/header_guard,-build/include_order,-build/include_what_you_use,-runtime/string,-build/namespaces $(shell find src/stan -name '*.hpp' -o -name '*.cpp') + @$(PYTHON) $(CPPLINT)/cpplint.py --output=vs7 --counting=detailed --root=src --extension=hpp,cpp --filter=-runtime/indentation_namespace,-build/c++11,-readability/namespace,-legal/copyright,-whitespace/indent,-runtime/reference,-build/header_guard,-build/include_order,-build/include_what_you_use,-runtime/string,-build/namespaces $(call findfiles,src/stan,*.hpp) $(call findfiles,src/stan,*.cpp) diff --git a/make/libstanc b/make/libstanc index d48bc5bc7f0..735eaf26a7d 100644 --- a/make/libstanc +++ b/make/libstanc @@ -1,7 +1,7 @@ ################################################################################ # libstanc build rules -STANC_TEMPLATE_INSTANTIATION_CPP := $(shell find src/stan/lang -type f -name '*_inst.cpp') $(shell find src/stan/lang -type f -name '*_def.cpp') +STANC_TEMPLATE_INSTANTIATION_CPP := $(call findfiles,src/stan/lang,*_inst.cpp) $(call findfiles,src/stan/lang,*_def.cpp) STANC_TEMPLATE_INSTANTIATION := $(STANC_TEMPLATE_INSTANTIATION_CPP:src/%.cpp=test/%.o) test/libstanc.a : $(STANC_TEMPLATE_INSTANTIATION) diff --git a/make/tests b/make/tests index aea7a43cbf1..80fc8728e0e 100644 --- a/make/tests +++ b/make/tests @@ -50,7 +50,7 @@ endif # needed by subset of unit tests that test stan compiler # all these tests are under stan/test/unit/lang ## -STANC_TESTS_HEADERS := $(shell find src/test/unit/lang -type f -name '*_test.cpp') +STANC_TESTS_HEADERS := $(call findfiles,src/test/unit/lang,*_test.cpp) STANC_TESTS_O := $(patsubst src/%.cpp,%.o,$(STANC_TESTS_HEADERS)) STANC_TESTS := $(patsubst src/%.cpp,%$(EXE),$(STANC_TESTS_HEADERS)) @@ -64,7 +64,7 @@ $(STANC_TESTS) : LDLIBS += $(LDLIBS_STANC) # Target to verify header files within Stan has # enough include calls ## -HEADER_TESTS := $(addsuffix -test,$(shell find src/stan -name '*.hpp' -type f)) +HEADER_TESTS := $(addsuffix -test,$(call findfiles,src/stan,*.hpp)) ifeq ($(OS),Windows_NT) DEV_NULL = nul @@ -160,7 +160,7 @@ test/test-models/stanc$(EXE) : %$(EXE) : %.o @mkdir -p $(dir $@) $(LINK.cpp) $< $(LDLIBS) $(OUTPUT_OPTION) -TEST_MODELS = $(shell find src/test/test-models -type f -name '*.stan') +TEST_MODELS = $(call findfiles,src/test/test-models,*.stan) $(patsubst src/%.stan,%.hpp,$(TEST_MODELS)) : test/test-models/%.hpp : src/test/test-models/%.stan test/test-models/stanc$(EXE) @mkdir -p $(dir $@) $(WINE) test/test-models/stanc$(EXE) $< --o=$@ @@ -168,7 +168,7 @@ $(patsubst src/%.stan,%.hpp,$(TEST_MODELS)) : test/test-models/%.hpp : src/test/ ## # Generate C++ from Stan standalone functions ## -TEST_FUNCTIONS = $(shell find src/test/test-models -type f -name '*.stanfuncs') +TEST_FUNCTIONS = $(call findfiles,src/test/test-models,*.stanfuncs) $(patsubst src/%.stanfuncs,%.hpp,$(TEST_FUNCTIONS)) : test/test-models/%.hpp : src/test/test-models/%.stanfuncs test/test-models/stanc$(EXE) @mkdir -p $(dir $@) $(WINE) test/test-models/stanc$(EXE) $< --o=$@ @@ -193,7 +193,7 @@ test/unit/lang/stanc_helper_test.o: change-file-permissions # Add additional dependencies for tests that should translate Stan to hpp, but # isn't included in the source using `#include`. ## -test/unit/lang/parser_generator_test$(EXE): $(patsubst src/%.stan,%.hpp,$(shell find src/test/test-models/good/parser-generator -type f -name '*.stan')) +test/unit/lang/parser_generator_test$(EXE): $(patsubst src/%.stan,%.hpp,$(call findfiles,src/test/test-models/good/parser-generator,*.stan)) ## # Compile models depends on every model within @@ -201,10 +201,10 @@ test/unit/lang/parser_generator_test$(EXE): $(patsubst src/%.stan,%.hpp,$(shell # be code-generated to a *.hpp, then passed through # the compiler using the -fsyntax-only flag ## -test/integration/compile_models_test$(EXE): $(patsubst src/%.stan,%.hpp-test,$(shell find src/test/test-models/good -type f -name '*.stan')) +test/integration/compile_models_test$(EXE): $(patsubst src/%.stan,%.hpp-test,$(call findfiles,src/test/test-models/good,*.stan)) ## # Same trick as above for models, but for standalone functions, using # "src/test/test-models/good-standalone-functions/*.stanfuncs" ## -test/integration/compile_standalone_functions_test$(EXE): $(patsubst src/%.stanfuncs,%.hpp-test,$(shell find src/test/test-models/good-standalone-functions -type f -name '*.stanfuncs')) +test/integration/compile_standalone_functions_test$(EXE): $(patsubst src/%.stanfuncs,%.hpp-test,$(call findfiles,src/test/test-models/good-standalone-functions,*.stanfuncs)) diff --git a/makefile b/makefile index da551f3baaa..839c6595c13 100644 --- a/makefile +++ b/makefile @@ -108,10 +108,10 @@ help: ## # Clean up. ## -MODEL_SPECS := $(shell find src/test -type f -name '*.stan') +MODEL_SPECS := $(call findfiles,src/test,*.stan) .PHONY: clean clean-demo clean-dox clean-models clean-all clean-deps clean: - $(RM) $(shell find src -type f -name '*.dSYM') $(shell find src -type f -name '*.d.*') + $(RM) $(call findfiles,src,*.dSYM) $(call findfiles,src,*.d.*) $(RM) $(wildcard $(MODEL_SPECS:%.stan=%.hpp)) $(RM) $(wildcard $(MODEL_SPECS:%.stan=%$(EXE))) $(RM) $(wildcard $(MODEL_SPECS:%.stan=%.o)) @@ -122,12 +122,12 @@ clean-dox: clean-deps: @echo ' removing dependency files' - $(shell find . -type f -name '*.d' -exec rm {} +) + $(RM) $(call findfiles,.,*.d) clean-all: clean clean-dox clean-deps clean-libraries $(RM) -r test bin @echo ' removing .o files' - $(shell find src -type f -name '*.o' -exec rm {} +) + $(RM) $(call findfiles,src,*.o) ## # Submodule related tasks