-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
107 lines (77 loc) · 2.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.DELETE_ON_ERROR:
.SUFFIXES:
.SECONDARY:
RUN = poetry run
SRC_DIR = src
SCHEMA_DIR = $(SRC_DIR)/chemrof/schema
SOURCE_FILES := $(shell find $(SCHEMA_DIR) -name '*.yaml')
SCHEMA_NAMES = $(patsubst $(SCHEMA_DIR)/%.yaml, %, $(SOURCE_FILES))
SCHEMA_NAME = chemrof
SCHEMA_SRC = $(SCHEMA_DIR)/$(SCHEMA_NAME).yaml
TGTS = graphql jsonschema docs shex owl csv graphql python
#GEN_OPTS = --no-mergeimports
GEN_OPTS =
# environment variables
include config.env
GEN_PARGS =
ifdef LINKML_GENERATORS_PROJECT_ARGS
GEN_PARGS = ${LINKML_GENERATORS_PROJECT_ARGS}
endif
GEN_DARGS =
ifdef LINKML_GENERATORS_MARKDOWN_ARGS
GEN_DARGS = ${LINKML_GENERATORS_MARKDOWN_ARGS}
endif
all: gen
gen: project
clean:
rm -rf target/
rm -rf docs/
t:
echo $(SCHEMA_NAMES)
echo:
echo $(patsubst %,gen-%,$(TGTS))
#test: all
test: test-examples
install:
. environment.sh
pip install -r requirements.txt
tdir-%:
mkdir -p target/$*
gendoc: docs docs/index.md
docs:
mkdir -p $@
docs/index.md: $(SOURCE_FILES) src/docs
cp -pr src/docs/*.md docs/ ; \
$(RUN) gen-doc -d docs $<
MKDOCS = $(RUN) mkdocs
mkd-%:
$(MKDOCS) $*
#project: project1 schema/owl/chemrof.owl.ttl
project: $(SOURCE_FILES)
# gen-project -A 'owl: {metaclasses: false, type_objects: false}' -d schema $<
$(RUN) gen-project ${GEN_PARGS} -d schema $<
#schema/owl/$(SCHEMA_NAME).owl.ttl: $(SOURCE_FILES)
# $(RUN) gen-owl --no-metaclasses --no-type-objects $< > [email protected] && mv [email protected] $@
test-examples: examples/output
examples/output: $(SCHEMA_SRC)
mkdir -p $@
$(RUN) linkml-run-examples \
--output-formats json \
--output-formats yaml \
--counter-example-input-directory src/data/examples/invalid \
--input-directory src/data/examples/valid \
--output-directory $@ \
--schema $< > $@/README.md
.PHONY: examples/output
schema/sssom/chemrof.sssom.tsv: src/chemrof/schema/chemrof.yaml
$(RUN) gen-sssom $< -o $@
# test docs locally.
docserve:
$(RUN) mkdocs serve
gh-deploy:
$(RUN) mkdocs gh-deploy
include etl.mk