SYSTEM = $(shell uname) ifeq ($(SYSTEM), Darwin) CC = i686-pc-linux-gcc CXX = i686-pc-linux-g++ LD = i686-pc-linux-g++ STRIP = i686-pc-linux-strip CPPFLAGS = -I/usr/local/cross-tools-linux/i686-pc-linux/include LDFLAGS = -L/usr/local/cross-tools-linux/i686-pc-linux/lib else CC = gcc CXX = g++ LD = g++ STRIP = strip endif 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../../Dalos \ -I../.. `sdl-config --cflags` CPPFLAGS += $(INCLUDES) -O4 -DSTDC_HEADERS -DREADLINE_STATIC -DHAVE_UNISTD_H -fexceptions `sdl-config --cflags` -DWORDS_LITTLEENDIAN -fexceptions LDFLAGS += -O4 -fexception #-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 CD_TOOL_SOURCES = cd-tool.cpp DALOS_SOURCES = Dalos.cc Console.cc Hexview.cc 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 contextmenu.cc \ inputtext.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 lprint.c \ linit.c \ lauxlib.c \ lbaselib.c \ ldblib.c \ liolib.c \ loslib.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 \ dvdabstract.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 = $(CD_TOOL_SOURCES) $(DALOS_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_SOURCES)))) CD_TOOL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(COMMON_SOURCES) $(CD_TOOL_SOURCES)))) all: dep cd-tool cd-tool-static 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 $(LDFLAGS) $(STRIP) cd-tool cd-tool-static: $(CD_TOOL_OBJECTS) $(LD) $(LDFLAGS) -o cd-tool-static $(CD_TOOL_OBJECTS) -lreadline -lncurses -static $(LDFLAGS) $(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)