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))
|
|
|
|
|
2017-05-03 10:56:08 +00:00
|
|
|
COMPOSE_HTTP_TIMEOUT := 300
|
|
|
|
export COMPOSE_HTTP_TIMEOUT
|
|
|
|
|
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-07-27 14:42:08 +00:00
|
|
|
BUILD_IMAGE_TAG := 4799280a02cb73761a3ba3641285aac8ec4ec482
|
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-05-26 15:49:23 +00:00
|
|
|
release: submodules 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
|
2017-05-26 09:18:44 +00:00
|
|
|
rm -rf _build
|
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
|
2017-06-16 11:03:25 +00:00
|
|
|
SWAGGER_SCHEME = $(SWAGGER_SCHEME_PATH)/swagger.yaml
|
2017-05-26 09:18:44 +00:00
|
|
|
SWAGGER_PREFIX = swag_server
|
|
|
|
SWAGGER_APP_PATH = apps/$(SWAGGER_PREFIX)
|
2017-02-27 13:40:13 +00:00
|
|
|
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-06-16 11:03:25 +00:00
|
|
|
$(SWAGGER_CODEGEN) generate \
|
|
|
|
-i $(SWAGGER_SCHEME) \
|
|
|
|
-l erlang-server \
|
|
|
|
-o $(SWAGGER_APP_PATH) \
|
|
|
|
--additional-properties \
|
|
|
|
packageName=$(SWAGGER_PREFIX)
|
2017-02-09 09:50:35 +00:00
|
|
|
|
2017-04-05 11:49:49 +00:00
|
|
|
$(SWAGGER_SCHEME): $(SWAGGER_SCHEME_PATH)/.git
|