about summary refs log tree commit diff
path: root/mk/install.mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-25T09·50+0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-25T09·50+0000
commitf980755766e7cd74c0c959eaa2a6d4655980e2ea (patch)
tree56452922b75f19a707cdecc4cee936f8fe7e372c /mk/install.mk
parente9b6397d2f902eb4f5bf0fd513013d92af074cfc (diff)
Split Makefile.lib into several *.mk files
Diffstat (limited to 'mk/install.mk')
-rw-r--r--mk/install.mk23
1 files changed, 23 insertions, 0 deletions
diff --git a/mk/install.mk b/mk/install.mk
new file mode 100644
index 000000000000..32048a38b2fe
--- /dev/null
+++ b/mk/install.mk
@@ -0,0 +1,23 @@
+# Add a rule for creating $(1) as a directory.  This template may be
+# called multiple times for the same directory.
+define create-dir =
+  ifndef $(1)_SEEN
+    $(1)_SEEN = 1
+    $(1):
+	install -d $(1)
+  endif
+endef
+
+
+# Add a rule for installing file $(2) in directory $(1).  The
+# directory will be created automatically.
+define install-file-in =
+
+  install:: $(1)/$(notdir $(2))
+
+  $$(eval $$(call create-dir,$(1)))
+
+  $(1)/$(notdir $(2)): $(2) | $(1)
+	install -t $(1) $(2)
+
+endef