ifeq ($(SYSTEM),) SYSTEM=$(shell uname) endif TRUESYSTEM=$(shell uname) MACHINE=$(shell uname -m) DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1) GL_GLUE=gl-glue.s CC = gcc CXX = g++ LD = g++ AS = as ifeq ($(SYSTEM),Darwin) ARCH_FLAGS=-arch i386 SHARED_FLAGS=-dynamiclib SHARED_EXT=dylib CPPFLAGS = -dynamic LD = g++ -arch i386 STRIP = strip -x ifeq ($(TRUESYSTEM),Linux) CC = i686-apple-darwin9-gcc CXX = i686-apple-darwin9-g++ LD = i686-apple-darwin9-g++ -arch i386 -mmacosx-version-min=10.5 STRIP = i686-apple-darwin9-strip -x AS = i686-apple-darwin9-as -arch i386 LIPO = i686-apple-darwin9-lipo ARCH_FLAGS = endif else ARCH_FLAGS=-march=i686 -m32 SHARED_FLAGS=-shared SHARED_EXT=so LD = g++ -m32 STRIP = strip --strip-unneeded endif INCLUDES = \ -I../Baltisot/include \ -I../LuaJIT/src \ -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 CPPFLAGS += $(INCLUDES) -O4 -fexceptions -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN $(ARCH_FLAGS) $(HAVES) LDFLAGS += $(ARCH_FLAGS) $(SHARED_FLAGS) -L. lua-interface.$(SHARED_EXT) vpath %.c ../Baltisot/lib:../Baltisot/src:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev vpath %.cc ../Baltisot/lib:../Baltisot/src:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev vpath %.cpp ../Baltisot/lib:../Baltisot/src:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev vpath %.lua ../Baltisot/lib:../Baltisot/src LUACD_SOURCES = \ plugin-luacd.cc \ luacd.cpp \ cdabstract.cpp \ cdreader.cpp \ cdutils.cpp \ dvdabstract.cpp \ isobuilder.cpp \ yazedc.cpp \ LUAPSX_SOURCES = \ plugin-luapsx.cc \ luapsx.cpp \ bs.c \ idctfst.c \ jfdctint.c \ vlc.c \ xadecode.c \ WHOLE_SOURCES = \ $(LUAPSX_SOURCES) \ $(LUACD_SOURCES) \ MODULES_LIST = \ luapsx.$(SHARED_EXT) \ luacd.$(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 $(STRIP) $(MODULES_LIST) cp $(MODULES_LIST) ../lua-interface-dist modules: $(MODULES_LIST) dep: $(ALL_DEPS) luapsx.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(LUAPSX_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(LUAPSX_LIBS) luacd.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(LUACD_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(LUACD_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 : %.lua bin2c $< $@ $(basename $@) -include $(ALL_DEPS) .PHONY: clean dist