forked from brendanhay/gogol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (36 loc) · 1.14 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
SHELL := /usr/bin/env bash
TOP := ..
BIN := bin
MODEL_DIR := configs/models
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' gogol-gen.cabal)
CORE_VERSION = $(call version,$(TOP)/core/gogol-core.cabal)
CLIENT_VERSION = $(call version,$(TOP)/gen/gogol-gen.cabal)
MODELS ?= $(shell find $(MODEL_DIR) -type f -name '*.json' | sort)
.PHONY: gen $(BIN)/gogol-gen
gen: $(BIN)/gogol-gen $(MODEL_DIR)
$(BIN)/gogol-gen \
--out=$(OUT_DIR) \
--library-version=$(VERSION) \
--client-version=$(CLIENT_VERSION) \
--core-version=$(CORE_VERSION) \
--services=configs/services \
--templates=configs/templates \
--assets=configs/assets \
$(addprefix --model=,$(MODELS))
$(BIN)/gogol-gen: $(BIN)
stack build gogol-gen --nix --copy-bins --local-bin-path $(BIN)
$(BIN):
mkdir $@
clean:
stack clean
rm -rf $(MODEL_DIR)
full-clean: clean
rm -rf vendor configs/models
$(MODEL_DIR): vendor/google-api-go-client
@./scripts/copy-models $< $@
vendor/google-api-go-client:
git clone https://github.com/google/google-api-go-client $@