blob: 96a74f12f26a509d229250701a3a2806de840160 (
plain)
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
|
SYSTEM=$(shell uname)
ifeq ($(SYSTEM),Darwin)
CC = i386-mingw32-gcc
CXX = i386-mingw32-g++
LD = i386-mingw32-g++
STRIP = i386-mingw32-strip
else
CC = i686-w64-mingw32-gcc
CXX = i686-w64-mingw32-g++
LD = i686-w64-mingw32-g++
STRIP = i686-w64-mingw32-strip
endif
GMPDIR=../gmp-4.3.2-mingw32
GMPLIBDIR=$(GMPDIR)/lib
INCLUDES = \
-I../Baltisot/include \
-I../LuaJIT/src \
-I../gnuwin32/include \
-I$(GMPDIR)/include \
HAVES = -DHAVE_VSSCANF -DHAVE_FCNTL -DHAVE_UNISTD_H -DHAVE_FORK -DHAVE_PIPE -DHAVE_FSYNC -DHAVE_MALLOC_H -DHAVE_ASPRINTF -DHAVE_BYTESWAP_H
CPPFLAGS += $(INCLUDES) -g -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN -fexceptions -march=i686 $(HAVES)
LDFLAGS += -g -fexception -shared ../lua-interface/lua-interface.a -Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--enable-auto-import
GMP_LIBS=-Wl,--whole-archive $(GMPLIBDIR)/libgmpxx.a $(GMPLIBDIR)/libgmp.a -Wl,--no-whole-archive
vpath %.c ../Baltisot/lib:../Baltisot/src:src
vpath %.cc ../Baltisot/lib:../Baltisot/src:src
vpath %.cpp ../Baltisot/lib:../Baltisot/src:src
vpath %.lua ../Baltisot/lib:../Baltisot/src:src
LUAGMP_SOURCES = \
plugin-luagmp.cc \
lgmp.lua \
WHOLE_SOURCES = \
$(LUAGMP_SOURCES) \
MODULES_LIST = \
luagmp.dll \
ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES))))
ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES))))
all: dep modules
modules: $(ALL_OBJECTS) $(MODULES_LIST)
dep: $(ALL_DEPS)
luagmp.dll: $(addsuffix .o, $(notdir $(basename $(LUAGMP_SOURCES))))
$(LD) -o $@ $+ $(LDFLAGS) $(GMP_LIBS)
clean:
rm -f *.o *.dep *.dll
%.dep : %.c
$(CC) $(CPPFLAGS) -M -MF $@ $<
%.dep : %.cpp
$(CXX) $(CPPFLAGS) -M -MF $@ $<
%.dep : %.cc
$(CXX) $(CPPFLAGS) -M -MF $@ $<
%.c : %.lua
bin2c $< $@ $(basename $@)
-include $(ALL_DEPS)
|