-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
90 lines (69 loc) · 1.65 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
UNAME := $(shell uname)
ifeq ($(UNAME),$(filter $(UNAME),Linux Darwin SunOS FreeBSD GNU/kFreeBSD NetBSD OpenBSD GNU))
ifeq ($(UNAME),$(filter $(UNAME),Darwin))
OS=darwin
else
ifeq ($(UNAME),$(filter $(UNAME),SunOS))
OS=solaris
else
ifeq ($(UNAME),$(filter $(UNAME),FreeBSD GNU/kFreeBSD NetBSD OpenBSD))
OS=bsd
else
OS=linux
endif
endif
endif
else
OS=windows
endif
HARDWARE_NAME := $(shell uname -m)
ifneq ($(findstring 64, $(HARDWARE_NAME)),)
BITS=""
else
BITS=""
endif
SHELL := /bin/bash
ifndef SWIARCH
SWIARCH=$(shell uname -m)-$(OS)
endif
LIBDIR=lib/$(SWIARCH)
#
#
CC=swipl-ld
INC1=src/swicli
CURRDIR=$(shell pwd)
#INC2=$(shell while read one two three; \
#do TEMP=$two; \
#done <<< `whereis swipl`; \
#readlink -f $TEMP; \
)/include #da completare
CFLAGS=$(shell pkg-config --cflags --libs mono-2)
INC2=$(SWIHOME)/include
#INC2=`echo /usr/lib/swi*`/include/
INCDIRS= -I$(INC1) -I$(INC2)
LDFLAGS= $(CFLAGS) -fPIC -DBP_FREE -O3 -fomit-frame-pointer -Wall -g -O2 $(INCDIRS)
ifndef SOEXT
SOEXT=so
endif
SWICLI_SO=$(LIBDIR)/swicli.$(SOEXT)
all: prepare compile
prepare:
@echo $(shell ./make-linux.sh prepare)
compile: $(SWICLI_SO)
@echo $(shell ./make-linux.sh compile)
$(SWICLI_SO):
$(CC) -shared -Wno-unused-result src/swicli/swicli.c $(LDFLAGS) $(MONO_FLAGS) -o $(SWICLI_SO)
distclean: clean
@echo rm Makefile.bak
clean: prepare
rm -f $(SWICLI_SO) \
@echo $(shell ./make-linux.sh clean)
check:
@echo "the check is in your mouth" \
@echo $(shell ./make-linux.sh check)
install:
@echo install $(SWICLI_SO) $(LIBDIR) \
@echo $(shell ./make-linux.sh install)
uninstall:
@echo Uninstall $(SWICLI_SO) $(LIBDIR) \
@echo $(shell ./make-linux.sh uninstall)