]>
Commit | Line | Data |
---|---|---|
a672b071 IN |
1 | LIBYAML_DIR ?= libyaml |
2 | LIBYAML_REPO ?= https://github.com/yaml/libyaml | |
3 | LIBYAML_BRANCH ?= master | |
4 | define HELP | |
5 | This Makefile supports the following targets: | |
6 | ||
7 | build - Build ./libyaml-parser and ./libyaml-emitter | |
8 | test - Run tests | |
9 | ||
10 | endef | |
11 | export HELP | |
12 | ||
13 | help: | |
14 | @echo "$$HELP" | |
15 | ||
16 | build: touch libyaml-parser libyaml-emitter | |
17 | ||
18 | touch: | |
19 | ifneq ($(LIBYAML_DIR),libyaml) | |
20 | touch *.c | |
21 | endif | |
22 | ||
23 | libyaml-%: $(LIBYAML_DIR)/tests/.libs/run-% | |
24 | cp $< $@ | |
25 | ||
26 | $(LIBYAML_DIR)/tests/.libs/%: $(LIBYAML_DIR)/tests/%.c $(LIBYAML_DIR)/Makefile | |
27 | make -C $(LIBYAML_DIR) | |
28 | ifneq ($(LIBYAML_DIR),libyaml) | |
29 | (cd $(LIBYAML_DIR) && git checkout tests/run-parser.c tests/run-emitter.c) | |
30 | endif | |
31 | ||
32 | $(LIBYAML_DIR)/tests/run-%: libyaml-% $(LIBYAML_DIR) | |
33 | cp $< $@ | |
34 | .SECONDARY: \ | |
35 | $(LIBYAML_DIR)/tests/run-parser.c \ | |
36 | $(LIBYAML_DIR)/tests/run-emitter.c \ | |
37 | $(LIBYAML_DIR)/tests/.libs/run-parser \ | |
38 | $(LIBYAML_DIR)/tests/.libs/run-emitter | |
39 | ||
40 | $(LIBYAML_DIR)/Makefile: $(LIBYAML_DIR) | |
41 | ( cd $< && ./bootstrap && ./configure ) | |
42 | touch $@ | |
43 | ||
44 | $(LIBYAML_DIR): | |
45 | git clone $(LIBYAML_REPO) $@ | |
46 | sleep 1 | |
47 | touch *.c | |
48 | ||
49 | .PHONY: test | |
50 | test: build | |
51 | prove -lv test/ | |
52 | ||
53 | clean: | |
54 | rm -fr libyaml libyaml-parser libyaml-emitter |