############################################################################
# FunktrackerGOLD - By Jason Nunn
# Copyright (C) 1996,1998 Jason Nunn
#
# FunktrackerGOLD now comes under the GNU General Public License. Please
# read the COPYING notice in this distribution.
############################################################################
CC	= gcc
OPTIONS = -Wall -O2 -pipe -fomit-frame-pointer
LIB	= -lpthread -lncurses -lm

ifeq ($(OSTYPE),Linux)
  OPTIONS += -DLinux
else
  ifeq ($(OSTYPE),FreeBSD)
    OPTIONS += -DFreeBSD
    LIB += -ltermcap #-lmytinfo
  else
    OPTIONS += -DLinux
  endif
endif

HOST_SAFE = 0

ifeq ($(HOSTTYPE),i386)
  HOST_SAFE = 1
endif

ifeq ($(HOSTTYPE),i486)
  HOST_SAFE = 1
endif

ifeq ($(HOSTTYPE),i586)
  HOST_SAFE = 1
endif

ifeq ($(HOSTTYPE),i686)
  HOST_SAFE = 1
endif

###############################
all:
	@if [ $(HOST_SAFE) = '1' ]; then \
	  make funkgold; \
	else \
	  echo "***********************************************"; \
	  echo "This is not an INTEL based machine. As the Funktracker"; \
	  echo "format is in Intel byte sex (and i haven't yet made"; \
	  echo "provisions for other processors), trying to play"; \
	  echo "funktracker songs on this machine will be dangerous."; \
	  echo ""; \
	  echo "Refer to INSTALL file."; \
	  echo "***********************************************"; \
	fi

###############################
OBJ_FT		= dsp_mixxer.o funktracker.o funkload.o funkgold_misc.o \
		funkgold_dir.o funkgold_sm.o funkgold_se.o funkgold_pe.o \
		funkgold_trac.o funkgold.o

funkgold: $(OBJ_FT)
	$(CC) $(OPTIONS) -o funkgold $(OBJ_FT) $(LIB)
	strip funkgold

###############################
clean:
	rm -f *.o funkgold

release:
	make
	rm -f *.o

###############################
%.o: %.c %.h
	$(CC) $(OPTIONS) -c $< -o $@
