Last active
November 2, 2019 07:29
-
-
Save RJ/6977165 to your computer and use it in GitHub Desktop.
Makefile fragment that generates makefile targets to call make with a given target on all apps/* subdirs.
Useful for erlang projects using erlang.mk that have apps/{app1,app2,app3..} structure (which rebar doesn't mind). Eg: call "make app" and it will call "make -C apps/app1 app; make -C apps/app2 app; ..." for you.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APPDIRS := $(wildcard apps/*) | |
## Example hack to filter one out: | |
## APPDIRS := $(filter-out apps/fooapp, $(APPDIRS)) | |
define PROXY_TARGET | |
$(1): | |
$(foreach appdir,$(APPDIRS),$(MAKE) -C $(appdir) $(1) ;) | |
endef | |
## add erlang.mk targets you care about here: | |
PROXY_TARGETS = all app clean built-plt dialyze docs tests | |
$(foreach targ,$(PROXY_TARGETS),$(eval $(call PROXY_TARGET,$(targ)))) | |
Hello Richard,
thanks for a snippet - this is very nice.
How do you build an app release with this make file? In the situation when you have an apps dir you would need to build a release using relx.config which would live in the root dir (which contains apps) and the release should pack all the applications in the apps?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is in my top-level Makefile, with the "real" makefiles that include erlang.mk in my various apps/ dirs.