summaryrefslogtreecommitdiff
path: root/compile/macosX/Makefile
blob: f862add575bbc5a167263c916beee6c8a35cce3d (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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
CC = gcc
CXX = g++
LD = g++
STRIP = strip

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../..

CPPFLAGS = $(INCLUDES) -O4 -DSTDC_HEADERS -DREADLINE_STATIC -DHAVE_UNISTD_H -fexceptions `sdl-config --cflags` -DWORDS_BIGENDIAN

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

vpath %.c ../../Dalos:../../:../../mogltk/lib:../../generic/lib:../../lib:../../psxdev:../../generic/lib/zlib/src:../../generic/lib/lua/src:../../generic/lib/lua/src/LuaLib
vpath %.cc ../../Dalos:../../:../../mogltk/lib:../../generic/lib:../../lib:../../psxdev:../../generic/lib/zlib/src:../../generic/lib/lua/src:../../generic/lib/lua/src/LuaLib
vpath %.cpp ../../Dalos:../../:../../mogltk/lib:../../generic/lib:../../lib:../../psxdev:../../generic/lib/zlib/src:../../generic/lib/lua/src:../../generic/lib/lua/src/LuaLib

SOURCES = \
cd-tool.cpp
#Dalos.cpp

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

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

ZLIB_SOURCES = \
adler32.c   inffast.c \
compress.c  inflate.c \
crc32.c     inftrees.c \
deflate.c   \
gzio.c      trees.c \
uncompr.c \
zutil.c

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

#HASH_SOURCES = \
#hashtab.c    lookupa.c \
#recycle.c
HASH_SOURCES = 

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

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

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

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

ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES))))
ALL_DEPS = $(addsuffix .dep, $(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: dep cd-tool

dep: $(ALL_DEPS)

#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

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

cd-tool: $(CD_TOOL_OBJECTS)
	$(LD) -o cd-tool $(CD_TOOL_OBJECTS) -lreadline -lncurses
	$(STRIP) cd-tool

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

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




#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)))))


%.dep : %.c
	$(CC) $(CPPFLAGS) -M -MF $@ $<

%.dep : %.cpp
	$(CXX) $(CPPFLAGS) -M -MF $@ $<

%.dep : %.cc
	$(CXX) $(CPPFLAGS) -M -MF $@ $<

-include $(ALL_DEPS)