Makefile 1.82 KB
Newer Older
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
1 2
ADDITIONAL_MODULES=modules/sbml/sbml_utils.pl
MODULES=$(shell sed -n -E 's/^- (.*\.pl)$$/\1/p' toc.org) $(ADDITIONAL_MODULES)
3 4
# load_test_files/1 should make this useless, but I cannot find how to use it
TEST_MODULES=$(wildcard $(MODULES:.pl=.plt))
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
5

6 7 8 9 10 11 12
$(foreach var, CC PLBASE PLCFLAGS PLLDFLAGS PLLIB, \
  $(eval \
    $(shell \
      swipl -dump-runtime-variables | \
      grep ^$(var)= | \
      sed -E 's/="/=/;s/";$$//')))

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
13
INCLUDEDIRS=modules/graphviz modules/sbml $(PLBASE)/include
14

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
15 16 17
CFLAGS=$(addprefix -I, $(INCLUDEDIRS)) $(PLCFLAGS)

LDFLAGS=$(PLLDFLAGS) $(addprefix -L, $(dir $(wildcard $(PLBASE)/lib/*/)))
18

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
19
LDLIBS=$(PLLIB) `pkg-config --libs libgvc libsbml`
20

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
21 22
SWIPL=$(PWD)/swipl-biocham

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
23
all: biocham biocham_debug test doc
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
24

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
25
.PHONY: test doc clean
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
26

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
27
biocham: platform/current swipl-biocham $(MODULES) toc.org Makefile
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
28
	$(SWIPL) -o biocham \
29 30
	  --goal=start --toplevel=toplevel -c $(MODULES)

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
31 32
biocham_debug: platform/current swipl-biocham $(MODULES) $(TEST_MODULES) \
		toc.org Makefile
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
33
	$(SWIPL) -o biocham_debug \
34 35
	  --goal=initialize -c $(MODULES) $(TEST_MODULES)

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
36 37 38
swipl-biocham: swipl-biocham.o \
		modules/graphviz/graphviz_swiprolog.o \
		modules/sbml/sbml_swiprolog.o
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
39

40
swipl-biocham.o: swipl-biocham.c
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
41

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
42 43 44
modules/graphviz/graphviz_swiprolog.o:
	make -C modules/graphviz

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
45 46 47
modules/sbml/sbml_swiprolog.o:
	make -C modules/sbml

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
48 49 50 51
platform/current:
	- rm platform/current
	ln -s `uname` platform/current

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
52
test: biocham_tests
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
53 54
	./biocham_tests

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
55 56 57
doc: biocham
	./biocham --generate-doc

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
58 59
biocham_tests: swipl-biocham $(MODULES) $(TEST_MODULES) Makefile
	$(SWIPL) -o biocham_tests \
60 61
		--goal="call_cleanup((run_tests, halt(0)), halt(1))" \
		-c $(MODULES) $(TEST_MODULES)
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
62 63

clean:
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
64
	- make -C modules/graphviz clean
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
65
	- make -C modules/sbml clean
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
66
	- rm platform/current
67 68 69 70 71
	- rm biocham
	- rm biocham_debug
	- rm biocham_tests
	- rm swipl-biocham
	- rm swipl-biocham.o