diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-24 12:01:33 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-24 12:01:33 -0800 |
commit | e1c590d3de3e519ef38d5abf48cef069e07a72a2 (patch) | |
tree | 1d0d75881b903d3160e0a3423a2116fdaf25c22b | |
parent | d6c615f2680e79bbb76cc85a056aadfe3524513f (diff) | |
parent | a6018fad143774e5976b86b78e83afe055bd9879 (diff) |
Merge pull request #297 from nwellnhof/makefile_fixes
Makefile fixes
-rw-r--r-- | Makefile | 28 | ||||
-rw-r--r-- | README.md | 5 |
2 files changed, 20 insertions, 13 deletions
@@ -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 @@ -42,7 +42,10 @@ the repository to reduce build dependencies. If you have GNU make, you can simply `make`, `make test`, and `make install`. This calls [cmake] to create a `Makefile` in the `build` directory, then uses that `Makefile` to create the executable and -library. The binaries can be found in `build/src`. +library. The binaries can be found in `build/src`. The default +installation prefix is `/usr/local`. To change the installation +prefix, pass the `INSTALL_PREFIX` variable if you run `make` for the +first time: `make INSTALL_PREFIX=path`. For a more portable method, you can use [cmake] manually. [cmake] knows how to create build environments for many build systems. For example, |