summaryrefslogtreecommitdiff
path: root/Makefile.mingw32
blob: cfd76522cdde0df9345d2ee7260594230a0765f2 (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
SYSTEM=$(shell uname)
ifeq ($(SYSTEM),Darwin)
CC = i386-mingw32-gcc
CXX = i386-mingw32-g++
LD = i386-mingw32-g++
STRIP = i386-mingw32-strip --strip-unneeded
else
ifeq ($(SYSTEM),MINGW32_NT-5.1)
CC = gcc
CXX = g++
LD = g++
STRIP = strip --strip-unneeded
else
DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1)
ifeq ($(DISTRIB), CentOS)
CC = i686-pc-mingw32-gcc
CXX = i686-pc-mingw32-g++
LD = i686-pc-mingw32-g++
STRIP = i686-pc-mingw32-strip --strip-unneeded
else
CC = i586-mingw32msvc-gcc
CXX = i586-mingw32msvc-g++
LD = i586-mingw32msvc-g++
STRIP = i586-mingw32msvc-strip --strip-unneeded
endif
endif
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

vpath %.c ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev
vpath %.cc ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev
vpath %.cpp ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev
vpath %.lua ../Baltisot/lib:../Baltisot/src

LUACD_SOURCES = \
plugin-luacd.cc \
luacd.cpp \
cdabstract.cpp \
cdreader.cpp \
cdutils.cpp \
dvdabstract.cpp \
isobuilder.cpp \
yazedc.cpp \

LUAPSX_SOURCES = \
plugin-luapsx.cc \
luapsx.cpp \
bs.c \
idctfst.c \
jfdctint.c \
vlc.c \
xadecode.c \

WHOLE_SOURCES = \
$(LUAPSX_SOURCES) \
$(LUACD_SOURCES) \

MODULES_LIST = \
luapsx.dll \
luacd.dll \

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-win32
	$(STRIP) $(MODULES_LIST)
	cp $(MODULES_LIST) ../lua-interface-dist-win32

modules: $(ALL_OBJECTS) $(MODULES_LIST)

dep: $(ALL_DEPS)

luapsx.dll: $(addsuffix .o, $(notdir $(basename $(LUAPSX_SOURCES))))
	$(LD) -o $@ $+ $(LDFLAGS)

luacd.dll: $(addsuffix .o, $(notdir $(basename $(LUACD_SOURCES))))
	$(LD) -o $@ $+ $(LDFLAGS)

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)