# ########################################################################
#
#                     Makefile for YIFF Sound Server
#
#   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 = /usr


# ########################################################################
# Compiler Flags:
#
#   These are definations to enable or disable certain compile time
#   options. Omitting a defination turns that option off.
#
#   Each argument is of the format -D<option> where <option> is
#   one of the following:
#
#	ALSA_RUN_CONFORM	Specifies comfority to the ALSA
#				(Advanced Linux Sound Arch). This will
#				not compile in any ALSA code but will
#				make note on certain run time code that
#				the sound driver is really ALSA emulating
#				OSS. It is save to use this with OSS (when
#				in doubt ENABLE this).
#
#	OSS			Specifies comfority to the OSS
#				(Open Sound System). You MUST specify
#				this, even if you are using ALSA.
#
#	OSS_BUFFRAG		Enable OSS fragmented buffers by using
#				the ioctl() call SNDCTL_DSP_SETFRAGMENT
#				(requires OSS be defined). This was known
#				as Linux sound experimental but has long
#				since been considered standard so you
#				definatly will want to enable this.
#				You MUST specify this, even if you are
#				using ALSA.
#
#	YSHM_SUPPORT		Enable Y shared memory support, allocates
#				the sound buffer as a shared memory
#				segment where clients can access it
#				directly.
#
#	HAVE_LIBKMID		Enable support for the kMid library.
#				add -lkmid to the LIB line farther
#				below if you enable this. Or excude this
#				and remove -lkmid from the LIB line farther
#				below if you do not want to enable this.
#				Note that libkmid is still alpha and this
#				feature is NOT encuraged, when in doubt
#				DISABLE this.
#
#   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 = -DALSA_RUN_CONFORM -DOSS -DOSS_BUFFRAG -DYSHM_SUPPORT -DHAVE_LIBKMID \
#         -D__USE_BSD -Wall -O6 \
#         -fomit-frame-pointer -funroll-loops -finline-functions \
#         -ffast-math
CFLAGS = -DALSA_RUN_CONFORM -DOSS -DOSS_BUFFRAG -DYSHM_SUPPORT \
         -D__USE_BSD -Wall -O6 \
         -fomit-frame-pointer -funroll-loops -finline-functions \
         -ffast-math
#CFLAGS = -DALSA_RUN_CONFORM -DOSS -DOSS_BUFFRAG -DYSHM_SUPPORT \
#        -D__USE_BSD -Wall -O -g
#CFLAGS = -DALSA_RUN_CONFORM -DOSS -DOSS_BUFFRAG -DYSHM_SUPPORT \
#         -D__USE_BSD -Wall -O6 \
#         -fomit-frame-pointer -funroll-loops -finline-functions \
#         -ffast-math -march=i586

CPPFLAGS = -Dc_plusplus -D__cplusplus


# ########################################################################
# 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 -lkmid
LIB = -lm

# 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/lib
LIB_DIR =

# 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 =


# ########################################################################
# Program Source and Header Files:
#
include Makefile.srclist
CC  = cc
CPP = c++
BIN = yiff
OBJ_C = $(SRC_C:.c=.o)
OBJ_CPP = $(SRC_CPP:.cpp=.o)
.c.o:
	$(CC) -c $*.c $(INC) $(CFLAGS)
.cpp.o:
	$(CPP) -c $*.cpp $(INC) $(CFLAGS) $(CPPFLAGS)

RM      = rm
RMFLAGS = -f
LS      = ls
LSFLAGS = -a -l


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

all: $(BIN)


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


# ########################################################################
# Maintainance and Misc Rules:
#
clean:
	$(RM) $(RMFLAGS) a.out core *.o $(BIN)


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