include $(DEPTH)/../Makefile.os
include $(DEPTH)/Makefile.modules

ifeq ($(OPERATING_SYSTEM), Linux)
	# program name
	PROGNAME ?= FreeDoko
	# compiler
	CXX ?= g++
	# path to the generated data ('.o' and '.d' files)
	WORK_DIR = /tmp/FreeDoko/src
	# suffix of the object files
	OBJ_SUFFIX ?= o
	# flags for the compiler (warnings and optimizations)
	#CXXFLAGS ?= -Wall -W -Wno-unused-parameter -Werror -O2 -march=pentium
	#CXXFLAGS ?= -Wall -Werror -O0 -g
	CXXFLAGS ?= -Wall -Werror -O2
	# flags for automatic generating of the dependencies
	DEPGEN_FLAGS ?= -MMD -MP
	override CPPFLAGS += -DLINUX
	ifeq ($(USE_UI_GTKMM), true)
		INCLUDE_GTKMM ?= `pkg-config --cflags gtkmm-2.0`
		LIBS_GTKMM ?= `pkg-config --libs gtkmm-2.0`
	endif
	ifeq ($(USE_NETWORK), true)
		#INCLUDE += `pkg-config --cflags glibmm-2.0 gnet-2.0`
		#LIBS += `pkg-config --libs glibmm-2.0 gnet-2.0`
		INCLUDE_NETWORK += `pkg-config --cflags glibmm-2.0 gnet-2.0`
		LIBS_NETWORK += `pkg-config --libs glibmm-2.0 gnet-2.0`
	endif
endif

ifeq ($(OPERATING_SYSTEM), Linux_to_Windows)
	MINGW_DIR ?= /mnt/Windows/MinGW32
	PROGNAME ?= FreeDoko.exe
	CXX = i586-mingw32msvc-g++
	OBJ_SUFFIX = o
	CXXFLAGS ?= -Wall -Werror -O2 -march=pentium
	DEPGEN_FLAGS = -MMD -MP
	override CPPFLAGS += -DWINDOWS
	C_INCLUDE_PATH ?= $(MINGW_DIR)/include
	LIBRARY_PATH ?= $(MINGW_DIR)/lib
	#INCLUDE ?= -nostdinc
	#INCLUDE += -I$(C_INCLUDE_PATH) -I$(C_INCLUDE_PATH)/c++/3.2.3
	#LIBS = -nostdlib
	LIBS ?= -L$(LIBRARY_PATH)
	ifeq ($(USE_UI_GTKMM), true)
		INCLUDE_GTKMM ?= -I$(MINGW_DIR)/include/gtkmm-2.0 -I$(MINGW_DIR)/lib/gtkmm-2.0/include -I$(MINGW_DIR)/include/gtk-2.0 -I$(MINGW_DIR)/lib/sigc++-1.2/include -I$(MINGW_DIR)/include/sigc++-1.2 -I$(MINGW_DIR)/include/glib-2.0 -I$(MINGW_DIR)/lib/glib-2.0/include -I$(MINGW_DIR)/lib/gtk-2.0/include -I$(MINGW_DIR)/include/pango-1.0 -I$(MINGW_DIR)/include/atk-1.0
		LIBS_GTKMM ?= -L$(MINGW_DIR)/lib -lgtkmm-2.0 -lgdkmm-2.0 -latkmm-1.0 -lgtk-win32-2.0 -lpangomm-1.0 -lglibmm-2.0 -lsigc-1.2 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
	endif
endif

ifeq ($(OPERATING_SYSTEM), HPUX)
	PROGNAME ?= FreeDoko
	CXX ?= g++
	OBJ_SUFFIX ?= o
	CXXFLAGS ?= -Wall -Werror -O2
	DEPGEN_FLAGS ?= -MMD -MP
	LIBS ?= -Wl,+s
	override CPPFLAGS += -DHPUX
	ifeq ($(USE_UI_GTKMM), true)
		INCLUDE_GTKMM ?= `pkg-config --cflags gtkmm-2.0`
		LIBS_GTKMM ?= `pkg-config --libs gtkmm-2.0`
	endif
endif

ifeq ($(OPERATING_SYSTEM), MACOSX)
	PROGNAME ?= FreeDoko
	CXX ?= g++
	OBJ_SUFFIX ?= o
	CXXFLAGS ?= -Wall -Werror -O2 -march=pentium
	DEPGEN_FLAGS ?= -MMD -MP
	override CPPFLAGS += -DLINUX
	ifeq ($(USE_UI_GTKMM), true)
		INCLUDE_GTKMM ?= `pkg-config --cflags gtkmm-2.0`
		LIBS_GTKMM ?= `pkg-config --libs gtkmm-2.0`
	endif
endif

ifeq ($(OPERATING_SYSTEM), MSYS)
	PROGNAME ?= FreeDoko.exe
	CXX ?= D:/mingw32/bin/g++
	OBJ_SUFFIX ?= o
	CXXFLAGS ?= -Wall -Werror -O2 -march=pentium -mno-cygwin -mms-bitfields
	DEPGEN_FLAGS ?= -MMD -MP
	override CPPFLAGS += -DWINDOWS
	C_INCLUDE_PATH ?= D:/mingw32/include
	LIBRARY_PATH ?= D:/mingw32/lib
	ifeq ($(USE_UI_GTKMM), true)
		INCLUDE_GTKMM ?= `pkg-config --cflags gtkmm-2.0`
		LIBS_GTKMM ?= `pkg-config --libs gtkmm-2.0`
	endif
endif

ifeq ($(OPERATING_SYSTEM), Windows)
	MINGW_DIR ?= C:/MinGW32
	PROGNAME ?= FreeDoko.exe
	CXX ?= $(MINGW_DIR)/bin/g++
	OBJ_SUFFIX ?= o
	CXXFLAGS ?= -Wall -Werror -O2 -march=pentium -mno-cygwin -mms-bitfields
	DEPGEN_FLAGS ?= -MMD -MP
	override CPPFLAGS += -DWINDOWS
	C_INCLUDE_PATH ?= $(MINGW_DIR)/include
	LIBRARY_PATH ?= $(MINGW_DIR)/lib
	ifeq ($(USE_UI_GTKMM), true)
		INCLUDE_GTKMM ?= -I$(MINGW_DIR)/include/gtkmm-2.0 -I$(MINGW_DIR)/lib/gtkmm-2.0/include -I$(MINGW_DIR)/include/gtk-2.0 -I$(MINGW_DIR)/lib/sigc++-1.2/include -I$(MINGW_DIR)/include/sigc++-1.2 -I$(MINGW_DIR)/include/glib-2.0 -I$(MINGW_DIR)/lib/glib-2.0/include -I$(MINGW_DIR)/lib/gtk-2.0/include -I$(MINGW_DIR)/include/pango-1.0 -I$(MINGW_DIR)/include/atk-1.0
		LIBS_GTKMM ?= -L$(MINGW_DIR)/lib -lgtkmm-2.0 -lgdkmm-2.0 -latkmm-1.0 -lgtk-win32-2.0 -lpangomm-1.0 -lglibmm-2.0 -lsigc-1.2 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
	endif
endif
ifeq ($(USE_UI_TEXT), true)
	override CPPFLAGS += -DUSE_UI_TEXT
endif
ifeq ($(USE_UI_GTKMM), true)
	override CPPFLAGS += -DUSE_UI_GTKMM
endif
ifeq ($(USE_NETWORK), true)
	override CPPFLAGS += -DNETWORK
endif

include $(DEPTH)/Makefile.local

export CXX OBJ_SUFFIX CPPFLAGS CXXFLAGS INCLUDE LIBS MAKEDEPEND
