-
Notifications
You must be signed in to change notification settings - Fork 105
/
Makefile
44 lines (33 loc) · 1.04 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
SHELL := /usr/bin/env bash
TOP := .
BIN := ./bin
MODEL_DIR := ./configs/models
OUT_DIR := ./lib/services
STACK_YAML := ./gen/stack.yaml
define version =
$(shell sed -n 's/^version: *\([0-9]*\.[0-9]*\.[0-9]\).*$$/\1/p' $(1))
endef
VERSION = $(call version,$(TOP)/lib/gogol-core/gogol-core.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) \
--version=$(VERSION) \
--services=configs/services \
--templates=configs/templates \
--assets=configs/assets \
$(addprefix --model=,$(MODELS))
$(BIN)/gogol-gen: $(BIN)
stack build gogol-gen --stack-yaml=$(STACK_YAML) --nix --copy-bins --local-bin-path $(BIN)
$(BIN):
mkdir $@
clean:
stack clean --stack-yaml=$(STACK_YAML)
rm -r $(MODEL_DIR)
full-clean: clean
rm -r ./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 $@