all:
	rm -f test_mhd
	gcc -O3 -o test_mhd test_mhd.c -lmicrohttpd
	rm -f test_mongoose
	gcc -O3 -o test_mongoose test_mongoose.c -lmongoose
	rm -f test_soup
	gcc -O3 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/include/libsoup-2.4 -o test_soup test_soup.c -lglib-2.0 -lsoup-2.4
test:
	@echo "Testing Soup, please wait ..."
	./test_soup &
	sleep 2
	wrk -t12 -c400 -d30s http://127.0.0.1:8080/ > wrk_test_soup.txt
	killall test_soup
	sleep 3
	@echo "Done"
	@echo "Testing MHD, please wait ..."
	./test_mhd &
	sleep 2
	wrk -t12 -c400 -d30s http://127.0.0.1:8080/ > wrk_test_mhd.txt
	killall test_mhd
	sleep 3
	@echo "Done"
	@echo "Testing Mongoose, please wait ..."
	./test_mongoose &
	sleep 2
	wrk -t12 -c400 -d30s http://127.0.0.1:8080/ > wrk_test_mongoose.txt
	killall test_mongoose
	@echo "Done"
clean:
	rm -rf test_mhd test_mongoose test_soup wrk_test_mhd.txt wrk_test_mongoose.txt wrk_test_soup.txt