# $Id: Makefile,v 1.2 2000/01/03 17:10:45 rogue Exp $
#
# ...consider Imake or autoconf
#

# development build on Slackware Linux 3.5.0
CC	= gcc
CFLAGS	= -O -I/usr/X11R6/include -Wall -Wstrict-prototypes -DOSSPLAY
LDFLAGS	= -L/usr/X11R6/lib
LIBS	= -lXm -lXt -lX11 -lm

# Slackware Linux 3.5.0, FreeBSD 2.2.6 (i386), NetBSD 1.3.2 (i386), gcc-2.7.2
# use -m586, -m686 etc. with egcs
#CC	= gcc
#CFLAGS	= -O2 -I/usr/X11R6/include -Wall -DOSSPLAY
#LDFLAGS	= -L/usr/X11R6/lib
#LIBS	= -lXm -lXt -lX11 -lm

# SuSE 6.1 AXP (alpha), Compaq C Compiler V6.2
# use -ev56, -ev6 etc. if you have a newer alpha
#CC	= ccc
#CFLAGS	=  -O4 -I/usr/X11R6/include -Wall -DOSSPLAY
#LDFLAGS	= -L/usr/X11R6/lib -s
#LIBS	= -lXm -lXt -lX11 -lm

# Unixware 7.0.1 (i386), UW7 C Compiler
#CC	= cc
#CFLAGS	= -O -DOSSPLAY
#LDFLAGS	=
#LIBS	= -lXm -lXt -lX11 -lSM -lICE -lsocket -lnsl -lm

# Solaris 2.5.6 (sparc)
#CC	= gcc
#CFLAGS	= -O -I/usr/include/X11 -Wall -Wstrict-prototypes
#LDFLAGS	= -L/usr/X11R6/lib
#LIBS	= -lXm -lXt -lX11 -lm

# HP-UX 10.20 (PA-RISC 2.x), ANSI C Compiler
#CC	= cc
#CFLAGS	= -Ae -O -I/usr/include/Motif1.2
#LDFLAGS	= -s
#LIBS	= -lXm -lXt -lX11 -lm

# AIX 4.3.1.0 (RS/6000), IBM C and C++ Compiler
#CC	= cc
#CFLAGS	= -O -I/usr/include/Xm
#LDFLAGS	= -L/usr/X11R6/lib
#LIBS	= -lXm -lXt -lX11 -lm

OBJS	= bufutil.o clip.o eff.o file.o license.o ossplay.o resample.o \
	  xforge.o

all: xforge xforge.1x

xforge: $(OBJS)
	$(CC) -o xforge $(OBJS) $(LDFLAGS) $(LIBS)

xforge.1x: xforge.man
	sed -e 's/^/.\\" /' < LICENSE > LICENSE.man.in
	sed -e '/%%LICENSE%%/r LICENSE.man.in' -e '/%%LICENSE%%/d' \
	< xforge.man > xforge.1x
	rm -f LICENSE.man.in

license.c: license.c.in LICENSE
	sed -e 's/^/"/' -e 's/$$/\\n"/' < LICENSE > LICENSE.c.in
	sed -e '/%%LICENSE%%/r LICENSE.c.in' -e '/%%LICENSE%%/d' \
	< license.c.in > license.c
	rm -f LICENSE.c.in

clean:
	rm -f xforge $(OBJS) core xforge.core LICENSE.c.in LICENSE.man.in

realclean:
	make clean
	rm -f license.c xforge.1x
