PROGRAM	 = tester
PROGRAM2 = progress
CC = gcc
CFLAGS += -pedantic -std=c99 -Wall -g
LIBCURL += -lcurl -L/tmp/kdudkapatch/curl/lib/.libs/
LIBNCURSES += -lncurses

all: $(PROGRAM) $(PROGRAM2)

$(PROGRAM): tester.o 
	$(CC) tester.o  -o $(PROGRAM) $(CFLAGS)  $(LIBCURLPATH) $(LIBCURL) 

$(PROGRAM2): progress.o
	$(CC) $^ -o $(PROGRAM2) $(CFLAGS) $(LIBCURLPATH) $(LIBCURL) $(LIBNCURSES)
	
progress.o: progress.c
	$(CC) $^ -c -o $@ $(CFLAGS) 

tester.o: tester.c
	$(CC) -c tester.c $(CFLAGS) -o tester.o 

clean:
	rm -rf $(PROGRAM) $(PROGRAM2)
	rm -rf *.o
	rm -rf downloads

pack: clean
	rm -rf testpack.zip
	zip -r testpack.zip *

test_list: $(PROGRAM)
	./$(PROGRAM) -wc -show_url -uri=/test1/ -show_rc $(PARAM)

test_txt: $(PROGRAM)
	./$(PROGRAM) -wc -show_url -uri=/test1/*.txt -show_rc $(PARAM)

test_txt_SUEU: $(PROGRAM)
	./$(PROGRAM) -wc -show_url -uri=/test1/*.txt -show_rc -SUEU $(PARAM)

test_all:  $(PROGRAM)
	@echo "It will take at least 40 seconds!"
	valgrind ./$(PROGRAM) -wc -show_url -uri=/test1/* -show_rc -null $(PARAM)

test_all_SUEU:  $(PROGRAM)
	@echo "It will take at least 40 seconds!"
	./$(PROGRAM) -wc -show_url -uri=/test1/* -show_rc -SUEU -null $(PARAM)

test_txt_SUEU_skip: $(PROGRAM)
	./$(PROGRAM) -wc -show_url -uri=/test1/*.txt -show_rc -SUEU -skip=skipthisfile.txt $(PARAM)

test_txt_SUEU_skip_valgrind: $(PROGRAM)
	valgrind ./$(PROGRAM) -wc -show_url -uri=/test1/*.txt -show_rc -SUEU -skip=skipthisfile.txt $(PARAM)

test_no_match: $(PROGRAM)
	./$(PROGRAM) -wc -show_url -uri=/test1/*.mp3 -show_rc $(PARAM)

test_progress: $(PROGRAM2)
	./$(PROGRAM2) -show_url -uri=/test1/*.txt -show_rc -sleep=5 $(PARAM)

test_progress_skip: $(PROGRAM2)
	./$(PROGRAM2) -show_url -uri=/test1/*.txt -show_rc -sleep=5 -skip=skipthisfile.txt $(PARAM)

test_progress_all: $(PROGRAM2)
	./$(PROGRAM2) -show_url -uri=/test1/* -show_rc -sleep=5 -skip=skipthisfile.txt $(PARAM)

test_progress_all_copy_to_local: $(PROGRAM2)
	./$(PROGRAM2) -show_url -uri=/test1/* -show_rc -sleep=5 -skip=skipthisfile.txt -to_local -to_dir=downloads  $(PARAM)

test_progress_txt_2x: $(PROGRAM2)
	./$(PROGRAM2) -show_url -uri=/test1/*.txt -show_rc -sleep=5 -skip=skipthisfile.txt -repeat=2 $(PARAM)
