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

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

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

Thierry Martinez's avatar
SBML    
Thierry Martinez committed
16
17
18
CFLAGS=$(addprefix -I, $(INCLUDEDIRS)) $(PLCFLAGS)

LDFLAGS=$(PLLDFLAGS) $(addprefix -L, $(dir $(wildcard $(PLBASE)/lib/*/)))
Thierry Martinez's avatar
Thierry Martinez committed
19

Thierry Martinez's avatar
SBML    
Thierry Martinez committed
20
LDLIBS=$(PLLIB) `pkg-config --libs libgvc libsbml`
Thierry Martinez's avatar
Thierry Martinez committed
21

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

Thierry Martinez's avatar
Thierry Martinez committed
24
all: biocham biocham_debug test doc
Thierry Martinez's avatar
Thierry Martinez committed
25

Thierry Martinez's avatar
Thierry Martinez committed
26
.PHONY: test doc clean
Thierry Martinez's avatar
Thierry Martinez committed
27

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

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

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

Thierry Martinez's avatar
Thierry Martinez committed
41
swipl-biocham.o: swipl-biocham.c
Thierry Martinez's avatar
Thierry Martinez committed
42

Thierry Martinez's avatar
SBML    
Thierry Martinez committed
43
44
45
modules/graphviz/graphviz_swiprolog.o:
	make -C modules/graphviz

Thierry Martinez's avatar
SBML    
Thierry Martinez committed
46
47
48
modules/sbml/sbml_swiprolog.o:
	make -C modules/sbml

Thierry Martinez's avatar
SBML    
Thierry Martinez committed
49
50
51
52
platform/current:
	- rm platform/current
	ln -s `uname` platform/current

Thierry Martinez's avatar
Thierry Martinez committed
53
test: biocham_tests
Thierry Martinez's avatar
Thierry Martinez committed
54
55
	./biocham_tests

Thierry Martinez's avatar
Thierry Martinez committed
56
57
58
doc: biocham
	./biocham --generate-doc

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

64
65
66
jupyter: biocham
	jupyter kernelspec install --user --name=biocham biocham_kernel

SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
67
clean:
Thierry Martinez's avatar
SBML    
Thierry Martinez committed
68
	- make -C modules/graphviz clean
Thierry Martinez's avatar
SBML    
Thierry Martinez committed
69
	- make -C modules/sbml clean
Thierry Martinez's avatar
SBML    
Thierry Martinez committed
70
	- rm platform/current
Thierry Martinez's avatar
Thierry Martinez committed
71
72
73
74
75
	- rm biocham
	- rm biocham_debug
	- rm biocham_tests
	- rm swipl-biocham
	- rm swipl-biocham.o