diff --git a/Makefile b/Makefile index 51b92fe46..97b5ab1cc 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -$MAKEFILES = $(shell find . -maxdepth 3 -type f -name Makefile) -SUBDIRS = $(filter-out ./,$(dir $($MAKEFILES))) +SUBDIRS := contracts/factory contracts/multihop contracts/pool contracts/pool_stable contracts/stake contracts/token +BUILD_FLAGS ?= default: build @@ -7,12 +7,12 @@ all: test build: @for dir in $(SUBDIRS) ; do \ - $(MAKE) -C $$dir build || exit 1; \ + $(MAKE) -C $$dir build BUILD_FLAGS=$(BUILD_FLAGS) || exit 1; \ done test: build @for dir in $(SUBDIRS) ; do \ - $(MAKE) -C $$dir test || exit 1; \ + $(MAKE) -C $$dir test BUILD_FLAGS=$(BUILD_FLAGS) || exit 1; \ done fmt: @@ -21,6 +21,9 @@ fmt: done lints: fmt + @for dir in contracts/multihop contracts/pool ; do \ + $(MAKE) -C $$dir build || exit 1; \ + done @for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir clippy || exit 1; \ done diff --git a/contracts/factory/Makefile b/contracts/factory/Makefile index 28eda6858..bd1f83daa 100644 --- a/contracts/factory/Makefile +++ b/contracts/factory/Makefile @@ -1,3 +1,7 @@ +ifeq (,$(BUILD_FLAGS)) + DEPS = ../stake ../pool +endif + default: all all: lint build test @@ -6,8 +10,9 @@ test: build # because of token dependency cargo test build: - $(MAKE) -C ../stake build || break; - $(MAKE) -C ../pair build || break; + @for dir in $(DEPS) ; do \ + $(MAKE) -C $$dir build || break; \ + done cargo build --target wasm32-unknown-unknown --release lint: fmt clippy diff --git a/contracts/multihop/Makefile b/contracts/multihop/Makefile index 5a502438f..7d042922d 100644 --- a/contracts/multihop/Makefile +++ b/contracts/multihop/Makefile @@ -1,3 +1,7 @@ +ifeq (,$(BUILD_FLAGS)) + DEPS = ../factory ../pool +endif + default: all all: lint build test @@ -8,8 +12,9 @@ test: cargo test build: - $(MAKE) -C ../factory build || break; - $(MAKE) -C ../pool build || break; + @for dir in $(DEPS) ; do \ + $(MAKE) -C $$dir build || break; \ + done cargo build --target wasm32-unknown-unknown --release lint: fmt clippy