DEPTH = .
SUBDIR = .
PROGNAME = FreeDoko

# for Windows under Linux:
# export OSTYPE=Linux_to_Windows

include $(DEPTH)/Makefile.os

include Makefile.objects

DIRECTORIES = party game player card misc ui os class utils text network
OBJECTS_ALL = $(OBJECTS) \
		$(OBJECTS_PARTY) $(OBJECTS_GAME) $(OBJECTS_PLAYER) \
		$(OBJECTS_CARDS) $(OBJECTS_MISC) \
		$(OBJECTS_UI) $(OBJECTS_OS) \
		$(OBJECTS_CLASS) $(OBJECTS_UTILS)
INCLUDE_ALL = $(INCLUDE)
LIBS_ALL = $(LIBS)
ifeq ($(USE_UI_GTKMM), true)
	OBJECTS_ALL += $(OBJECTS_GTKMM)
	INCLUDE_ALL += $(INCLUDE_GTKMM)
	LIBS_ALL += $(LIBS_GTKMM)
endif
ifeq ($(USE_NETWORK), true)
	OBJECTS_ALL += $(OBJECTS_NETWORK)
	INCLUDE_ALL += $(INCLUDE_NETWORK)
	LIBS_ALL += $(LIBS_NETWORK)
endif


.PHONY: all
all :
	$(MAKE) $(PROGNAME)

seed.out : $(PROGNAME)
	./$(PROGNAME) > seed.out

$(PROGNAME) : objects $(DIRECTORIES)
	$(CXX) $(CXXFLAGS) \
	  $(OBJECTS_ALL) \
	  $(INCLUDE_ALL) \
	  $(LIBS_ALL) \
	  -o $@

ifeq ($(SHELLTYPE), sh)
.PHONY : fast
fast :
	nice $(MAKE) -k -C ui &
	( nice $(MAKE) -k -C party; \
	  nice $(MAKE) -k -C game; \
	  nice $(MAKE) -k -C card ) &
	nice $(MAKE) -k -C player
	nice $(MAKE) -k objects
	nice $(MAKE) -k -C misc
	nice $(MAKE) -k -C os
	nice $(MAKE) -k -C class
	nice $(MAKE) -k -C utils
endif

.PHONY : objects
objects : $(OBJECTS)

ifeq ($(OPERATING_SYSTEM), Linux)
.PHONY : doc
doc :
	doxygen

.PHONY : tags
tags :
	ctags -R
endif

include $(DEPTH)/Makefile.subdir
include $(DEPTH)/Makefile.rules
