2016-10-14 13:57:26 +03:00
|
|
|
.PHONY: check
|
|
|
|
check:
|
2016-10-25 14:05:29 +03:00
|
|
|
@yarn install --prefer-offline
|
2016-10-27 18:02:10 +03:00
|
|
|
-@./bin/setup
|
2016-10-17 19:56:01 +03:00
|
|
|
|
2016-10-26 16:47:22 +03:00
|
|
|
SUBDIRS := $(dir $(wildcard */Makefile))
|
2016-11-01 13:51:36 +02:00
|
|
|
TARGETS := install clean test test-ci lint lint-ci # whatever else, but must not contain '/'
|
2016-10-24 17:52:46 +03:00
|
|
|
|
|
|
|
# foo/.all bar/.all foo/.clean bar/.clean
|
|
|
|
SUBDIRS_TARGETS := \
|
|
|
|
$(foreach t,$(TARGETS),$(addsuffix $t,$(SUBDIRS)))
|
|
|
|
|
|
|
|
.PHONY: $(TARGETS) $(SUBDIRS_TARGETS)
|
|
|
|
|
|
|
|
# static pattern rule, expands into:
|
|
|
|
# all clean: %: foo/.% bar/.%
|
|
|
|
$(TARGETS): %: $(addsuffix %,$(SUBDIRS))
|
|
|
|
@echo 'Done "$*" target'
|
|
|
|
|
|
|
|
# here, for foo/.all:
|
|
|
|
# $(@D) is foo
|
|
|
|
# $(@F) is .all, with leading period
|
|
|
|
# $(@F:.%=%) is just all
|
|
|
|
$(SUBDIRS_TARGETS):
|
2016-10-25 14:05:29 +03:00
|
|
|
$(MAKE) --no-print-directory -C $(@D) $(@F:.%=%)
|
2016-11-01 13:51:36 +02:00
|
|
|
|
|
|
|
DIFF := $(lastword $(subst /, ,${CIRCLE_COMPARE_URL}))
|
2016-11-01 14:39:54 +02:00
|
|
|
CHANGED_FILES := $(subst /, , $(dir $(shell git diff --name-only $(DIFF))))
|
|
|
|
CHANGES := $(patsubst %, %/, $(sort $(filter $(subst /, ,$(SUBDIRS)), $(CHANGED_FILES))))
|
2016-11-01 13:51:36 +02:00
|
|
|
.PHONY: diff
|
|
|
|
diff:
|
|
|
|
echo $(CHANGES)
|
|
|
|
|
|
|
|
BUILDS := build push
|
|
|
|
|
|
|
|
# foo/.all bar/.all foo/.clean bar/.clean
|
|
|
|
BUILDS_TARGETS := \
|
|
|
|
$(foreach t,$(BUILDS),$(addsuffix $t,$(CHANGES)))
|
|
|
|
|
|
|
|
.PHONY: $(BUILDS) $(BUILDS_TARGETS)
|
|
|
|
|
|
|
|
# static pattern rule, expands into:
|
|
|
|
# all clean: %: foo/.% bar/.%
|
|
|
|
$(BUILDS): %: $(addsuffix %,$(CHANGES))
|
|
|
|
@echo 'Done "$*" target'
|
|
|
|
|
|
|
|
# here, for foo/.all:
|
|
|
|
# $(@D) is foo
|
|
|
|
# $(@F) is .all, with leading period
|
|
|
|
# $(@F:.%=%) is just all
|
|
|
|
$(BUILDS_TARGETS):
|
|
|
|
$(MAKE) --no-print-directory -C $(@D) $(@F:.%=%)
|