2016-08-31 17:56:24 +00:00
|
|
|
REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
|
2016-09-05 12:21:44 +00:00
|
|
|
SUBMODULES = schemes/swag apps/cp_proto/damsel build_utils
|
2016-08-31 17:56:24 +00:00
|
|
|
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
UTILS_PATH := build_utils
|
|
|
|
TEMPLATES_PATH := .
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
# Name of the service
|
|
|
|
SERVICE_NAME := capi
|
|
|
|
# Service image default tag
|
|
|
|
SERVICE_IMAGE_TAG ?= $(shell git rev-parse HEAD)
|
|
|
|
# The tag for service image to be pushed with
|
|
|
|
SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
# Base image for the service
|
|
|
|
BASE_IMAGE_NAME := service_erlang
|
2017-02-09 09:49:22 +00:00
|
|
|
BASE_IMAGE_TAG := 13454a94990acb72f753623ec13599a9f6f4f852
|
2016-09-05 12:21:44 +00:00
|
|
|
|
2017-04-13 16:32:47 +00:00
|
|
|
BUILD_IMAGE_TAG := b3c8e9bcfaf8adae856493868a15b29aca57a72e
|
2016-09-05 12:21:44 +00:00
|
|
|
|
2017-04-05 11:49:49 +00:00
|
|
|
CALL_ANYWHERE := all submodules rebar-update compile xref lint dialyze test start devrel release clean distclean swagger.regenerate
|
2016-09-05 12:21:44 +00:00
|
|
|
|
|
|
|
CALL_W_CONTAINER := $(CALL_ANYWHERE)
|
|
|
|
|
2016-10-26 13:39:32 +00:00
|
|
|
.PHONY: $(CALL_W_CONTAINER) all cover
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
all: compile
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
-include $(UTILS_PATH)/make_lib/utils_container.mk
|
|
|
|
-include $(UTILS_PATH)/make_lib/utils_image.mk
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
$(SUBTARGETS): %/.git: %
|
|
|
|
git submodule update --init $<
|
|
|
|
touch $@
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
submodules: $(SUBTARGETS)
|
|
|
|
|
|
|
|
rebar-update:
|
|
|
|
$(REBAR) update
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
generate: swagger.generate
|
|
|
|
|
|
|
|
compile: submodules rebar-update generate
|
2016-08-31 17:56:24 +00:00
|
|
|
$(REBAR) compile
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
xref:
|
|
|
|
$(REBAR) xref
|
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
lint: generate
|
2016-09-05 12:21:44 +00:00
|
|
|
elvis rock
|
|
|
|
|
|
|
|
dialyze:
|
|
|
|
$(REBAR) dialyzer
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
start: submodules
|
|
|
|
$(REBAR) run
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
devrel: submodules
|
|
|
|
$(REBAR) release
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
release: distclean generate
|
2016-09-05 12:21:44 +00:00
|
|
|
$(REBAR) as prod release
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
clean:
|
2016-10-26 13:39:32 +00:00
|
|
|
$(REBAR) cover -r
|
2016-08-31 17:56:24 +00:00
|
|
|
$(REBAR) clean
|
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
distclean: swagger.distclean
|
2017-02-09 09:50:35 +00:00
|
|
|
$(REBAR) clean
|
2016-09-07 12:06:55 +00:00
|
|
|
rm -rfv _build apps/swagger
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
cover:
|
|
|
|
$(REBAR) cover
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
# CALL_W_CONTAINER
|
|
|
|
test: submodules
|
2017-03-28 13:54:33 +00:00
|
|
|
$(REBAR) do eunit, ct
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
# Swagger stuff
|
|
|
|
SWAGGER_CODEGEN = $(call which, swagger-codegen)
|
|
|
|
SWAGGER_SCHEME_PATH = schemes/swag
|
|
|
|
SWAGGER_SCHEME = $(SWAGGER_SCHEME_PATH)/web_deploy/swagger.yaml
|
|
|
|
SWAGGER_APP_PATH = apps/swagger
|
|
|
|
SWAGGER_APP_TARGET = $(SWAGGER_APP_PATH)/rebar.config
|
|
|
|
|
|
|
|
swagger.generate: $(SWAGGER_APP_TARGET)
|
|
|
|
|
|
|
|
swagger.distclean:
|
2016-08-31 17:56:24 +00:00
|
|
|
rm -rf $(SWAGGER_APP_PATH)
|
2017-02-27 13:40:13 +00:00
|
|
|
|
|
|
|
swagger.regenerate: swagger.distclean swagger.generate
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
$(SWAGGER_APP_TARGET): $(SWAGGER_SCHEME)
|
2017-02-27 13:40:13 +00:00
|
|
|
$(SWAGGER_CODEGEN) generate -i $(SWAGGER_SCHEME) -l erlang-server -o $(SWAGGER_APP_PATH)
|
2017-02-09 09:50:35 +00:00
|
|
|
|
2017-04-05 11:49:49 +00:00
|
|
|
$(SWAGGER_SCHEME): $(SWAGGER_SCHEME_PATH)/.git
|
2017-02-09 09:50:35 +00:00
|
|
|
$(MAKE) -C $(SWAGGER_SCHEME_PATH)
|