Use the mojo profile, or mojo-dev profile, depending on the setting of
USE_MOJO_DEV_PROFILE.
MultiPart: 2/4
Change-Id: I920c384d1b2e02a5d8ba28e7b9e2da0fc84389cd
diff --git a/Makefile b/Makefile
index 69d23ab..a4d40b4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,22 @@
include ../shared/mojo.mk
-ifndef MOJO_DIR
- $(error MOJO_DIR is not set)
-endif
-
ifdef ANDROID
DISCOVERY_BUILD_DIR := $(PWD)/gen/mojo/android
+
+ # For some reason we need to set the origin flag when running on Android,
+ # but setting it on Linux causes errors.
+ ORIGIN_FLAG = --origin $(MOJO_SERVICES)
else
DISCOVERY_BUILD_DIR := $(PWD)/gen/mojo/linux_amd64
endif
MOJO_SHELL_FLAGS := $(MOJO_SHELL_FLAGS) \
--config-alias DISCOVERY_DIR=$(PWD) \
- --config-alias DISCOVERY_BUILD_DIR=$(DISCOVERY_BUILD_DIR)
+ --config-alias DISCOVERY_BUILD_DIR=$(DISCOVERY_BUILD_DIR) \
+ $(ORIGIN_FLAG)
define CGO_TEST
- GOPATH="$(GOPATH)" \
- CGO_CFLAGS="-I$(MOJO_DIR)/src $(CGO_CFLAGS)" \
- CGO_CXXFLAGS="-I$(MOJO_DIR)/src $(CGO_CXXFLAGS)" \
- CGO_LDFLAGS="-L$(dir $(MOJO_SHARED_LIB)) -lsystem_thunk $(CGO_LDFLAGS)" \
- $(GOROOT)/bin/go test -v $1
+ jiri go --profiles=$(MOJO_PROFILE),base test -v $1
endef
V23_GO_FILES := $(shell find $(JIRI_ROOT) -name "*.go")
@@ -51,10 +48,10 @@
# See https://github.com/domokit/mojo/issues/386
rm -f lib/gen/mojom/$(notdir $@)
-$(DISCOVERY_BUILD_DIR)/discovery.mojo: $(V23_GO_FILES) $(MOJO_SHARED_LIB) | mojo-env-check
+$(DISCOVERY_BUILD_DIR)/discovery.mojo: $(V23_GO_FILES) | mojo-env-check
$(call MOGO_BUILD,vanadium/discovery,$@)
-discovery-test: $(V23_GO_FILES) $(MOJO_SHARED_LIB) go/src/mojom/vanadium/discovery/discovery.mojom.go | mojo-env-check
+discovery-test: $(V23_GO_FILES) go/src/mojom/vanadium/discovery/discovery.mojom.go | mojo-env-check
$(call CGO_TEST,vanadium/discovery/internal)
clean:
@@ -85,15 +82,15 @@
# Examples.
run-advertiser: $(DISCOVERY_BUILD_DIR)/advertiser.mojo $(DISCOVERY_BUILD_DIR)/discovery.mojo
- $(MOJO_DIR)/src/mojo/devtools/common/mojo_run --config-file $(PWD)/mojoconfig $(MOJO_SHELL_FLAGS) $(MOJO_ANDROID_FLAGS) https://mojo.v.io/advertiser.mojo \
+ $(MOJO_DEVTOOLS)/mojo_run --config-file $(PWD)/mojoconfig $(MOJO_SHELL_FLAGS) $(MOJO_ANDROID_FLAGS) https://mojo.v.io/advertiser.mojo \
--args-for="https://mojo.v.io/discovery.mojo"
run-scanner: $(DISCOVERY_BUILD_DIR)/scanner.mojo $(DISCOVERY_BUILD_DIR)/discovery.mojo
- $(MOJO_DIR)/src/mojo/devtools/common/mojo_run --config-file $(PWD)/mojoconfig $(MOJO_SHELL_FLAGS) $(MOJO_ANDROID_FLAGS) https://mojo.v.io/scanner.mojo \
+ $(MOJO_DEVTOOLS)/mojo_run --config-file $(PWD)/mojoconfig $(MOJO_SHELL_FLAGS) $(MOJO_ANDROID_FLAGS) https://mojo.v.io/scanner.mojo \
--args-for="https://mojo.v.io/discovery.mojo"
-$(DISCOVERY_BUILD_DIR)/advertiser.mojo: $(V23_GO_FILES) $(MOJO_SHARED_LIB) go/src/mojom/vanadium/discovery/discovery.mojom.go | mojo-env-check
+$(DISCOVERY_BUILD_DIR)/advertiser.mojo: $(V23_GO_FILES) go/src/mojom/vanadium/discovery/discovery.mojom.go | mojo-env-check
$(call MOGO_BUILD,examples/advertiser,$@)
-$(DISCOVERY_BUILD_DIR)/scanner.mojo: $(V23_GO_FILES) $(MOJO_SHARED_LIB) go/src/mojom/vanadium/discovery/discovery.mojom.go | mojo-env-check
+$(DISCOVERY_BUILD_DIR)/scanner.mojo: $(V23_GO_FILES) go/src/mojom/vanadium/discovery/discovery.mojom.go | mojo-env-check
$(call MOGO_BUILD,examples/scanner,$@)