summaryrefslogtreecommitdiff
path: root/compile/linux/Makefile
blob: 4f60ab860092c78b8f7a350ba92a8c5fda97a0cb (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
CC = gcc
CXX = g++
LD = g++
STRIP = strip --strip-all

INCLUDES = -I../../includes -I../../psxdev -I../../generic/include \
-I../../generic/lib/zlib/include \
-I../../generic/lib/lua/include -I../../generic/lib/lua/includes \
-I../../mogltk/include \
-I../.. \
`sdl-config --cflags`

CPPFLAGS = $(INCLUDES) -O4 -march=i686 -DSTDC_HEADERS -DREADLINE_STATIC -DHAVE_UNISTD_H -fexceptions

LDFLAGS = -march=i586 -O4 `sdl-config --libs`

SOURCES = \
../../Dalos/Dalos.cc ../../cd-tool.cpp

MOGLTK_SOURCES = \
../../mogltk/lib/base.cc      ../../mogltk/lib/glwidgets.cc \
../../mogltk/lib/engine.cc    ../../mogltk/lib/mcolor.cc \
../../mogltk/lib/font.cc      ../../mogltk/lib/shape.cc \
../../mogltk/lib/glbase.cc    ../../mogltk/lib/sprite.cc \
../../mogltk/lib/glfont.cc    ../../mogltk/lib/texture.cc \
../../mogltk/lib/glshape.cc   ../../mogltk/lib/widgets.cc \
../../mogltk/lib/glsprite.cc

BALTISOT_SOURCES = \
../../generic/lib/Image.cc       ../../generic/lib/Main.cc \
../../generic/lib/BLua.cc        ../../generic/lib/Buffer.cc \
../../generic/lib/ConfigFile.cc  ../../generic/lib/Output.cc \
../../generic/lib/Exceptions.cc  ../../generic/lib/Regex.cc \
../../generic/lib/Handle.cc      ../../generic/lib/String.cc \
../../generic/lib/Input.cc       ../../generic/lib/fileutils.cc \
../../generic/lib/LuaHandle.cc   ../../generic/lib/generic.cc \
../../generic/lib/checkargs.c    ../../generic/lib/datecalc.c \
../../generic/lib/LuaConfigFile.cc

ZLIB_SOURCES = \
../../generic/lib/zlib/src/adler32.c   ../../generic/lib/zlib/src/inffast.c \
../../generic/lib/zlib/src/compress.c  ../../generic/lib/zlib/src/inflate.c \
../../generic/lib/zlib/src/crc32.c     ../../generic/lib/zlib/src/inftrees.c \
../../generic/lib/zlib/src/deflate.c   ../../generic/lib/zlib/src/infutil.c \
../../generic/lib/zlib/src/gzio.c      ../../generic/lib/zlib/src/trees.c \
../../generic/lib/zlib/src/infblock.c  ../../generic/lib/zlib/src/uncompr.c \
../../generic/lib/zlib/src/infcodes.c  ../../generic/lib/zlib/src/zutil.c

LUA_SOURCES = \
../../generic/lib/lua/src/lapi.c      ../../generic/lib/lua/src/lparser.c \
../../generic/lib/lua/src/lcode.c     ../../generic/lib/lua/src/lstate.c \
../../generic/lib/lua/src/ldebug.c    ../../generic/lib/lua/src/lstring.c \
../../generic/lib/lua/src/ldo.c       ../../generic/lib/lua/src/ltable.c \
../../generic/lib/lua/src/ldump.c     ../../generic/lib/lua/src/ltests.c \
../../generic/lib/lua/src/lfunc.c     ../../generic/lib/lua/src/ltm.c \
../../generic/lib/lua/src/lgc.c       ../../generic/lib/lua/src/luacomp.c \
../../generic/lib/lua/src/llex.c      ../../generic/lib/lua/src/lundump.c \
../../generic/lib/lua/src/lmem.c      ../../generic/lib/lua/src/lvm.c \
../../generic/lib/lua/src/lobject.c   ../../generic/lib/lua/src/lzio.c \
../../generic/lib/lua/src/lopcodes.c \
../../generic/lib/lua/src/LuaLib/lauxlib.c \
../../generic/lib/lua/src/LuaLib/lbaselib.c \
../../generic/lib/lua/src/LuaLib/ldblib.c \
../../generic/lib/lua/src/LuaLib/liolib.c \
../../generic/lib/lua/src/LuaLib/lmathlib.c \
../../generic/lib/lua/src/LuaLib/loadlib.c \
../../generic/lib/lua/src/LuaLib/lstrlib.c \
../../generic/lib/lua/src/LuaLib/ltablib.c \
../../generic/lib/lua/src/LuaLib/ldirlib.c

PSX_SOURCES = \
../../lib/cdabstract.cpp  ../../lib/luacd.cpp  \
../../lib/cdreader.cpp    ../../lib/luapsx.cpp \
../../lib/cdutils.cpp     ../../lib/lzss.cpp   \
 ../../lib/yazedc.cpp     ../../lib/isobuilder.cpp

PSXDEV_SOURCES = \
../../psxdev/bs.c       ../../psxdev/jfdctint.c  ../../psxdev/xadecode.c \
../../psxdev/idctfst.c  ../../psxdev/vlc.c

COMMON_SOURCES = \
$(BALTISOT_SOURCES) $(ZLIB_SOURCES) $(REGEX_SOURCES) $(GETOPT_SOURCES)\
$(LUA_SOURCES) $(PSX_SOURCES) $(PSXDEV_SOURCES) $(READLINE_SOURCES)

WHOLE_SOURCES = $(SOURCES) $(COMMON_SOURCES) $(MOGLTK_SOURCES)

ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES))))

DALOS_OBJECTS = $(addsuffix .o, $(notdir $(basename $(COMMON_SOURCES) $(MOGLTK_SOURCES)))) Dalos.o

CD_TOOL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(COMMON_SOURCES)))) cd-tool.o

all: cd-tool cd-tool-static Dalos

stats:
	@wc $(WHOLE_SOURCES)

dist: all ../../cd-tool.lua ../../FAQ-cd.txt ../../COPYING
	zip -j9 ../cd-tool-`date +%Y%m%d`-linux-dynamic.zip cd-tool ../../cd-tool.lua ../../FAQ-cd.txt ../../COPYING
	zip -j9 ../cd-tool-`date +%Y%m%d`-linux-static.zip cd-tool-static ../../cd-tool.lua ../../FAQ-cd.txt ../../COPYING
	zip -j9 ../Dalos-`date +%Y%m%d`-linux-dynamic.zip Dalos ../../Dalos/Dalos.paq ../../COPYING
	zip -j9 ../Dalos-`date +%Y%m%d`-linux-static.zip Dalos-static ../../Dalos/Dalos.paq ../../COPYING

Dalos: $(DALOS_OBJECTS)
	$(LD) -o Dalos $(DALOS_OBJECTS) -lGL -lGLU -lreadline -lSDL -lpthread
	$(STRIP) Dalos
	upx-nrv -9 Dalos

Dalos-static: $(DALOS_OBJECTS)
	$(LD) -o Dalos-static $(DALOS_OBJECTS) -lGL -lGLU -lreadline -lSDL -lpthread -static -laa -lgpm -lncurses -lX11 -lslang -lXext -ldl -lvga -lasound -L/usr/X11R6/lib
	$(STRIP) Dalos-static
	upx-nrv -9 Dalos-static

cd-tool: $(CD_TOOL_OBJECTS)
	$(LD) $(LDFLAGS) -o cd-tool $(CD_TOOL_OBJECTS) -lreadline -lncurses
	$(STRIP) cd-tool
	upx-nrv -9 cd-tool

cd-tool-static: $(CD_TOOL_OBJECTS)
	$(LD) $(LDFLAGS) -o cd-tool-static $(CD_TOOL_OBJECTS) -lreadline -lncurses -static
	$(STRIP) cd-tool-static
	upx-nrv -9 cd-tool-static

clean:
	rm -f Dalos Dalos-static cd-tool cd-tool-static *.o




define OBJECT_C_template
 $(addsuffix .o, $(notdir $(basename $(1)))): $(src)
	$$(CC) $$(CPPFLAGS) $$(CFLAGS) -c $(src)
endef

define OBJECT_CXX_template
 $(addsuffix .o, $(notdir $(basename $(1)))): $(src)
	$$(CXX) $$(CPPFLAGS) $$(CXXFLAGS) -c $(src)
endef

$(foreach src, $(WHOLE_SOURCES), $(if $(filter %.c, $(src)), $(eval $(call OBJECT_C_template, $(src))), $(eval $(call OBJECT_CXX_template, $(src)))))