Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. MAKEF=$(MAKE) -f Makefile.in
  2. TMPDIR=tmp
  3. default: all
  4. all: test loop client server httpd
  5. clean:
  6. $(MAKEF) clean SRCDIRS=". base utils event http http/client http/server examples $(TMPDIR)"
  7. prepare:
  8. -mkdir -p $(TMPDIR)
  9. test: prepare
  10. -rm $(TMPDIR)/*.o $(TMPDIR)/*.h $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  11. cp main.cpp.tmpl $(TMPDIR)/main.cpp
  12. $(MAKEF) TARGET=$@ SRCDIRS=". base utils $(TMPDIR)"
  13. loop: prepare
  14. -rm $(TMPDIR)/*.o $(TMPDIR)/*.h $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  15. cp examples/loop.c $(TMPDIR)/loop.c
  16. $(MAKEF) TARGET=$@ SRCDIRS=". base event $(TMPDIR)"
  17. client: prepare
  18. -rm $(TMPDIR)/*.o $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  19. cp examples/client.cpp $(TMPDIR)/client.cpp
  20. $(MAKEF) TARGET=$@ SRCDIRS=". base event $(TMPDIR)"
  21. server: prepare
  22. -rm $(TMPDIR)/*.o $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  23. cp examples/server.cpp $(TMPDIR)/server.cpp
  24. $(MAKEF) TARGET=$@ SRCDIRS=". base event $(TMPDIR)"
  25. httpd: prepare
  26. -rm $(TMPDIR)/*.o $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  27. cp examples/httpd.cpp $(TMPDIR)/httpd.cpp
  28. cp examples/httpd_conf.h $(TMPDIR)/httpd_conf.h
  29. cp examples/http_api_test.h $(TMPDIR)/http_api_test.h
  30. $(MAKEF) TARGET=$@ SRCDIRS=". base utils event http http/server $(TMPDIR)"
  31. webbench:
  32. $(MAKEF) TARGET=$@ SRCDIRS="" SRCS="examples/webbench.c"
  33. # curl
  34. CURL_SRCDIRS := http http/client
  35. CURL_INCDIRS += base utils http http/client
  36. CURL_SRCS += examples/curl.cpp base/hstring.cpp
  37. curl:
  38. $(MAKEF) TARGET=$@ SRCDIRS="$(CURL_SRCDIRS)" INCDIRS="$(CURL_INCDIRS)" SRCS="$(CURL_SRCS)" DEFINES="CURL_STATICLIB" LIBS="curl"
  39. .PHONY: clean prepare test loop client server httpd webbench curl