From 8f7344b239e65a7c47c45cb7c3737688d4c40b40 Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 9 Nov 2005 09:11:42 +0000 Subject: Fixing more cross platform issues... --- compile/linux/Makefile | 193 ++++++++++++++++++++++++++++--------------------- compile/win32/Makefile | 8 ++ 2 files changed, 119 insertions(+), 82 deletions(-) diff --git a/compile/linux/Makefile b/compile/linux/Makefile index 615466f..9aae0c7 100644 --- a/compile/linux/Makefile +++ b/compile/linux/Makefile @@ -1,86 +1,104 @@ +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 --strip-all - -INCLUDES = -I../../includes -I../../psxdev -I../../generic/include \ +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../.. \ -`sdl-config --cflags` +-I../.. -CPPFLAGS = $(INCLUDES) -O4 -march=i686 -DSTDC_HEADERS -DREADLINE_STATIC -DHAVE_UNISTD_H -fexceptions +CPPFLAGS += $(INCLUDES) -O4 -DSTDC_HEADERS -DREADLINE_STATIC -DHAVE_UNISTD_H -fexceptions `sdl-config --cflags` -DWORDS_LITTLEENDIAN -fexceptions -LDFLAGS = -march=i686 -O4 `sdl-config --libs` +LDFLAGS += -O4 -fexception +#-O4 `sdl-config --libs` -SOURCES = \ -../../Dalos/Dalos.cc ../../cd-tool.cpp +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 -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 +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 = \ -../../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/LuaRegex.cc ../../generic/lib/LuaConfigFile.cc +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 = \ -../../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/gzio.c ../../generic/lib/zlib/src/trees.c \ -../../generic/lib/zlib/src/infblock.c ../../generic/lib/zlib/src/uncompr.c \ -../../generic/lib/zlib/src/zutil.c +adler32.c inffast.c \ +compress.c inflate.c \ +crc32.c inftrees.c \ +deflate.c \ +gzio.c trees.c \ +uncompr.c \ +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 - -HASH_SOURCES = \ -../../generic/lib/hashtab.c ../../generic/lib/lookupa.c \ -../../generic/lib/recycle.c +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 = \ -../../lib/cdabstract.cpp ../../lib/luacd.cpp \ -../../lib/cdreader.cpp ../../lib/luapsx.cpp \ -../../lib/cdutils.cpp ../../lib/lzss.cpp \ - ../../lib/yazedc.cpp ../../lib/isobuilder.cpp +cdabstract.cpp luacd.cpp \ +cdreader.cpp luapsx.cpp \ +cdutils.cpp lzss.cpp \ +yazedc.cpp isobuilder.cpp \ +dvdabstract.cpp PSXDEV_SOURCES = \ -../../psxdev/bs.c ../../psxdev/jfdctint.c ../../psxdev/xadecode.c \ -../../psxdev/idctfst.c ../../psxdev/vlc.c +bs.c jfdctint.c xadecode.c \ +idctfst.c vlc.c COMMON_SOURCES = \ $(BALTISOT_SOURCES) $(ZLIB_SOURCES) $(REGEX_SOURCES) $(GETOPT_SOURCES) \ @@ -90,15 +108,18 @@ $(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: cd-tool cd-tool-static +all: dep cd-tool cd-tool-static + +dep: $(ALL_DEPS) -stats: - @wc $(WHOLE_SOURCES) +#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 @@ -109,37 +130,45 @@ dist: all ../../cd-tool.lua ../../FAQ-cd.txt ../../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 + $(LD) -o cd-tool $(CD_TOOL_OBJECTS) -lreadline -lncurses $(LDFLAGS) $(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 + $(LD) $(LDFLAGS) -o cd-tool-static $(CD_TOOL_OBJECTS) -lreadline -lncurses -static $(LDFLAGS) $(STRIP) cd-tool-static - upx-nrv -9 cd-tool-static clean: - rm -f Dalos Dalos-static cd-tool cd-tool-static *.o + 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 $@ $< -define OBJECT_C_template -$(addsuffix .o, $(notdir $(basename $(1)))): $(src) - $$(CC) $$(CPPFLAGS) $$(CFLAGS) -c $(src) -endef +%.dep : %.cpp + $(CXX) $(CPPFLAGS) -M -MF $@ $< -define OBJECT_CXX_template -$(addsuffix .o, $(notdir $(basename $(1)))): $(src) - $$(CXX) $$(CPPFLAGS) $$(CXXFLAGS) -c $(src) -endef +%.dep : %.cc + $(CXX) $(CPPFLAGS) -M -MF $@ $< -$(foreach src, $(WHOLE_SOURCES), $(if $(filter %.c, $(src)), $(eval $(call OBJECT_C_template, $(src))), $(eval $(call OBJECT_CXX_template, $(src))))) +-include $(ALL_DEPS) diff --git a/compile/win32/Makefile b/compile/win32/Makefile index f1f35c1..5efd4a1 100644 --- a/compile/win32/Makefile +++ b/compile/win32/Makefile @@ -1,7 +1,15 @@ +SYSTEM = $(shell uname) +ifeq ($(SYSTEM), Darwin) CC = i686-pc-mingw32-gcc CXX = i686-pc-mingw32-g++ LD = i686-pc-mingw32-g++ STRIP = i686-pc-mingw32-strip +else +CC = i586-pc-mingw32-gcc +CXX = i586-pc-mingw32-g++ +LD = i586-pc-mingw32-g++ +STRIP = i586-pc-mingw32-strip +endif INCLUDES = \ -I../../includes -I../../psxdev -I../../generic/include \ -- cgit v1.2.3