Makefile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. MAKEF=$(MAKE) -f Makefile.in
  2. TMPDIR=tmp
  3. default: all
  4. all: test ping 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. ping:
  14. -rm base/hsocket.o
  15. $(MAKEF) TARGET=$@ SRCDIRS="" SRCS="examples/ping.c base/hsocket.c base/htime.c base/RAII.cpp" INCDIRS=". base" DEFINES="PRINT_DEBUG"
  16. loop: prepare
  17. -rm $(TMPDIR)/*.o $(TMPDIR)/*.h $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  18. cp examples/loop.c $(TMPDIR)
  19. $(MAKEF) TARGET=$@ SRCDIRS=". base event $(TMPDIR)"
  20. client: prepare
  21. -rm $(TMPDIR)/*.o $(TMPDIR)/*.h $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  22. cp examples/client.cpp $(TMPDIR)
  23. $(MAKEF) TARGET=$@ SRCDIRS=". base event $(TMPDIR)"
  24. server: prepare
  25. -rm $(TMPDIR)/*.o $(TMPDIR)/*.h $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  26. cp examples/server.cpp $(TMPDIR)
  27. $(MAKEF) TARGET=$@ SRCDIRS=". base event $(TMPDIR)"
  28. httpd: prepare
  29. -rm $(TMPDIR)/*.o $(TMPDIR)/*.h $(TMPDIR)/*.c $(TMPDIR)/*.cpp
  30. cp examples/httpd.cpp examples/httpd_conf.h examples/http_api_test.h $(TMPDIR)
  31. $(MAKEF) TARGET=$@ SRCDIRS=". base utils event http http/server $(TMPDIR)"
  32. webbench:
  33. $(MAKEF) TARGET=$@ SRCDIRS="" SRCS="examples/webbench.c"
  34. # curl
  35. CURL_SRCDIRS := http http/client
  36. CURL_INCDIRS += base utils http http/client
  37. CURL_SRCS += examples/curl.cpp base/hstring.cpp base/hbase.c
  38. curl:
  39. $(MAKEF) TARGET=$@ SRCDIRS="$(CURL_SRCDIRS)" INCDIRS="$(CURL_INCDIRS)" SRCS="$(CURL_SRCS)" DEFINES="CURL_STATICLIB" LIBS="curl"
  40. .PHONY: clean prepare test ping loop client server httpd webbench curl