#
# Makefile for lxmusserv 0.94
#

# Change these to fit your system
CC     = gcc

WFLAGS = -Wall -Wwrite-strings -Wshadow -W -Wcast-qual -Wmissing-declarations \
         -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls \
         -Wbad-function-cast -Wcast-align -Wpointer-arith # -Wconversion

#CFLAGS = $(WFLAGS) -O2 -mpentiumpro
#CFLAGS = -Wall -g3
CFLAGS = $(WFLAGS) -O2
AFLAGS = $(CFLAGS)
LDFLAGS = # -s
LIBS   = 

# FreeBSD options
#CFLAGS = -I. -Wall -O2 -m486 -I. -I/usr/src/sys/i386/isa/sound
#LIBS   =

INSTALL = install -s
DESTDIR = /usr/local/games
SHELL = /bin/sh

#############################################
# Nothing below this line should be changed #
#############################################

.c.s:
	$(CC) $(AFLAGS) -S -o $*.s $<

OBJS = musserver.o readwad.o playmus.o sequencer.o midi_setup.o
.DUMMY: clean realclean archive install

all: musserv

musserv: $(OBJS)
	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS)

clean:
	rm -f $(OBJS) musserv

realclean: clean
	rm -f *~

archive: realclean
	(cd .. ; tar cf - lxmusserv-0.94/*.[ch] lxmusserv-0.94/[A-Z]* \
         | gzip -9f > lxmusserv-0.94.tar.gz)

all: musserv

install: all
	$(INSTALL) musserv $(DESTDIR)/


$(OBJS): musserver.h sequencer.h
