summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-24 12:01:33 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-24 12:01:33 -0800
commite1c590d3de3e519ef38d5abf48cef069e07a72a2 (patch)
tree1d0d75881b903d3160e0a3423a2116fdaf25c22b /Makefile
parentd6c615f2680e79bbb76cc85a056aadfe3524513f (diff)
parenta6018fad143774e5976b86b78e83afe055bd9879 (diff)
Merge pull request #297 from nwellnhof/makefile_fixes
Makefile fixes
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 16 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index f9e0625..59d55a9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-SRCDIR?=src
-DATADIR?=data
+SRCDIR=src
+DATADIR=data
BUILDDIR?=build
GENERATOR?=Unix Makefiles
MINGW_BUILDDIR?=build-mingw
@@ -13,27 +13,31 @@ BENCHDIR=bench
BENCHFILE=$(BENCHDIR)/benchinput.md
ALLTESTS=alltests.md
NUMRUNS?=10
-PROG?=$(BUILDDIR)/src/cmark
+PROG=$(BUILDDIR)/src/cmark
BENCHINP?=README.md
JSMODULES=$(wildcard js/lib/*.js)
VERSION?=$(SPECVERSION)
RELEASE?=CommonMark-$(VERSION)
+INSTALL_PREFIX?=/usr/local
-.PHONY: all spec leakcheck clean fuzztest dingus upload jshint test testjs benchjs update-site upload-site check npm debug mingw archive tarball ziparchive testtarball testziparchive testlib bench astyle
+.PHONY: all cmake_build spec leakcheck clean fuzztest dingus upload jshint test testjs benchjs update-site upload-site npm debug mingw archive tarball ziparchive testtarball testziparchive testlib bench astyle
-all: $(PROG) man/man3/cmark.3
- @echo "Binaries can be found in $(BUILDDIR)/src"
+all: cmake_build man/man3/cmark.3
+
+$(PROG): cmake_build
-$(PROG): $(BUILDDIR)
+cmake_build: $(BUILDDIR)
@make -j2 -C $(BUILDDIR)
+ @echo "Binaries can be found in $(BUILDDIR)/src"
-check:
+$(BUILDDIR):
@cmake --version > /dev/null || (echo "You need cmake to build this program: http://www.cmake.org/download/" && exit 1)
-
-$(BUILDDIR): check $(SRCDIR)/html_unescape.h $(SRCDIR)/case_fold_switch.inc
mkdir -p $(BUILDDIR); \
cd $(BUILDDIR); \
- cmake .. -G "$(GENERATOR)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
+ cmake .. \
+ -G "$(GENERATOR)" \
+ -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
+ -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
install: $(BUILDDIR)
make -C $(BUILDDIR) install
@@ -76,7 +80,7 @@ $(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt
$(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
re2c --case-insensitive -b -i --no-generation-date -o $@ $<
-test: $(SPEC) $(BUILDDIR)
+test: $(SPEC) cmake_build
make -C $(BUILDDIR) test || (cat $(BUILDDIR)/Testing/Temporary/LastTest.log && exit 1)
$(ALLTESTS): spec.txt