Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. MAKEF=$(MAKE) -f Makefile.in
  2. TMPDIR=tmp
  3. default: all
  4. all: test client server httpd webbench
  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: prepare
  32. $(MAKEF) TARGET=$@ SRCS="examples/webbench.c"
  33. # curl
  34. INCDIRS:=". base utils http http/client"
  35. SRCS:="examples/curl.cpp http/client/http_client.cpp http/http_parser.c http/multipart_parser.c http/http_content.cpp base/hstring.cpp"
  36. curl:
  37. $(MAKEF) TARGET=$@ INCDIRS=$(INCDIRS) SRCS=$(SRCS) DEFINES="CURL_STATICLIB" LIBS="curl"
  38. .PHONY: clean prepare test client server curl httpd webbench