makefile - GNU Make Simply Expanded Variables and Automatic Variables -


i have simple makefile go project , want able run akin to: make release-all

in order build releases couple of different platforms (e.g. windows, linux, darwin).

my make file looks this:

gooses = darwin windows linux goarchs = amd64 386 .phony: release-all $(gooses) $(goarchs) release: $(gooses)  $(gooses): goos := app $@ $(gooses): $(goarchs)  $(goarchs): goarch := $@ $(goarchs): build  build: goos=$(goos) goarch=$(goarch) go install ... 

when try build though, get:

goos= goarch= go install ... 

so far can tell := isn't causing $@ evaluated on assignment. possible acheive somehow? if not, want iterate on each item in list of os'es , on each of architectures until i've built options. @ least possible without specifying each architecture/os combo explicitly?

assuming command works, handle iteration:

gooses = darwin windows linux goarchs = amd64 386  build:  define template build: build_$(1)_$(2) .phony: build_$(1)_$(2) build_$(1)_$(2):     goos=$(1) goarch=$(2) go install ... endef  $(foreach goarch,$(goarchs),$(foreach goos,$(gooses),$(eval $(call template,$(goos),$(goarch))))) 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -