libevhtp: build checked out copy

Now that libevhtp is part of the manifest, build it directly and store
the results in out/.

This also deletes references to third_party/{include,lib} as they're
no longer needed.

BUG=b/27820899
TEST+`make` still works, as does the unittests

Change-Id: I6b1dd91cea0f152f8e79527e842add6a9d797a3c
Reviewed-on: https://weave-review.googlesource.com/3001
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/third_party/third_party.mk b/third_party/third_party.mk
index e53529b..18f9b98 100644
--- a/third_party/third_party.mk
+++ b/third_party/third_party.mk
@@ -79,15 +79,18 @@
 		$(third_party_gtest_all) $(third_party_gmock_all)
 
 ###
-# libevhtp (third_party, downloaded on build)
+# libevhtp (third_party)
 
-third_party/lib/libevhtp.a : third_party/include/evhtp.h
-third_party/include/evhtp.h :
-	@echo Downloading and building libevhtp...
-	third_party/get_libevhtp.sh
-	@echo Finished downloading and building libevhtp.
+third_party_libevhtp = out/$(BUILD_MODE)/third_party/libevhtp
+third_party_libevhtp_lib = $(third_party_libevhtp)/libevhtp.a
+third_party_libevhtp_header = $(third_party_libevhtp)/evhtp-config.h
+
+$(third_party_libevhtp_header) :
+	mkdir -p $(dir $@)
+	cd $(dir $@) && cmake -D EVHTP_DISABLE_REGEX:BOOL=ON $(PWD)/third_party/libevhtp
+
+$(third_party_libevhtp_lib) : $(third_party_libevhtp_header)
+	$(MAKE) -C $(third_party_libevhtp)
 
 clean-libevhtp :
-	rm -rf third_party/include/evhtp.h third_party/include/evhtp-config.h third_party/include/evthr.h third_party/include/htparse.h
-	rm -rf third_party/lib/libevhtp.a
-	rm -rf third_party/libevhtp
+	rm -rf $(third_party_libevhtp)