# LINEAR_VOLUME enables linear volume support found in VoxKit 2.5+ drivers.
# Kernel modification may be required -- refer to Readme.
# USE_LOCAL will cause gmod to use a copy of soundcard.h found in the
# current directory.  
# USE_NCURSES will compile gmod with support for special keys (arrows, etc).
# The ncurses library must be installed to compile with this defined.
# USE_X will compile gmod with and X interface.
# Note:  do not define both USE_NCURSES and USE_X at the sample time.

DEFINES = -DLINEAR_VOLUME -DUSE_X
LIBS = -lfwf -lX11 -lXaw -lXt -lSM -lXmu -lXext -lXpm

CFLAGS = -O2 -m486 -fomit-frame-pointer -Wall
#CFLAGS = -g -Wall

# App-defaults directory for install
APPDEFDIR = /usr/lib/X11/app-defaults

# Where to put the binary and man page
BINDIR = /usr/local/bin
MANDIR = /usr/local/man/man1

OFILES = compress.o cvt_period.o dump.o effects.o get_version.o gmod.o init.o \
	info_shell.o load_669.o load_mod.o load_mtm.o load_s3m.o load_ult.o \
	misc.o opt_shell.o parse.o patch_load.o play_mod.o play_note.o \
	play_voice.o popup.o proc_input.o read_rc.o sel_shell.o top_shell.o \
	track_shell.o x_funcs.o

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

xgmod: fallback.h .depend $(OFILES)
	$(CC) -s -o xgmod $(OFILES) $(LIBS)

.depend:
	$(CC) $(DEFINES) -MM *.c > .depend

#clean added by Peter Federighi
clean:
	rm -f $(OFILES) xgmod core .depend fallback.h

install: xgmod Xgmod.ad Xgmod-color.ad
	install -o bin -g bin -m 755 -s xgmod $(BINDIR)/xgmod
	install -o bin -g bin -m 644 Xgmod.ad $(APPDEFDIR)/Xgmod
	install -o bin -g bin -m 644 Xgmod-color.ad $(APPDEFDIR)/Xgmod-color 
	install -o bin -g info -m 644 xgmod.1 $(MANDIR)/xgmod.1

fallback.h: fallback.awk Xgmod.ad
	gawk -f fallback.awk Xgmod.ad > fallback.h

ifeq (.depend,$(wildcard .depend))
include .depend
endif
