#----------------------------------------------------------------
# Oblige
#----------------------------------------------------------------
#
# GNU Makefile for WIN32
#

PROGRAM=../ObHack.exe

CXX=g++
#CXX=gcc

LIB_LOC=../..

#FLTK_DIR=$(LIB_LOC)/fltk-1.1.x-r5953
#FLTK_DIR=$(LIB_LOC)/fltk-1.1.7
FLTK_DIR=$(LIB_LOC)/fltk-1.1.9
LUA_DIR= c:/obhack-engine/gui/lua
ZLIB_DIR=$(LIB_LOC)/zlib-1.2.3
GLBSP_DIR=$(LIB_LOC)/glbsp-2.24-source

# operating system choices: UNIX WIN32
OS=WIN32



FLTK_FLAGS=-I$(FLTK_DIR)
# If you don't have libpng and libjpeg, you will need the middle two lines.
# If you do, remove the middle two lines here and add -lpng -ljpeg to the
# link flags
FLTK_LIBS=$(FLTK_DIR)/lib/libfltk_images.a \
          $(FLTK_DIR)/lib/libfltk_png.a \
          $(FLTK_DIR)/lib/libfltk_jpeg.a \
          $(FLTK_DIR)/lib/libfltk.a

LUA_FLAGS=-I$(LUA_DIR)
# For some reason, my linker refuses to link to this library
# My workaround is ugly: The **ENTIRE** lua source tree is in the file
# lua_insanity.cc.  Thankfully, lua is simple enough this ugly hack works
#LUA_LIBS=$(LUA_DIR)/src/liblua.a

GLBSP_FLAGS=-I$(GLBSP_DIR)
GLBSP_LIBS=$(GLBSP_DIR)/libglbsp.a

ZLIB_FLAGS=-I$(ZLIB_DIR)
ZLIB_LIBS=$(ZLIB_DIR)/libz.a

CXXFLAGS=-Os -Wall -D$(OS) \
         $(FLTK_FLAGS) $(LUA_FLAGS) $(GLBSP_FLAGS)
LDFLAGS=
# You probably want to remove -mwindows when compiling this in *NIX
# Note to mention some other stuff here.  Also consider adding -ljpeg and
# -lpng
LIBS=$(FLTK_LIBS) $(GLBSP_LIBS) $(ZLIB_LIBS) -lm \
     -mwindows -lcomdlg32 -lole32 -luuid -lgdi32 \
     -lcomctl32 -lwsock32 -lsupc++

OBJS=	main.o      \
	obhack_res.o \
	lib_argv.o  \
	lib_util.o  \
	sys_assert.o \
	sys_debug.o \
	g_cookie.o  \
	g_doom.o    \
	g_glbsp.o   \
	g_image.o   \
	g_wolf.o    \
	twister.o   \
	ui_adjust.o  \
	ui_build.o  \
	ui_chooser.o \
	ui_dialog.o \
	ui_map.o    \
	ui_menu.o   \
	ui_setup.o  \
	ui_window.o \
	lua_insanity.o     
#	g_lua.o     


#--- Targets and Rules ------------------------------------------

all: $(PROGRAM)

clean: 
	rm *.o

$(PROGRAM): $(OBJS)
	$(CXX) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS)

g_image.o: img_data.h


bin: all
	mingw32-strip --strip-unneeded $(PROGRAM)
obhack_res.o: obhack.rc
	 windres $^ -o $@

.PHONY: all clean bin

#--- editor settings ------------
# vi:ts=8:sw=8:noexpandtab
