summaryrefslogtreecommitdiff
path: root/support/make/exec.mk
diff options
context:
space:
mode:
Diffstat (limited to 'support/make/exec.mk')
-rw-r--r--support/make/exec.mk42
1 files changed, 42 insertions, 0 deletions
diff --git a/support/make/exec.mk b/support/make/exec.mk
new file mode 100644
index 0000000000..b0f9c518a1
--- /dev/null
+++ b/support/make/exec.mk
@@ -0,0 +1,42 @@
+############################################################-*-Makefile-*-####
+# EXEC - Execute Command
+##############################################################################
+# $Id$
+
+##############################################################################
+# Usage
+#
+# make exec CMD=<command>
+#
+##############################################################################
+# Examples
+#
+# Print names of all source files:
+#
+# make exec CMD='echo $(PROJECT_SOURCES)'
+#
+#
+# Execute a java program with the project classpath:
+#
+# make exec CMD='java -cp $(PROJECT_CLASSPATH) scalac.Main'
+#
+##############################################################################
+
+##############################################################################
+# Variables
+
+EXEC_CMD ?= $(CMD)
+
+##############################################################################
+# Rules
+
+exec :
+ @if [ -z '$(EXEC_CMD)' ]; then \
+ $(ECHO) "Usage: $(MAKE) $@ CMD=<command>"; \
+ exit 1; \
+ fi
+ @$(EXEC_CMD)
+
+.PHONY : exec
+
+##############################################################################