Skip to content

Commit

Permalink
Add variable to set "installable" crates.
Browse files Browse the repository at this point in the history
For example, sample executables you don't want to get in installation process.
  • Loading branch information
KokaKiwi committed Apr 2, 2014
1 parent 1151e98 commit 1e8a5a8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rust.mk
Expand Up @@ -70,6 +70,7 @@ $(1)_ROOT = $$($(1)_DIRNAME)/lib.rs
$(1)_PREFIX = $$(RUSTLIBDIR)/
$(1)_RUSTCFLAGS_BUILD += --out-dir $$(RUSTLIBDIR)
$(1)_INSTALLDIR = $$(RUSTINSTALLDIR)/lib
$(1)_INSTALLABLE ?= 1

endef

Expand Down Expand Up @@ -117,12 +118,14 @@ bench_$(1): $$($(1)_TESTNAME)
doc_$(1):
$$(RUSTDOC) $$(RUSTDOCFLAGS) $$($(1)_ROOT)

ifeq ($$($(1)_INSTALLABLE),1)
install_$(1): $$($(1)_NAME)
@mkdir -p $$($(1)_INSTALLDIR)
$(INSTALL) $$($(1)_NAMES) $$($(1)_INSTALLDIR)

uninstall_$(1):
rm -f $$(foreach name,$$($(1)_NAMES),$$($(1)_INSTALLDIR)/$$(notdir $$(name)))
endif

$$($(1)_NAME): $$($(1)_BUILD_DEPS)
$$(RUSTC) $$(RUSTCFLAGS) $$($(1)_RUSTCFLAGS_BUILD) $$($(1)_RUSTCFLAGS) --dep-info $$($(1)_DEPFILE) $$($(1)_ROOT)
Expand All @@ -137,8 +140,11 @@ $$($(1)_TESTNAME): $$($(1)_BUILD_DEPS)
.PHONY test: test_$(1)
.PHONY bench: bench_$(1)
.PHONY doc: doc_$(1)

ifeq ($$($(1)_INSTALLABLE),1)
.PHONY install: install_$(1)
.PHONY uninstall: uninstall_$(1)
endif

endef

Expand Down

0 comments on commit 1e8a5a8

Please sign in to comment.