Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # $Id$
  2. include ../../Makefile.defs
  3. include ../../Makefile.targets
  4. auto_gen=
  5. NAME=sercmd
  6. RELEASE=0.1
  7. readline_locations= /usr/include/readline/readline.h \
  8. $(LOCALBASE)/include/readline/readline.h
  9. use_readline ?=
  10. ifneq (,$(MAKECMDGOALS))
  11. ifeq (,$(filter-out $(nodep_targets),$(MAKECMDGOALS)))
  12. #set it to empty, we don't need to detect/use it for clean, doc a.s.o
  13. override use_readline:=
  14. quiet=1
  15. endif
  16. endif #ifneq (,$(MAKECMDGOALS))
  17. # erase common DEFS (not needed)
  18. C_DEFS:=
  19. DEFS:= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' \
  20. $(filter -D%HAVE -DARCH% -DOS% -D__CPU% -D__OS%, $(DEFS))
  21. LIBS:=$(filter-out -lfl -ldl -lpthread -lssl -lcrypto, $(LIBS))
  22. ifeq ($(use_readline),)
  23. readline_path := $(shell \
  24. for r in $(readline_locations) ""; do \
  25. if [ -r "$$r" ] ; then echo $$r; exit; fi; \
  26. done;\
  27. )
  28. ifneq ($(readline_path),)
  29. use_readline := 1
  30. endif
  31. endif
  32. ifeq ($(use_readline),1)
  33. DEFS+=-DUSE_READLINE
  34. LIBS+=-lreadline -lncurses
  35. endif
  36. include ../../Makefile.sources
  37. include ../../Makefile.rules
  38. ifeq (,$(quiet))
  39. ifeq ($(use_readline),1)
  40. $(info readline detected ($(readline_path)) )
  41. $(info command completion enabled)
  42. else
  43. $(info "no readline include files detected, disabling readline support")
  44. $(info "command completion disabled" )
  45. $(info "to force readline support try 'make use_readline=1'")
  46. endif
  47. endif # ifeq (,$(quiet))
  48. $(NAME).o:
  49. .PHONY: msg
  50. msg:
  51. @if [ "$(use_readline)" = "1" ]; then \
  52. echo; echo "readline detected ($(readline_path)):"; \
  53. echo "command completion enabled"; echo ; \
  54. else \
  55. echo ; \
  56. echo "no readline include files detected, disabling readline support";\
  57. echo "command completion disabled"; \
  58. echo "(to force readline support try 'make use_readline=1')";\
  59. echo ; \
  60. fi
  61. modules: