CC = gcc -Wall -Werror  -O2 -pipe

OBJS = MeasureLibrary.o altmath.o parse_fft.o

all:                    tester unix2dos windows $(OBJS) how2 plot duty-cycle\
                        thd

MeasureLibrary.o:       MeasureLibrary.c MeasureLibrary.h
                        $(CC) -c -o MeasureLibrary.o MeasureLibrary.c

altmath.o:              altmath.c altmath.h
                        $(CC) -c -o altmath.o altmath.c

parse_fft.o:            parse_fft.c
                        $(CC) -c -o parse_fft.o parse_fft.c

tester:                 tester.c MeasureLibrary.h altmath.h $(OBJS) 
                        $(CC) -o tester tester.c $(OBJS) -lm

how2:                   how2.c MeasureLibrary.h altmath.h $(OBJS)
                        $(CC) -o how2 how2.c $(OBJS) -lm

duty-cycle:             duty-cycle.c MeasureLibrary.h altmath.h $(OBJS)
                        $(CC) -o duty-cycle duty-cycle.c $(OBJS) -lm

thd:                    thd.c MeasureLibrary.h altmath.h $(OBJS)
                        $(CC) -o thd thd.c $(OBJS) -lm

plot:                   plot.c
                        $(CC) -o plot plot.c

unix2dos:               unix2dos.c
                        $(CC) -o unix2dos unix2dos.c

windows:                unix2dos *.[ch] makewin.sh
                        sh ./makewin.sh 

data:
                        rm -rf *.DAT *.PHA *.RAW

clean:
                        rm -f $(OBJS) tester how2 unix2dos *.DAT *.PHA thd
                        rm -rf windows kernel kernel.txt duty-cycle plot


