blob: da813fe59e7efec499d22ac601bd7726e7066ae5 (
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
|
SYSTEM=$(shell uname)
ifeq ($(SYSTEM),Darwin)
ARCH_FLAGS=
SHARED_FLAGS=-dynamiclib
SHARED_EXT=dylib
CPPFLAGS = -dynamic
LD = g++
else
ARCH_FLAGS=-march=i686 -m32
SHARED_FLAGS=-shared
SHARED_EXT=so
LD = g++ -m32
endif
CC = gcc
CXX = g++
STRIP = strip
INCLUDES = \
-I../Baltisot/include \
-I../Baltisot/lib/zlib/include \
-I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \
-I /sw/include \
-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 -DHAVE_UCL
CPPFLAGS += $(INCLUDES) -O4 -fexceptions -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN $(ARCH_FLAGS) $(HAVES)
LDFLAGS += $(ARCH_FLAGS) $(SHARED_FLAGS) ./lua-interface.$(SHARED_EXT)
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
LUASLZ_SOURCES = \
plugin-luaslz.cc \
lzss.cpp \
WHOLE_SOURCES = \
$(LUASLZ_SOURCES) \
MODULES_LIST = \
luaslz.$(SHARED_EXT) \
ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES) $(LUA_LIB))))
ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES))))
all: dep modules
dist: modules
mkdir -p ../lua-interface-dist
cp $(MODULES_LIST) ../lua-interface-dist
modules: $(MODULES_LIST)
dep: $(ALL_DEPS)
luaslz.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(LUASLZ_SOURCES))))
$(LD) $(LDFLAGS) -o $@ $+ $(LUASLZ_LIBS)
clean:
rm -f *.o *.dep *.so *.dylib
%.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)
.PHONY: clean dist
|