Skip to content

Commit

Permalink
remove stanc2
Browse files Browse the repository at this point in the history
  • Loading branch information
rok-cesnovar committed Jan 27, 2021
1 parent abe1efb commit 40a92dd
Show file tree
Hide file tree
Showing 569 changed files with 6 additions and 46,778 deletions.
19 changes: 0 additions & 19 deletions make/libstanc

This file was deleted.

75 changes: 4 additions & 71 deletions make/tests
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
ifdef STANC2
TEST_STANC=test/test-models/stanc2$(EXE)
else
TEST_STANC=bin/stanc$(EXE)
endif

##
# Build/download stanc3
##
Expand Down Expand Up @@ -78,42 +72,10 @@ src/test/%.d : INC_FIRST = -I $(if $(STAN),$(STAN)/src,src) -I $(if $(STAN),$(ST
src/test/%.d : INC += $(INC_GTEST)
src/test/%.d : DEPTARGETS = -MT $(patsubst src/test/%.d,test/%.o,$@) -MT $@

## this is for the $(STANC_TEMPLATE_INSTANTIATION) files
src/stan/%.d : DEPTARGETS = -MT test/test-models/stanc2$(EXE) -MT $(patsubst src/%.d,test/%.o,$@) -MT $@

ifneq ($(filter test/%$(EXE),$(MAKECMDGOALS)),)
-include $(patsubst test/%$(EXE),src/test/%.d,$(filter test/%,$(MAKECMDGOALS)))
endif

ifneq ($(filter test/unit/lang/%$(EXE),$(MAKECMDGOALS)),)
-include src/test/test-models/stanc2.d
-include $(patsubst %.cpp,%.d,$(STANC_TEMPLATE_INSTANTIATION_CPP))
endif

ifneq ($(filter test/test-models/stanc2$(EXE) test/test-models/stanc2.o,$(MAKECMDGOALS)),)
-include src/test/test-models/stanc2.d
-include $(patsubst %.cpp,%.d,$(STANC_TEMPLATE_INSTANTIATION_CPP))
endif

ifneq ($(filter test/test-models/good/%.hpp test/test-models/good/%.hpp-test,$(MAKECMDGOALS)),)
-include src/test/test-models/stanc2.d
-include $(patsubst %.cpp,%.d,$(STANC_TEMPLATE_INSTANTIATION_CPP))
endif


##
# static rule to link in libstanc.
# needed by subset of unit tests that test stan compiler
# all these tests are under stan/test/unit/lang
##
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))

# add additional dependency to libstanc.a
$(STANC_TESTS_O) : test/libstanc.a
$(STANC_TESTS) : LDLIBS += $(LDLIBS_STANC)

############################################################
##
# Target to verify header files within Stan has
Expand Down Expand Up @@ -216,47 +178,18 @@ test/integration/multiple_translation_units_test$(EXE) : test/integration/libmtu
##
# Use the stanc compiler to generate C++ from Stan programs
##
test/test-models/stanc2$(EXE) : O = $(O_STANC)
test/test-models/stanc2$(EXE) : test/libstanc.a
test/test-models/stanc2$(EXE) : LDLIBS += $(LDLIBS_STANC)
test/test-models/stanc2$(EXE) : %$(EXE) : %.o
@mkdir -p $(dir $@)
$(LINK.cpp) $< $(LDLIBS) $(OUTPUT_OPTION)

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_STANC)
$(patsubst src/%.stan,%.hpp,$(TEST_MODELS)) : test/test-models/%.hpp : src/test/test-models/%.stan bin/stanc$(EXE)
@mkdir -p $(dir $@)
$(WINE) $(TEST_STANC) $< --o=$@
$(WINE) bin/stanc$(EXE) $< --o=$@

##
# Generate C++ from Stan standalone functions
##
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_STANC)
$(patsubst src/%.stanfuncs,%.hpp,$(TEST_FUNCTIONS)) : test/test-models/%.hpp : src/test/test-models/%.stanfuncs bin/stanc$(EXE)
@mkdir -p $(dir $@)
$(WINE) $(TEST_STANC) --standalone-functions $< --o=$@

##
# src/test/unit/lang/stanc_helper_test.cpp requires files to be read-only.
##
.PHONY: change-file-permissions
change-file-permissions:
ifeq ($(OS),Windows_NT)
attrib +r src\\test\\test-models\\good\\stanc_helper.stan
attrib +r src\\test\\test-models\\bad\\stanc_helper.stan
attrib +r src\\test\\test-models\\bad\\read_only
else
chmod 444 src/test/test-models/*/stanc_helper.stan
chmod 555 src/test/test-models/bad/read_only
endif

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,$(call findfiles,src/test/test-models/good/parser-generator,*.stan))
$(WINE) bin/stanc$(EXE) --standalone-functions $< --o=$@

##
# Compile models depends on every model within
Expand Down
8 changes: 0 additions & 8 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,16 @@ help:
-include make/local # user-defined variables

MATH ?= lib/stan_math/
ifeq ($(OS),Windows_NT)
O_STANC ?= 3
endif
O_STANC ?= 0

-include $(MATH)make/compiler_flags
-include $(MATH)make/dependencies
-include $(MATH)make/libraries
include make/libstanc # bin/libstanc.a
include make/doxygen # doxygen
include make/cpplint # cpplint
include make/tests # tests
include make/clang-tidy

INC_FIRST = -I $(if $(STAN),$(STAN)/src,src) -I ./src/
LDLIBS_STANC ?= -Ltest -lstanc


.PHONY: help
help:
Expand All @@ -42,7 +35,6 @@ help:
@echo ''
@echo 'Stan makefile:'
@$(MAKE) print-compiler-flags
@echo ' - O_STANC (Opt for stanc): ' $(O_STANC)
@echo ''
@echo 'Common targets:'
@echo ' Documentation:'
Expand Down
Loading

0 comments on commit 40a92dd

Please sign in to comment.