summaryrefslogtreecommitdiffstats
path: root/solenv/gbuild/source_and_rerun.mk
blob: 1fe62c89eaa2afacd3a97371813225036c432505 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

gb_MAKEFILEDIR:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))

$(info gb_PARTIALBUILD $(gb_PARTIALBUILD))
ifneq ($(strip $(gb_PARTIALBUILD)),)

SRCDIR:=$(realpath $(gb_MAKEFILEDIR)/..)
gb_SourceEnvAndRecurse_reconfigure=true

else

SRCDIR:=$(realpath $(gb_MAKEFILEDIR))
gb_SourceEnvAndRecurse_reconfigure=$(MAKE) -f $(firstword $(MAKEFILE_LIST)) $(SRCDIR)/Env.Host.sh

endif

source-env-and-recurse:
	$(gb_SourceEnvAndRecurse_reconfigure) && \
	if test -f $(SRCDIR)/config.mk ; then . $(SRCDIR)/config.mk; fi && \
	if test -f $(SRCDIR)/Env.Host.sh; then . $(SRCDIR)/Env.Host.sh; fi && \
	if test -z "$${SOLARENV}"; then echo "no configuration found and could not create one" && exit 1; fi && \
	$(MAKE) -f $(firstword $(MAKEFILE_LIST)) $(MAKECMDGOALS)

ifneq ($(strip $(MAKECMDGOALS)),)
ifneq ($(MAKECMDGOALS),$(SRCDIR)/Env.Host.sh)
$(eval $(MAKECMDGOALS) : source-env-and-recurse)
endif
endif