# Makefile for TAPir
# use with regular make

CC	= gcc
CFLAGS	= -Wall -O2 -g
CPPFLAGS= -D LINUX

RM	= rm -f
LD	= ld
LDFLAGS	= -lpthread

TARGET	= tapir

# Pattern rule
%.o : %.c %.h
	$(CC) $(CPPFLAGS) -c $(CFLAGS) -o $*.o $*.c

$(TARGET): Makefile tapir.o filter.o tap.o sound.o cmdline.o output.o turbotape.o
	$(CC) $(SPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(TARGET) tapir.o filter.o tap.o sound.o cmdline.o output.o turbotape.o

# The command line parser is generated by gengetopt
tapir.c : cmdline.h cmdline.c

cmdline.c : tapir.ggo
	gengetopt -itapir.ggo

cmdline.h : tapir.ggo
	gengetopt -itapir.ggo

clean:
	$(RM) *~ .\getopt\*~ .\matlab\*~
	$(RM) tapir.o filter.o tap.o sound.o cmdline.o output.o turbotape.o
	$(RM) $(TARGET) tapir.exe

dist:	$(TARGET)
	$(RM) *~ .\getopt\*~ .\matlab\*~
	$(RM) tapir.o filter.o tap.o sound.o cmdline.o output.o turbotape.o
	strip $(TARGET)
