1# the above include may override LKROOT and LKINC to allow external
2# directories to be included in the build
3-include lk_inc.mk
4
5LKMAKEROOT ?= .
6LKROOT ?= .
7LKINC ?=
8BUILDROOT ?= .
9DEFAULT_PROJECT ?=
10TOOLCHAIN_PREFIX ?=
11
12# check if LKROOT is already a part of LKINC list and add it only if it is not
13ifeq ($(filter $(LKROOT),$(LKINC)), )
14LKINC := $(LKROOT) $(LKINC)
15endif
16
17# add the external path to LKINC
18ifneq ($(LKROOT),.)
19LKINC += $(LKROOT)/external
20else
21LKINC += external
22endif
23
24export LKMAKEROOT
25export LKROOT
26export LKINC
27export BUILDROOT
28export DEFAULT_PROJECT
29export TOOLCHAIN_PREFIX
30
31# veneer makefile that calls into the engine with lk as the build root
32# if we're the top level invocation, call ourselves with additional args
33_top:
34	@$(MAKE) -C $(LKMAKEROOT) -rR -f $(LKROOT)/engine.mk $(addprefix -I,$(LKINC)) $(MAKECMDGOALS)
35
36# If any arguments were provided, create a recipe for them that depends
37# on the _top rule (thus calling it), but otherwise do nothing.
38# "@:" (vs empty rule ";") prevents extra "'foo' is up to date." messages from
39# being emitted.
40$(MAKECMDGOALS): _top
41	@:
42
43.PHONY: _top
44