aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/native/cargo-c/Makefile
blob: 3c120149995279da281e4d157636ddf9713428cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
include ../../Makefile.include CARGO-C-VERSION ../../download-files.include
DEPS = ../../Makefile.include Makefile CARGO-C-VERSION ../../download-files.include

PREFIX=$(NATIVEPREFIX)
PLATFORM=$(NATIVEPLATFORM)

export PKG_CONFIG_PATH=$(PREFIX)/lib/pkgconfig

APP=$(PLATFORM)/target/release/$(APPNAME)

CARGO_ENV_VARS = RUSTUP_HOME=$(PREFIX)/.rustup \
	CARGO_HOME=$(PREFIX)/.cargo
CARGO = $(CARGO_ENV_VARS) $(PREFIX)/bin/cargo

CLEANUP_CMD = [ -e $(PREFIX)/bin/cargo ] \
	&& $(CARGO) uninstall cargo-c || true

all: .installed-$(PLATFORM)

$(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
	rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
	cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)

$(APP): $(PLATFORM)
	$(CARGO) build --release --manifest-path $(PLATFORM)/Cargo.toml

.installed-$(PLATFORM): $(APP)
	$(CARGO) install --profile release --path $(PLATFORM)

	touch $@

clean:
	$(CLEANUP_CMD)
	rm -f .installed-$(PLATFORM)

distclean::
	$(CLEANUP_CMD)
	rm -rf $(PLATFORM) .installed-$(PLATFORM)