# ########################################################################
#
#                  Makefile for XShipWars Client
#
#   Rules:
#
#	all	-- builds program.
#	install -- install program.
#	clean	-- remove object and other work files.
#
#       If no arguments are givin, the program is built by default.
#


# ########################################################################
# Installation Options:
#
#   You may modify any value as needed. Change only the ones you are
#   absolutly sure that requires modification.
#
PREFIX = /opt/xsw


# ########################################################################
# Compiler Flags:
#
#   These are definations to enable or disable certain compile time
#   options. Omitting a defination turns that option off.
#
#   The syntax for each defination is:
#	-D<option>
#
#	USE_GETDENTS		Use getdents() instead of readdir().
#
#       USE_XSHM		Enable MIT X Shared Memory.
#
#	JS_SUPPORT		Enable joystick support
#				(not available on Solaris).
#
#   Other arguments include:
#
#       -O#                     Specifies the optimization level the
#                               compiler is to compile at. This (attempts)
#                               to improve the efficiency of the generated
#                               program when it runs. Available values for
#                               # are from 0 to 2 (some compilers allow
#                               higher values). When in doubt, set # to 2.
#
#       -g                      Compile with debugging information,
#                               this is useful for determining why this
#                               program (if it did) crash. However this
#                               may hinder performance, so don't use
#                               this option unless you are attempting
#                               to debug the program.
#
#CFLAGS = -D__SOLARIS__ -O2 -fpcc-struct-return -Dc_plusplus -D__cplusplus
#CFLAGS = -D__SOLARIS__ -DUSE_XSHM -D__BIT_TYPES_DEFINED__ -Dc_plusplus -D__cplusplus \
#         -fpcc-struct-return
CFLAGS = -D__SOLARIS__ -DUSE_XSHM -D__BIT_TYPES_DEFINED__ -Dc_plusplus -D__cplusplus \
         -fpcc-struct-return -funroll-loops -ffast-math -O3


# ########################################################################
# Dependant Libraries:
#                               
#   These are dynamic (sometimes called shared) libraries that this
#   program is to be `linked' to.
#
#   Each argument is of the format -l<name> where <name> is the name
#   of the library. You may have to add one or more -l<name> arguments   
#   to the LIB line depending on what you have set in the CFLAGS line  
#   farther above.
#                               
LIB = -lm -lX11 -lXpm -lXext -lsocket -lnsl

# Library Directories:
#
#   All libraries are looked for in the directories specified below.
#
#   Each argument is of the format -L<dir> where <dir> is the full
#   path to the directory.
#
#LIB_DIR = -L/usr/openwin/lib -R/usr/usr/openwin/lib \
#          -L/usr/local/lib -R/usr/local/lib
LIB_DIR = -L/usr/openwin/lib -L/usr/local/lib \
          -R"/usr/lib:/usr/local/lib:/usr/openwin/lib"


# Header File Directories:
#
#   Required header files that are not in the standard locations are
#   searched for in the directories specified below.
#
#   Each argument is of the format -I<dir> where <dir> is the full
#   path to the directory.
#
INC = -I/opt/BSDdb/include \
      -I/usr/local/include -I/opt/libXpm/include


# ########################################################################
# Program Source and Header Files:
#
include Makefile.srclist

CPP  = g++
BIN = xsw
OBJ = $(SRC:.cpp=.o)
.cpp.o:
	$(CPP) -c $*.cpp $(INC) $(CFLAGS)


# ########################################################################
# Build Rules:
#
$(BIN): $(OBJ)
	$(CPP) $(OBJ) -o $(BIN) $(LIB) $(LIB_DIR)

all: $(BIN)


# ########################################################################
# Install Rules:
#
#   This rule is defined externally.
#
include Makefile.install.UNIX


# ########################################################################
# Maintainance and Misc Rules:
#
clean:
	rm -f a.out core *.o


# ########################################################################
