1LIBYAML_DIR ?= libyaml 2LIBYAML_REPO ?= https://github.com/yaml/libyaml 3LIBYAML_BRANCH ?= master 4define HELP 5This Makefile supports the following targets: 6 7 build - Build ./libyaml-parser and ./libyaml-emitter 8 test - Run tests 9 10endef 11export HELP 12 13help: 14 @echo "$$HELP" 15 16build: touch libyaml-parser libyaml-emitter 17 18touch: 19ifneq ($(LIBYAML_DIR),libyaml) 20 touch *.c 21endif 22 23libyaml-%: $(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) 28ifneq ($(LIBYAML_DIR),libyaml) 29 (cd $(LIBYAML_DIR) && git checkout tests/run-parser.c tests/run-emitter.c) 30endif 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 50test: build 51 prove -lv test/ 52 53clean: 54 rm -fr libyaml libyaml-parser libyaml-emitter 55