#
# GNU-compatible Makefile for fmdrv.
#
# Compiles on Linux.
#
# Copyright (C) 1992,2000 Bisqwit (http://iki.fi/bisqwit/)
#
# Please don't complain or ask anything about the source files,
# structure, compatibility or anything. This program has been
# written during many years, without first a slightest idea
# of porting to Linux or any other sys than DOS. So, DOS
# program this is. Was. Originally. And is still. The DOS
# -specific sources are not here, however. They are
# somewhere on my pages.
#
# Compiling:
#
#   make
#   cp -p fmdrv /usr/local/bin/
#
# Usages:
#
#   fmdrv file.mid
#
#   fmdrv --help
#
#   fmdrv -vvm file.mid
#
#   fmdrv file.mid file.s3m
#

VERSION=1.0.7
DEFS=-DUnderFMDRV

include Makefile.sets

LDLIBS=-lm
BINDIR=/usr/local/bin

PROGS=fmdrv
SUBDIRS=
OBJS=main.o cons.o m_path.o
ARCHDIR=archives/
ARCHNAME=fmdrv-$(VERSION)
ARCHFILES=main.c m_path.c fmdrv.h intgen.c music.h \
          sysdeps.c sysdeps.h \
          cons.c cons.h \
          m_opl.c m_opl.h \
          configure README INSTALL TINYFREELICENSE \
          Makefile.sets subdirs.mak progdesc.php
INSTALLPROGS=$(PROGS)

include subdirs.mak

fmdrv: fmdrvlib.a sysdeps.o
	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^

fmdrvlib.a: $(OBJS)
	#ELF (works):
	# $(CC) -Wl,-r -nostdlib -o $@ $^
	#a.out (works):
	ar -rc $@ $^

install: installbin
	chown root $(BINDIR)/fmdrv
	chmod 4755 $(BINDIR)/fmdrv
