summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--Makefile.mingw3275
2 files changed, 80 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d255e83..311e5e2 100644
--- a/Makefile
+++ b/Makefile
@@ -36,12 +36,16 @@ FINK=$(USR)
LIBXM = $(FINK)
endif
LIBXM = $(FINK)/sw/lib/libXm.a -lXp
+GMPLIBDIR=../gmp-4.3.2-darwin9/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
+GMPLIBDIR=../gmp-4.3.2-linux/lib
+GMP_LIBS=-Wl,--whole-archive $(GMPLIBDIR)/libgmpxx.a $(GMPLIBDIR)/libgmp.a -Wl,--no-whole-archive
endif
INCLUDES = \
@@ -65,8 +69,6 @@ GMP_SOURCES = \
plugin-luagmp.cc \
lgmp.lua \
-GMP_LIBS = -lgmp
-
WHOLE_SOURCES = \
$(GMP_SOURCES) \
@@ -91,7 +93,7 @@ luagmp.a: $(addsuffix .o, $(notdir $(basename $(GMP_SOURCES))))
$(AR) $@ $+
luagmp.$(SHARED_EXT): plugin-luagmp.o luagmp.a
- $(LD) $(LDFLAGS) -o $@ $+ $(IM_LIBS) $(CD_LIBS) $(IUP_LIBS)
+ $(LD) $(LDFLAGS) -o $@ $+ $(GMP_LIBS)
clean:
rm -f *.o *.dep *.so *.dylib *.a
diff --git a/Makefile.mingw32 b/Makefile.mingw32
new file mode 100644
index 0000000..b8cb4b2
--- /dev/null
+++ b/Makefile.mingw32
@@ -0,0 +1,75 @@
+SYSTEM=$(shell uname)
+ifeq ($(SYSTEM),Darwin)
+CC = i386-mingw32-gcc
+CXX = i386-mingw32-g++
+LD = i386-mingw32-g++
+STRIP = i386-mingw32-strip
+else
+CC = i586-mingw32msvc-gcc
+CXX = i586-mingw32msvc-g++
+LD = i586-mingw32msvc-g++
+STRIP = i586-mingw32msvc-strip
+endif
+
+INCLUDES = \
+-I ../Mesa-7.0.3-win32/include \
+-I../Baltisot/include \
+-I../Baltisot/lib/zlib/include \
+-I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \
+-I../PSX-Bundle/includes -I../PSX-Bundle/psxdev \
+
+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 -Wl,--export-dynamic ../lua-interface/lua-interface.a -Wl,--enable-auto-image-base --export-all-symbols -Wl,--enable-auto-import
+
+GMPLIBDIR=../gmp-4.3.2-mingw32
+GMP_LIBS=-Wl,--whole-archive $(GMPLIBDIR)/libgmpxx.a $(GMPLIBDIR)/libgmp.a -Wl,--no-whole-archive
+
+vpath %.c ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src
+vpath %.cc ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src
+vpath %.cpp ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src
+vpath %.lua ../Baltisot/lib:../Baltisot/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 : %.clua
+ bin2c $< $@ $(basename $@)
+
+%.clua : %.lua
+ ./luac -o $@ $<
+
+-include $(ALL_DEPS)