From 2186d4f1ddd343962a50474d6613f08d77ef993f Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Sun, 10 Jun 2007 20:59:51 +0200 Subject: [PATCH] * Introduce porting.h for portability define thingies. * Include . in the include path for compiling. * Make CLog support user logging through stdout. --- ABM2/Engine/Log.cpp | 4 +++- ABM2/Makefile | 9 ++++++--- ABM2/porting.h | 3 +++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 ABM2/porting.h diff --git a/ABM2/Engine/Log.cpp b/ABM2/Engine/Log.cpp index dce8af9..6012f9a 100755 --- a/ABM2/Engine/Log.cpp +++ b/ABM2/Engine/Log.cpp @@ -2,6 +2,8 @@ // ////////////////////////////////////////////////////////////////////// +#include +#include "porting.h" #include "engine.h" #include "Log.h" @@ -71,7 +73,7 @@ void CLog::Write(int target, const char *msg, ...) #ifdef WIN32 MessageBox(NULL,(LPCTSTR)szBuf,L"Message",MB_OK); #else -#error User-level logging is not implemented for this platform. + std::cout << szBuf << "\n"; #endif } va_end(args); diff --git a/ABM2/Makefile b/ABM2/Makefile index bf2539c..a20f060 100644 --- a/ABM2/Makefile +++ b/ABM2/Makefile @@ -1,7 +1,10 @@ -all: main.o +CFLAGS:=-I. +OBJS:=main.o Engine/Log.o + +all: $(OBJS) %.o: %.cpp - g++ -c $< -o $@ + g++ $(CFLAGS) -c $< -o $@ clean: - rm -f *.o + rm -f *.o Engine/*.o diff --git a/ABM2/porting.h b/ABM2/porting.h new file mode 100644 index 0000000..a4f6c1f --- /dev/null +++ b/ABM2/porting.h @@ -0,0 +1,3 @@ +#ifndef WIN32 + #define vsprintf_s vsnprintf +#endif // !WIN32 -- 2.30.2