summaryrefslogtreecommitdiff
path: root/utils/makefile.lxc
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2020-03-15 17:01:36 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2020-03-15 17:01:36 +0100
commit86e79488aab3ff434c6682a9464ba2eee49158e9 (patch)
tree3ad002dc0c5467ab9fec9e2a65b8124304c1bac4 /utils/makefile.lxc
parent26b85659c0b7c9bf545dfe4edeedc3ccf247bc97 (diff)
LXC: utils/makefile.lxc (inital) add /.lxcenv.mk to contaiiners
Get LXC environment when building make targets. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/makefile.lxc')
-rw-r--r--utils/makefile.lxc29
1 files changed, 29 insertions, 0 deletions
diff --git a/utils/makefile.lxc b/utils/makefile.lxc
new file mode 100644
index 000000000..8b79994ee
--- /dev/null
+++ b/utils/makefile.lxc
@@ -0,0 +1,29 @@
+# -*- coding: utf-8; mode: makefile-gmake -*-
+#
+# LXC environment
+# ===============
+#
+# To activate/deactivate LXC makefile environment in a container, set/unset link
+# from root '/.lxcenv.mk' to *this* file::
+#
+# sudo make ./utils/makefile.lxc lxc-activate
+# sudo make ./utils/makefile.lxc lxc-deactivate
+
+LXC_ENV_FOLDER=/lxc-$(shell hostname)
+
+lxc-help::
+ @echo 'LXC: running in container LXC_ENV_FOLDER=$(LXC_ENV_FOLDER)'
+
+# If not activated, serve target 'lxc-activate' ..
+ifeq (,$(wildcard /.lxcenv.mk))
+PHONY += lxc-activate
+lxc-activate:
+ ln -s "$(abspath $(lastword $(MAKEFILE_LIST)))" "/.lxcenv.mk"
+else
+# .. and if activated, serve target 'lxc-deactivate'.
+PHONY += lxc-deactivate
+lxc-deactivate:
+ rm /.lxcenv.mk
+endif
+
+.PHONY: $(PHONY)