-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile.mingw
46 lines (39 loc) · 1.42 KB
/
Makefile.mingw
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
.SUFFIXES: .obj .dll
MINGW64=/home/janw/mingw64
MINGW32=/home/janw/mingw32
PLHOME64=$(MINGW64)/swipl
PLHOME32=$(MINGW32)/swipl
ARCH64=x64-win64
ARCH32=i386-win32
CC64=x86_64-w64-mingw32-gcc
CC32=i686-w64-mingw32-gcc
CFLAGS=-Wall -O2 -D_REENTRANT -D__WINDOWS__ -D_WINDOWS -D__SWI_PROLOG__
CIFLAGS64=-I$(PLHOME64)/include -I$(MINGW64)/include
CIFLAGS32=-I$(PLHOME32)/include -I$(MINGW32)/include
LIBS=-lffi -lswipl -lpthread
DLLFLAGS=-shared
TESTS=test_mode test_marshall test_enum test_struct test_union test_funcptr
TESTDLL=$(addprefix test/$(ARCH64)/, $(addsuffix .dll, $(TESTS))) \
$(addprefix test/$(ARCH32)/, $(addsuffix .dll, $(TESTS))) \
all: lib/$(ARCH64)/ffi4pl.dll lib/$(ARCH32)/ffi4pl.dll $(TESTDLL)
c/ffi4pl64.obj: c/ffi4pl.c c/cmemory.c
$(CC64) $(CFLAGS) $(CIFLAGS64) -c -o $@ $<
c/ffi4pl32.obj: c/ffi4pl.c c/cmemory.c
$(CC32) $(CFLAGS) $(CIFLAGS32) -c -o $@ $<
lib/$(ARCH64)/ffi4pl.dll: c/ffi4pl64.obj
mkdir -p lib/$(ARCH64)
$(CC64) -shared -o $@ $< -L$(PLHOME64)/bin -L$(MINGW64)/lib $(LIBS)
lib/$(ARCH32)/ffi4pl.dll: c/ffi4pl32.obj
mkdir -p lib/$(ARCH32)
$(CC32) -shared -o $@ $< -L$(PLHOME32)/bin -L$(MINGW32)/lib $(LIBS)
test/$(ARCH64)/%.dll: test/%.c
mkdir -p test/$(ARCH64)
$(CC64) $(DLLFLAGS) -o $@ $<
test/$(ARCH32)/%.dll: test/%.c
mkdir -p test/$(ARCH32)
$(CC32) $(DLLFLAGS) -o $@ $<
clean::
rm -f c/ffi4pl64.obj c/ffi4pl32.obj $(TESTDLL)
ffi4swipl-windows.zip:
rm -f $@
zip -r $@ $(shell find . -name '*.dll')