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
11 changes: 6 additions & 5 deletions make/program
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ $(CMDSTAN_MAIN_O) : $(CMDSTAN_MAIN)
##
# Precompiled model header
##
$(STAN)src/stan/model/model_header$(STAN_FLAGS)_$(CXX_MAJOR)_$(CXX_MINOR).d : $(STAN)src/stan/model/model_header.hpp
$(patsub %.d,%.hpp.gch,$(PRECOMPILED_MODEL_HEADER)) : $(STAN)src/stan/model/model_header.hpp
$(COMPILE.cpp) $(DEPFLAGS) $<

ifneq ($(PRECOMPILED_MODEL_HEADER),)
$(STAN)src/stan/model/model_header$(STAN_FLAGS)_$(CXX_MAJOR)_$(CXX_MINOR).d : DEPTARGETS = -MT $(patsubst %.d,%.hpp.gch,$@) -MT $@
$(STAN)src/stan/model/model_header$(STAN_FLAGS)_$(CXX_MAJOR)_$(CXX_MINOR).hpp.gch : $(STAN)src/stan/model/model_header.hpp
$(patsub %.d,%.hpp.gch,$(PRECOMPILED_MODEL_HEADER)) : DEPTARGETS = -MT $(patsubst %.d,%.hpp.gch,$@) -MT $@
$(PRECOMPILED_MODEL_HEADER) : $(STAN)src/stan/model/model_header.hpp
@echo ''
@echo '--- Compiling pre-compiled header. This might take a few seconds. ---'
@mkdir $(dir $@)
$(COMPILE.cpp) $< $(OUTPUT_OPTION)

ifeq ($(CXX_TYPE),clang)
CXXFLAGS_PROGRAM += -include-pch $(STAN)src/stan/model/model_header$(STAN_FLAGS)_$(CXX_MAJOR)_$(CXX_MINOR).hpp.gch
$(STAN_TARGETS) : %$(EXE) : $(STAN)src/stan/model/model_header$(STAN_FLAGS)_$(CXX_MAJOR)_$(CXX_MINOR).hpp.gch
CXXFLAGS_PROGRAM += -include-pch $(PRECOMPILED_MODEL_HEADER)
$(STAN_TARGETS) : %$(EXE) : $(PRECOMPILED_MODEL_HEADER)
endif
endif

Expand Down
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ PRECOMPILED_HEADERS ?= true
endif

ifeq ($(PRECOMPILED_HEADERS),true)
PRECOMPILED_MODEL_HEADER=$(STAN)src/stan/model/model_header$(STAN_FLAGS)_$(CXX_MAJOR)_$(CXX_MINOR).hpp.gch
PRECOMPILED_MODEL_HEADER=$(STAN)src/stan/model/model_header.hpp.gch/model_header$(STAN_FLAGS)_$(CXX_MAJOR)_$(CXX_MINOR).hpp.gch
ifeq ($(CXX_TYPE),gcc)
CXXFLAGS_PROGRAM+= -Wno-ignored-attributes $(CXXFLAGS_OPTIM) $(CXXFLAGS_FLTO)
endif
Expand Down Expand Up @@ -284,6 +284,7 @@ clean: clean-tests
$(RM) -r bin/cmdstan
@echo ' removing cached compiler objects'
$(RM) $(wildcard src/cmdstan/main*.o) $(wildcard $(STAN)src/stan/model/model_header*.hpp.gch)
$(RM) -r $(STAN)src/stan/model/model_header.hpp.gch/
@echo ' removing built example model'
$(RM) examples/bernoulli/bernoulli$(EXE) examples/bernoulli/bernoulli.o examples/bernoulli/bernoulli.d examples/bernoulli/bernoulli.hpp $(wildcard examples/bernoulli/*.csv)

Expand Down