blob: 5f2c9d2d0063400bb11f06cfc21f4ca182d3fb9e (
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
ifeq ($(SYSTEM),)
SYSTEM=$(shell uname)
endif
TRUESYSTEM=$(shell uname)
MACHINE=$(shell uname -m)
DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1)
GL_GLUE=gl-glue.s
CC = gcc
CXX = g++
LD = g++
AS = as
AR = ar rcs
USR=/usr
LIBXM = -lXm
ifeq ($(SYSTEM),Darwin)
ARCH_FLAGS=-arch i386
SHARED_FLAGS=-dynamiclib
SHARED_EXT=dylib
CPPFLAGS = -dynamic
LD = g++ -arch i386 -read_only_relocs suppress
STRIP = strip -x
FINK=
ifeq ($(TRUESYSTEM),Linux)
CC = i686-apple-darwin9-gcc
CXX = i686-apple-darwin9-g++
LD = i686-apple-darwin9-g++ -arch i386 -mmacosx-version-min=10.5 -read_only_relocs suppress
STRIP = i686-apple-darwin9-strip -x
AS = i686-apple-darwin9-as -arch i386
LIPO = i686-apple-darwin9-lipo
AR = i686-apple-darwin9-ar rcs
ARCH_FLAGS =
LDFLAGS_MESA = -all_load ../Mesa-7.4.4-darwin9/lib/libGLU.a ../Mesa-7.4.4-darwin
LUAJIT = ../LuaJIT-darwin9/src/libluajit.a
USR=/usr/i686-apple-darwin9
FINK=$(USR)
LIBXM = $(FINK)
endif
LIBXM = $(FINK)/sw/lib/libXm.a -lXp
GMPDIR=../gmp-4.3.2-darwin9
GMPLIBDIR=$(GMPDIR)/lib
GMP_LIBS=-all_load $(GMPLIBDIR)/libgmpxx.a $(GMPLIBDIR)/libgmp.a
else
ARCH_FLAGS=-march=i686 -m32
SHARED_FLAGS=-shared
SHARED_EXT=so
LD = g++ -m32
STRIP = strip --strip-unneeded
GMPDIR=../gmp-4.3.2-linux
GMPLIBDIR=$(GMPDIR)/lib
GMP_LIBS=-Wl,--whole-archive $(GMPLIBDIR)/libgmpxx.a $(GMPLIBDIR)/libgmp.a -Wl,--no-whole-archive
endif
INCLUDES = \
-I../Baltisot/include \
-I../LuaJIT/src \
-I $(FINK)/sw/include \
-I $(GMPDIR)/include \
HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_FCNTL -DHAVE_UNISTD_H -DHAVE_FORK -DHAVE_PIPE -DHAVE_FSYNC -DHAVE_MALLOC_H -DHAVE_ASPRINTF -DHAVE_BYTESWAP_H -DCD_NO_OLD_INTERFACE -DGTK_DISABLE_DEPRECATED -DIUPLUA_USELOH -DUSE_STATIC
CPPFLAGS_NO_ARCH += $(INCLUDES) -O4 -fexceptions -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN $(HAVES) -DTEC_LITTLEENDIAN -g -DNDEBUG -DUSE_MGL_NAMESPACE
CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
LDFLAGS += $(ARCH_FLAGS) $(SHARED_FLAGS) -L$(FINK)/sw/lib ./lua-interface.$(SHARED_EXT)
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
GMP_SOURCES = \
plugin-luagmp.cc \
lgmp.lua \
WHOLE_SOURCES = \
$(GMP_SOURCES) \
MODULES_LIST = \
luagmp.$(SHARED_EXT) \
ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES))))
ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES))))
all: dep modules
dist: modules
mkdir -p ../lua-interface-dist
$(STRIP) $(MODULES_LIST)
cp $(MODULES_LIST) ../lua-interface-dist
modules: $(MODULES_LIST)
dep: $(ALL_DEPS)
luagmp.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(GMP_SOURCES))))
$(LD) $(LDFLAGS) -o $@ $+ $(GMP_LIBS)
clean:
rm -f *.o *.dep *.so *.dylib *.a
%.dep : %.c
$(CC) $(CPPFLAGS_NO_ARCH) -M -MF $@ $<
%.dep : %.cpp
$(CXX) $(CPPFLAGS_NO_ARCH) -M -MF $@ $<
%.dep : %.cc
$(CXX) $(CPPFLAGS_NO_ARCH) -M -MF $@ $<
%.c : %.lua
bin2c $< $@ $(basename $@)
-include $(ALL_DEPS)
.PHONY: dist clean
|