Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating make targets for models #140

Merged
merged 2 commits into from
Jul 10, 2013
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
44 changes: 44 additions & 0 deletions make/make_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
STAN_HOME = /Users/daniel/dev/stan
STAN_LIB = $(STAN_HOME)/lib
STAN_BIN = $(STAN_HOME)/bin

#CC = g++
CC = clang++
STANC = $(STAN_BIN)/stanc
AR = ar

O = 3
CFLAGS = -g -march=native -I$(STAN_HOME)/src -I$(STAN_LIB)/eigen_3.1.3 -I$(STAN_LIB)/boost_1.53.0 -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS
LDFLAGS = -L$(STAN_BIN) -lstan
EXE =
PATH_SEPARATOR = /

-include $(STAN_HOME)/make/detect_cc
-include $(STAN_HOME)/make/os_detect

MODEL_FILES = $(shell find . -type f -name '*.stan')
SRC_FILES = $(addsuffix .cpp,$(basename $(MODEL_FILES)))
OBJ_FILES = $(addsuffix .o,$(basename $(MODEL_FILES)))
EXE_FILES = $(addsuffix $(EXE),$(basename $(MODEL_FILES)))

models: normal

clean:
rm -f $(SRC_FILES) $(OBJ_FILES) $(EXE_FILES)

.PRECIOUS: %.o %.cpp
%.o : %.cpp
@echo ''
@echo '--- Compiling C++ code ---'
$(COMPILE.c) -O$O $(OUTPUT_OPTION) $<

$(patsubst %.stan,%,$(wildcard $(addsuffix .stan,$(MAKECMDGOALS)))) : %$(EXE): %.o
@echo ''
@echo '--- Linking C++ model ---'
$(LINK.c) -O$O $(OUTPUT_OPTION) $< $(LDLIBS)

%.cpp : %.stan
@echo ''
@echo '--- Translating Stan graphical model to C++ code ---'
$(STANC) $< --o=$@

8 changes: 7 additions & 1 deletion make/models
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
MODEL_HEADER := src/stan/model/model_header.hpp

.PRECIOUS: %.cpp %.o
%$(EXE): %.o bin/libstan.a
$(patsubst %.stan,%,$(wildcard $(addsuffix .stan,$(MAKECMDGOALS)))) : %$(EXE): %.o bin/libstan.a
@echo ''
@echo '--- Linking C++ model ---'
$(LINK.c) -O$O $(OUTPUT_OPTION) $< $(LDLIBS)

%.exe: %.o bin/libstan.a
@echo ''
@echo '--- Linking C++ model ---'
$(LINK.c) -O$O $(OUTPUT_OPTION) $< $(LDLIBS)


.PRECIOUS: %.cpp
%.cpp : %.stan $(MODEL_HEADER)$(PCH) bin/stanc$(EXE)
@echo ''
Expand Down
3 changes: 0 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ PATH_SEPARATOR = /
##
-include make/os_detect

%$(EXE) : %.o %.cpp bin/libstan.a
$(LINK.c) -O$O $(OUTPUT_OPTION) $< $(LDLIBS)

##
# Tell make the default way to compile a .o file.
##
Expand Down