From 96dd58ea314cc73a155911ecbf21c36dcec37b06 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 6 Nov 2014 22:48:07 -0800 Subject: Reorganized Makefile to use cmake. --- Makefile | 75 +++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 32 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 461256e..6bcaa93 100644 --- a/Makefile +++ b/Makefile @@ -3,20 +3,30 @@ LDFLAGS?=-g -O3 -Wall -Werror -fPIC $(OPTLDFLAGS) SRCDIR?=src DATADIR?=data BENCHINP?=README.md -PROG?=./cmark JSMODULES=$(wildcard js/lib/*.js) PREFIX?=/usr/local SPEC=spec.txt SITE=_site SPECVERSION=$(shell grep version: $(SPEC) | sed -e 's/version: *//') -.PHONY: all spec leakcheck clean fuzztest dingus upload jshint test testjs benchjs update-site upload-site +BUILDDIR=build +PROG?=$(BUILDDIR)/src/cmark -all: - mkdir -p build; cd build; cmake ..; make +.PHONY: all spec leakcheck clean fuzztest dingus upload jshint test testjs benchjs update-site upload-site check -install: - mkdir -p build; cd build; cmake ..; make install +all: check + mkdir -p $(BUILDDIR); cd build; cmake ..; make + +install: check + mkdir -p $(BUILDDIR); cd build; cmake ..; make install + +clean: + rm -rf $(BUILDDIR) + +check: + @cmake --version >/dev/null || (echo "You need cmake to build this program: http://www.cmake.org/download/" && exit 1) + +$(PROG): all README.html: README.md template.html pandoc --template template.html -S -s -t html5 -o $@ $< @@ -50,31 +60,32 @@ jshint: benchjs: node js/bench.js ${BENCHINP} -HTML_OBJ=$(SRCDIR)/html/html.o $(SRCDIR)/html/houdini_href_e.o $(SRCDIR)/html/houdini_html_e.o $(SRCDIR)/html/houdini_html_u.o - -CMARK_OBJ=$(SRCDIR)/inlines.o $(SRCDIR)/buffer.o $(SRCDIR)/blocks.o $(SRCDIR)/scanners.c $(SRCDIR)/print.o $(SRCDIR)/utf8.o $(SRCDIR)/references.o - -CMARK_HDR = $(SRCDIR)/cmark.h $(SRCDIR)/buffer.h $(SRCDIR)/references.h \ - $(SRCDIR)/chunk.h $(SRCDIR)/debug.h $(SRCDIR)/utf8.h \ - $(SRCDIR)/scanners.h $(SRCDIR)/inlines.h - -HTML_HDR = $(SRCDIR)/html/html_unescape.h $(SRCDIR)/html/houdini.h - -$(PROG): $(SRCDIR)/html/html_unescape.h $(SRCDIR)/case_fold_switch.inc $(HTML_OBJ) $(CMARK_OBJ) $(SRCDIR)/main.c - $(CC) $(LDFLAGS) -o $@ $(HTML_OBJ) $(CMARK_OBJ) $(SRCDIR)/main.c - -$(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re - re2c --case-insensitive -bis $< > $@ || (rm $@ && false) - -$(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt - perl mkcasefold.pl < $< > $@ - -$(SRCDIR)/html/html_unescape.h: $(SRCDIR)/html/html_unescape.gperf - gperf -I -t -N find_entity -H hash_entity -K entity -C -l --null-strings -m5 $< > $@ - -ibcommonmark.so: $(HTML_OBJ) $(CMARK_OBJ) - $(CC) $(LDFLAGS) -shared -o $@ $^ - +#HTML_OBJ=$(SRCDIR)/html/html.o $(SRCDIR)/html/houdini_href_e.o $(SRCDIR)/html/houdini_html_e.o $(SRCDIR)/html/houdini_html_u.o +# +#CMARK_OBJ=$(SRCDIR)/inlines.o $(SRCDIR)/buffer.o $(SRCDIR)/blocks.o $(SRCDIR)/scanners.c $(SRCDIR)/print.o $(SRCDIR)/utf8.o $(SRCDIR)/references.o +# +#CMARK_HDR = $(SRCDIR)/cmark.h $(SRCDIR)/buffer.h $(SRCDIR)/references.h \ +# $(SRCDIR)/chunk.h $(SRCDIR)/debug.h $(SRCDIR)/utf8.h \ +# $(SRCDIR)/scanners.h $(SRCDIR)/inlines.h +# +#HTML_HDR = $(SRCDIR)/html/html_unescape.h $(SRCDIR)/html/houdini.h +# +#$(PROG): $(SRCDIR)/html/html_unescape.h $(SRCDIR)/case_fold_switch.inc $(HTML_OBJ) $(CMARK_OBJ) $(SRCDIR)/main.c +# $(CC) $(LDFLAGS) -o $@ $(HTML_OBJ) $(CMARK_OBJ) $(SRCDIR)/main.c +# +#$(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re +# re2c --case-insensitive -bis $< > $@ || (rm $@ && false) +# +#$(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt +# perl mkcasefold.pl < $< > $@ +# +#$(SRCDIR)/html/html_unescape.h: $(SRCDIR)/html/html_unescape.gperf +# gperf -I -t -N find_entity -H hash_entity -K entity -C -l +# --null-strings -m5 $< > $@ +# +#libcommonmark.so: $(HTML_OBJ) $(CMARK_OBJ) +# $(CC) $(LDFLAGS) -shared -o $@ $^ +# #install: libcommonmark.so $(cmark_HDR) $(HTML_HDR) # install -d $(PREFIX)/lib $(PREFIX)/include/cmark/html # install libcommonmark.so $(PREFIX)/lib/ @@ -111,7 +122,7 @@ update-site: $(SITE)/dingus.html $(SITE)/js/commonmark.js $(SITE)/index.html $(S upload-site: cd $(SITE) ; git pull; git commit -a -m "Updated site for latest spec, js" ; git push; cd .. -clean: +distclean: clean -rm -f test $(SRCDIR)/*.o $(SRCDIR)/scanners.c $(SRCDIR)/html/*.o libcommonmark.so -rm -f js/commonmark.js -rm -rf *.dSYM -- cgit v1.2.3