| 1 |
# Configuration options. |
| 2 |
gdb = not-set |
| 3 |
assert = not-set |
| 4 |
assert2 = not-set |
| 5 |
debug = not-set |
| 6 |
gprof = not-set |
| 7 |
openmp = not-set |
| 8 |
prefix = not-set |
| 9 |
pcre = not-set |
| 10 |
gkregex = not-set |
| 11 |
gkrand = not-set |
| 12 |
|
| 13 |
|
| 14 |
# Basically proxies everything to the builddir cmake. |
| 15 |
cputype = $(shell uname -m | sed "s/\\ /_/g") |
| 16 |
systype = $(shell uname -s) |
| 17 |
|
| 18 |
BUILDDIR = build/$(systype)-$(cputype) |
| 19 |
|
| 20 |
# Process configuration options. |
| 21 |
CONFIG_FLAGS = -DCMAKE_VERBOSE_MAKEFILE=1 |
| 22 |
ifneq ($(gdb), not-set) |
| 23 |
CONFIG_FLAGS += -DGDB=$(gdb) |
| 24 |
endif |
| 25 |
ifneq ($(assert), not-set) |
| 26 |
CONFIG_FLAGS += -DASSERT=$(assert) |
| 27 |
endif |
| 28 |
ifneq ($(assert2), not-set) |
| 29 |
CONFIG_FLAGS += -DASSERT2=$(assert2) |
| 30 |
endif |
| 31 |
ifneq ($(debug), not-set) |
| 32 |
CONFIG_FLAGS += -DDEBUG=$(debug) |
| 33 |
endif |
| 34 |
ifneq ($(gprof), not-set) |
| 35 |
CONFIG_FLAGS += -DGPROF=$(gprof) |
| 36 |
endif |
| 37 |
ifneq ($(openmp), not-set) |
| 38 |
CONFIG_FLAGS += -DOPENMP=$(openmp) |
| 39 |
endif |
| 40 |
ifneq ($(pcre), not-set) |
| 41 |
CONFIG_FLAGS += -DPCRE=$(pcre) |
| 42 |
endif |
| 43 |
ifneq ($(gkregex), not-set) |
| 44 |
CONFIG_FLAGS += -DGKREGEX=$(pcre) |
| 45 |
endif |
| 46 |
ifneq ($(gkrand), not-set) |
| 47 |
CONFIG_FLAGS += -DGKRAND=$(pcre) |
| 48 |
endif |
| 49 |
ifneq ($(prefix), not-set) |
| 50 |
CONFIG_FLAGS += -DCMAKE_INSTALL_PREFIX=$(prefix) |
| 51 |
endif |
| 52 |
|
| 53 |
define run-config |
| 54 |
mkdir -p $(BUILDDIR) |
| 55 |
cd $(BUILDDIR) && cmake $(CURDIR) $(CONFIG_FLAGS) |
| 56 |
endef |
| 57 |
|
| 58 |
all clean install: $(BUILDDIR) |
| 59 |
make -C $(BUILDDIR) $@ |
| 60 |
|
| 61 |
uninstall: |
| 62 |
xargs rm < $(BUILDDIR)/install_manifest.txt |
| 63 |
|
| 64 |
$(BUILDDIR): |
| 65 |
$(run-config) |
| 66 |
|
| 67 |
config: distclean |
| 68 |
$(run-config) |
| 69 |
|
| 70 |
distclean: |
| 71 |
rm -rf $(BUILDDIR) |
| 72 |
|
| 73 |
remake: |
| 74 |
find . -name CMakeLists.txt -exec touch {} ';' |
| 75 |
|
| 76 |
.PHONY: config distclean all clean install uninstall remake |