I can help you with the target. What you want to do is have the dependency on the right side of the colon, which is the source file itself. 

With regards to generating the compiled object code versus a precompiled header, just do a quick check on sizes of the output files. They are different on the mac when generated with clang++. I'm curious if that's not true on under Linux. I know what the doc says; I just don't believe it. Especially since precompiled headers aren't supported very well. 



On May 29, 2013, at 8:51 PM, bgoodri <notifications@github.com> wrote:

> In make/tests:
> 
> > +HEADER_TESTS := $(shell find src/stan -name '*.hpp' -type f)
> > +ifeq ($(OS),win)
> > +	BITBUCKET = nul
> > +else
> > +	BITBUCKET = /dev/null
> > +endif
> > +
> > +.PHONY: test-headers
> > +test-headers: $(HEADER_TESTS)
> > +	@echo
> > +	@echo 'Testing whether all relevant headers can be precompiled'
> > +	@$(MAKE) $(patsubst src/stan/%.hpp,src/stan/%$(PCH),$(HEADER_TESTS))
> > +	@echo
> > +	@echo 'All relevant headers do precompile'
> > +
> > +.SUFFIXES: $(PCH) .hpp
> Using a pattern rule is what I had done originally. But if I had a target like
> 
> stan/src/%.$(PCH) : $(HEADER_TESTS)
> 
> what happened was if someone for example did make CC=clang++ src/stan/prob/transform.pch it would make a precompiled header out of every header, not just src/stan/prob/transform.hpp . So, when I would do make CC=clang++ test-headers, it would call $(MAKE) on each individual entry in $(HEADER_TESTS) which was causing it to go through the tree twice: The first time would succeed, the second time would say everything was up to date, and thus it would terminate instead of going through the whole tree for as many times as there were entries in $(HEADER_TESTS).
> 
> Maybe there is a way to have it only go through the tree once with a pattern rule, but I couldn't figure out how to do that except to change it to a a suffix rule.
> 
> —
> Reply to this email directly or view it on GitHub.