Makefile 1.59 KB
Newer Older
Thierry Martinez's avatar
Thierry Martinez committed
1
MODULES=$(shell sed -n -E 's/^- (.*\.pl)$$/\1/p' toc.org)
2 3
# 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
4

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

Thierry Martinez's avatar
SBML  
Thierry Martinez committed
12
INCLUDEDIRS=modules/graphviz $(PLBASE)/include
Thierry Martinez's avatar
Thierry Martinez committed
13

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

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

LDLIBS=$(PLLIB) `pkg-config --libs libgvc`

Thierry Martinez's avatar
Thierry Martinez committed
20
all: biocham biocham_debug test doc
Thierry Martinez's avatar
Thierry Martinez committed
21

Thierry Martinez's avatar
Thierry Martinez committed
22
.PHONY: test doc clean
Thierry Martinez's avatar
Thierry Martinez committed
23

Thierry Martinez's avatar
SBML  
Thierry Martinez committed
24 25
biocham: platform/current swipl-biocham $(MODULES) toc.org Makefile
	$(PWD)/swipl-biocham -o biocham \
Thierry Martinez's avatar
Thierry Martinez committed
26 27
	  --goal=start --toplevel=toplevel -c $(MODULES)

Thierry Martinez's avatar
SBML  
Thierry Martinez committed
28 29 30
biocham_debug: platform/current swipl-biocham $(MODULES) $(TEST_MODULES) \
		toc.org Makefile
	$(PWD)/swipl-biocham -o biocham_debug \
Thierry Martinez's avatar
Thierry Martinez committed
31 32 33
	  --goal=initialize -c $(MODULES) $(TEST_MODULES)

swipl-biocham: swipl-biocham.o modules/graphviz/graphviz_swiprolog.o
Thierry Martinez's avatar
Thierry Martinez committed
34

Thierry Martinez's avatar
Thierry Martinez committed
35
swipl-biocham.o: swipl-biocham.c
Thierry Martinez's avatar
Thierry Martinez committed
36

Thierry Martinez's avatar
SBML  
Thierry Martinez committed
37 38 39 40 41 42 43
modules/graphviz/graphviz_swiprolog.o:
	make -C modules/graphviz

platform/current:
	- rm platform/current
	ln -s `uname` platform/current

Thierry Martinez's avatar
Thierry Martinez committed
44
test: biocham_tests
Thierry Martinez's avatar
Thierry Martinez committed
45 46
	./biocham_tests

Thierry Martinez's avatar
Thierry Martinez committed
47 48 49
doc: biocham
	./biocham --generate-doc

50
biocham_tests: $(MODULES) $(TEST_MODULES) Makefile
Thierry Martinez's avatar
Thierry Martinez committed
51
	swipl -o biocham_tests \
Thierry Martinez's avatar
Thierry Martinez committed
52 53
		--goal="call_cleanup((run_tests, halt(0)), halt(1))" \
		-c $(MODULES) $(TEST_MODULES)
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
54 55

clean:
Thierry Martinez's avatar
SBML  
Thierry Martinez committed
56 57
	- make -C modules/graphviz clean
	- rm platform/current
Thierry Martinez's avatar
Thierry Martinez committed
58 59 60 61 62
	- rm biocham
	- rm biocham_debug
	- rm biocham_tests
	- rm swipl-biocham
	- rm swipl-biocham.o