makefile.lxc 863 B

123456789101112131415161718192021222324252627282930313233
  1. # -*- coding: utf-8; mode: makefile-gmake -*-
  2. #
  3. # LXC environment
  4. # ===============
  5. #
  6. # To activate/deactivate LXC makefile environment in a container, set/unset link
  7. # from root '/.lxcenv.mk' to *this* file::
  8. #
  9. # sudo make ./utils/makefile.lxc lxc-activate
  10. # sudo make ./utils/makefile.lxc lxc-deactivate
  11. LXC_ENV_FOLDER=lxc-env/$(shell hostname)/
  12. lxc-help::
  13. @echo ' LXC: running in container LXC_ENV_FOLDER=$(LXC_ENV_FOLDER)'
  14. # If not activated, serve target 'lxc-activate' ..
  15. ifeq (,$(wildcard /.lxcenv.mk))
  16. PHONY += lxc-activate
  17. lxc-activate:
  18. ln -s "$(abspath $(lastword $(MAKEFILE_LIST)))" "/.lxcenv.mk"
  19. else
  20. # .. and if activated, serve target 'lxc-deactivate'.
  21. PHONY += lxc-deactivate
  22. lxc-deactivate:
  23. rm /.lxcenv.mk
  24. $(LXC_ENV_FOLDER):
  25. $(Q)mkdir -p $(LXC_ENV_FOLDER)
  26. $(Q)echo placeholder > $(LXC_ENV_FOLDER).placeholder
  27. endif
  28. .PHONY: $(PHONY)