-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
52 lines (38 loc) · 1.28 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
################################################################
# Build the Clingo interface for SWI-Prolog
################################################################
-include FLAGS
CLINGOHOME?=${HOME}/clingo
BUILD?=debug
SWIPLLD?=swipl-ld
SWIPL?=swipl
COFLAGS?=-gdwarf-2 -g3 -O0
CLINGOLIBDIR=$(CLINGOHOME)/build/$(BUILD)/bin
CFLAGS=-I$(CLINGOHOME)/libclingo -W -Wall $(COFLAGS)
LIBS=-L$(CLINGOLIBDIR) -lclingo
LDFLAGS=-cc-options,-std=c99 -Wl,-rpath=/home/wv/bin/linux/64/swipl/lib/swipl-7.3.15/lib/x86_64-linux -shared
SO=so
all: clingo.$(SO)
FLAGS:
rm -f FLAGS
echo "CLINGOHOME:=$(CLINGOHOME)" >> FLAGS
echo "BUILD:=$(BUILD)" >> FLAGS
echo "SWIPLLD:=$(SWIPLLD)" >> FLAGS
echo "SWIPL=$(SWIPL)" >> FLAGS
echo "PLFLAGS=-pl \$$(SWIPL)" >> FLAGS
echo "COFLAGS=$(COFLAGS)" >> FLAGS
SRC=clingo.c
.PHONY: check
check:
swipl -p library=. -p foreign=. -f test_clingo.pl -g test_clingo,halt -t 'halt(1)' -q
.PHONY: clean
clean:
rm -f clingo.$(SO)
clingo.$(SO): $(SRC) FLAGS
$(SWIPLLD) $(PLFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(SRC) $(LIBS)
install: clingo.$(SO)
eval $$($(SWIPL) --dump-runtime-variables) && \
install -m 644 clingo.pl $$PLBASE/library
eval $$($(SWIPL) --dump-runtime-variables) && \
install -m 644 clingo.$(SO) $$PLBASE/lib/$$PLARCH
$(SWIPL) -g make,halt -t 'halt(1)'