How can I get a Makefile target to be called multiple times? -


in simple example below, want make dist , have distclean target executed before distdebug and distrelease.

.phony: distclean  dist: distdebug distrelease     @echo in dist  distdebug: distclean     @echo in distdebug  distrelease:               @echo in distrelease  distclean:     @echo in distclean 

unfortunately, despite using .phony, distclean called once:

vagrant@precise32:/tmp$ make dist in distclean in distdebug in distrelease in dist 

i'm guessing make knows run distclean once, it's not running again. how can make run distclean multiple times?

you can't using normal rules. make ever build given target 1 time. can using recursive make invocations:

distdebug:         $(make) distclean         @echo in distdebug distrelease:         $(make) distclean         @echo in distrelease 

in general it's idea plan build differently, though, , have targets different types of builds put different subdirectories. way don't have clean in between.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -