#
# Makefile for Perex's player...
#
# Copyright (c) by Jaroslav Kysela (Perex soft)
#

LIBS	=
FLAGS	=

########################## read this section #################################

# use floating point on/off (maybe better result)
# define this only if you _have_ FPU

FLOATING_POINT = ON 

# enable jump effect as default (for loop only)

FLAGS := $(FLAGS) -DENABLE_JUMP

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

ifdef FLOATING_POINT
FLAGS := $(FLAGS) -DUSE_FLOATING_POINT -I/usr/include/ncurses
XM_TBL = 
LIBS := $(LIBS) -lm
else
XM_TBL = xm_table.inc
endif

CC     = gcc
#CFLAGS = -g -Wall -pipe -DDEBUG
CFLAGS = -O2 -Wall -pipe -m486

CFILES = conv.c \
         load_mod.c load_xm.c load_s3m.c load_mtm.c load_669.c \
         misc.c gus.c timer.c effects.c play.c signal.c detect.c \
	 playlist.c pmod.c

OFILES = conv.o \
         load_mod.o load_xm.o load_s3m.o load_mtm.o load_669.o \
         misc.o gus.o timer.o effects.o play.o signal.o detect.o \
	 playlist.o pmod.o

.c.o:
	$(CC) $(CFLAGS) $(FLAGS) -c $<

all: pmod

xm_table.inc: compute_xm_table.o
	$(CC) -o compute_xm_table compute_xm_table.o -lm
	compute_xm_table > xm_table.inc

pmod: .depend $(XM_TBL) $(OFILES)
	$(CC) -o pmod $(OFILES) $(LIBS) -lncurses
	strip pmod
	ls -l pmod

clean:
	rm -f .depend *.o *~ pmod

pack:
	cd ..; tar rvf pgmod.tar \
		pmod/README pmod/POLICY pmod/Makefile pmod/*.c pmod/*.h

.depend:
	$(CPP) $(FLAGS) -M $(CFILES) > .depend

dep:	.depend

# ----------------------------------------------------------------------------
#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
