#----------------------------------------------------------------
# OBLIGE
#----------------------------------------------------------------
#
# GNU Makefile for Unix/Linux version (local files)
#
# This makefile creates an executable which excepts the script
# and data files in the same directory as itself, which mirrors
# how programs under Windows often work.  Use 'Makefile.unixy'
# if you want the more traditional kind of installation.
#
# NOTE: the Lua library must be compiled as C++
#
# NOTE 2: FLTK is statically linked in this version
#

PROGRAM=../Oblige

CXX=g++

LIB_LOC=../linux_lib

FLTK_DIR=$(LIB_LOC)/fltk-1.1.10
LUA_DIR=$(LIB_LOC)/lua-5.1.4
GLBSP_DIR=$(LIB_LOC)/glbsp-2.27-source

OPTIMISE=-O2 -g

# operating system choices: UNIX WIN32
OS=UNIX


#--- Internal stuff from here -----------------------------------

FLTK_FLAGS=-I$(FLTK_DIR)
FLTK_LIBS=$(FLTK_DIR)/lib/libfltk_images.a \
          $(FLTK_DIR)/lib/libfltk.a \
          -lX11 -lXext -lpng -ljpeg

LUA_FLAGS=-I$(LUA_DIR)/src
LUA_LIBS=$(LUA_DIR)/src/liblua.a

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

CXXFLAGS=$(OPTIMISE) -Wall -D$(OS) \
         $(FLTK_FLAGS) $(LUA_FLAGS) $(GLBSP_FLAGS)
LDFLAGS=-L/usr/X11R6/lib 
LIBS=-lm -lz $(FLTK_LIBS) $(LUA_LIBS) $(GLBSP_LIBS)

OBJS=	main.o      \
	lib_argv.o  \
	lib_file.o  \
	lib_signal.o \
	lib_util.o  \
	lib_pak.o   \
	lib_wad.o   \
	sys_assert.o \
	sys_debug.o \
	csg_main.o  \
	csg_poly.o  \
	g_cookie.o  \
	g_lua.o     \
	img_bolt.o  \
	img_pill.o  \
	img_carve.o \
	img_relief.o \
	img_font1.o  \
	\
	csg_doom.o  \
	csg_quake.o \
	dm_extra.o  \
	dm_glbsp.o  \
	dm_wad.o    \
	nk_art.o    \
	nk_level.o  \
	q1_clip.o   \
	q1_doors.o  \
	q1_main.o   \
	q_bsp.o     \
	vis_buffer.o \
	wolf_map.o  \
	\
	twister.o   \
	tx_forge.o  \
	tx_skies.o  \
	ui_about.o  \
	ui_build.o  \
	ui_chooser.o \
	ui_dialog.o \
	ui_game.o   \
	ui_level.o  \
	ui_map.o    \
	ui_module.o \
	ui_rchoice.o \
	ui_play.o   \
	ui_window.o


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

all: $(PROGRAM)

clean:
	rm -f $(PROGRAM) *.o core core.*
	rm -f ERRS update.log

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

stripped: all
	strip --strip-unneeded $(PROGRAM)

.PHONY: all clean bin

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