forked from brendanhay/amazonka
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (46 loc) · 1.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
SHELL := /usr/bin/env bash
TOP := ..
BIN := bin
MODEL_DIR := model
OUT_DIR := ..
define version =
$(shell sed -n 's/^version: *\([0-9]*\.[0-9]*\.[0-9]\).*$$/\1/p' $(1))
endef
VERSION = $(shell sed -n 's/^version: *\(.*\)$$/\1/p' amazonka-gen.cabal)
CORE_VERSION = $(call version,$(TOP)/core/amazonka-core.cabal)
CLIENT_VERSION = $(call version,$(TOP)/gen/amazonka-gen.cabal)
MODELS ?= $(sort $(dir $(wildcard $(MODEL_DIR)/*/*)))
.PHONY: gen format $(BIN)/amazonka-gen
release: gen format
gen: $(MODEL_DIR) $(BIN)/amazonka-gen
$(BIN)/amazonka-gen \
--out=$(OUT_DIR) \
--library-version=$(VERSION) \
--client-version=$(CLIENT_VERSION) \
--core-version=$(CORE_VERSION) \
--annexes=annex \
--configs=config \
--templates=template \
--static=static \
--retry=$(MODEL_DIR)/_retry.json \
$(addprefix --model=,$(MODELS))
format:
@echo -e '\nFormatting...'
@find $(wildcard $(OUT_DIR)/amazonka-*/gen) $(wildcard $(OUT_DIR)/test/Test/AWS/Gen) \
-type f \
-name '*.hs' \
-printf ' -> %p\n' \
-exec stylish-haskell -i {} \;
$(BIN)/amazonka-gen: $(BIN)
stack build amazonka-gen --copy-bins --local-bin-path $(BIN)
$(BIN):
mkdir $@
clean:
stack clean
rm -rf $(MODEL_DIR)
full-clean: clean
rm -rf vendor
$(MODEL_DIR): vendor/botocore
cp -rf vendor/botocore/botocore/data $@
vendor/botocore:
git clone [email protected]:boto/botocore $@