-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
60 lines (48 loc) · 1.51 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
LD=$(SWIPL)-ld
LDSOFLAGS=-Wall -shared -gdwarf-2 -g3
CC=gcc
MAKE=make
PACKSODIR=lib/$(SWIARCH)
FFI4PL=lib/$(SWIARCH)/ffi4pl.$(SOEXT)
LIBS=-lffi
CFLAGS=-shared -fPIC
TESTS=test_mode test_marshall test_bool test_enum test_struct test_union \
test_funcptr test_ccallback test_array
TESTSO=$(addprefix test/$(SWIARCH)/, $(addsuffix .$(SOEXT), $(TESTS)))
TESTFLAGS=-q -t halt -f none
all: env $(FFI4PL)
ifeq ($(SOEXT),)
env::
@echo "Please use . buildenv.sh to setup the environment"
@exit 1
else
env::
endif
$(FFI4PL): c/ffi4pl.c c/cmemory.c Makefile
mkdir -p $(PACKSODIR)
$(LD) $(LDSOFLAGS) -o $@ c/ffi4pl.c $(LIBS)
test/$(SWIARCH)/%.$(SOEXT): test/%.c
mkdir -p test/$(SWIARCH)
$(CC) $(CFLAGS) -o $@ $<
$(TESTSO): env
tags:
etags c/*.[ch]
check: $(TESTSO)
$(SWIPL) $(TESTFLAGS) -g test_cmem test/test_cmem.pl
$(SWIPL) $(TESTFLAGS) -g test_mode test/test_mode.pl
$(SWIPL) $(TESTFLAGS) -g test_marshall test/test_marshall.pl
$(SWIPL) $(TESTFLAGS) -g test_bool test/test_bool.pl
$(SWIPL) $(TESTFLAGS) -g test_enum test/test_enum.pl
$(SWIPL) $(TESTFLAGS) -g test_struct test/test_struct.pl
$(SWIPL) $(TESTFLAGS) -g test_union test/test_union.pl
$(SWIPL) $(TESTFLAGS) -g test_funcptr test/test_funcptr.pl
$(SWIPL) $(TESTFLAGS) -g test_qsort test/test_qsort.pl
$(SWIPL) $(TESTFLAGS) -g test_libc test/test_libc.pl
$(SWIPL) $(TESTFLAGS) -g test_ccallback test/test_ccallback.pl
$(SWIPL) $(TESTFLAGS) -g test_array test/test_array.pl
install::
clean:
rm -f *~
rm -f test/*.$(SOEXT)
distclean: clean
rm -f $(FFI4PL)