Makefile 1.83 KB
Newer Older
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
1
ADDITIONAL_MODULES=modules/sbml/sbml_utils.pl
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))
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
6

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/";$$//')))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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