Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #
  2. # Asterisk -- A telephony toolkit for Linux.
  3. #
  4. # Makefile for Menuselect
  5. #
  6. # Copyright (C) 2005-2008, Digium, Inc.
  7. #
  8. # Russell Bryant <russell@digium.com>
  9. #
  10. # This program is free software, distributed under the terms of
  11. # the GNU General Public License
  12. #
  13. # even though we could use '-include makeopts' here, use a wildcard
  14. # lookup anyway, so that make won't try to build makeopts if it doesn't
  15. # exist (other rules will force it to be built if needed)
  16. ifneq ($(wildcard makeopts),)
  17. include makeopts
  18. endif
  19. .PHONY: clean dist-clean distclean test ntest ctest gtest
  20. # Basic set of sources and flags/libraries/includes
  21. OBJS:=menuselect.o strcompat.o
  22. CFLAGS+=-g -D_GNU_SOURCE -Wall
  23. ifeq ($(MENUSELECT_DEBUG),yes)
  24. CFLAGS += -DMENUSELECT_DEBUG
  25. endif
  26. ifdef NCURSES_LIB
  27. C_OBJS += menuselect_curses.o
  28. C_LIBS +=$(NCURSES_LIB)
  29. C_INCLUDE += $(NCURSES_INCLUDE)
  30. ALL_TGTS += cmenuselect
  31. else
  32. ifdef CURSES_LIB
  33. C_OBJS += menuselect_curses.o
  34. C_LIBS +=$(CURSES_LIB)
  35. C_INCLUDE += $(CURSES_INCLUDE)
  36. ALL_TGTS += cmenuselect
  37. endif
  38. endif
  39. ifdef GTK2_LIB
  40. G_OBJS += menuselect_gtk.o
  41. G_LIBS += $(GTK2_LIB)
  42. G_INCLUDE += $(GTK2_INCLUDE)
  43. ALL_TGTS += gmenuselect
  44. endif
  45. ifdef NEWT_LIB
  46. N_OBJS += menuselect_newt.o
  47. N_LIBS += $(NEWT_LIB)
  48. N_INCLUDE += $(NEWT_INCLUDE)
  49. ALL_TGTS += nmenuselect
  50. endif
  51. M_OBJS += menuselect_stub.o
  52. M_LIBS += $(LIBXML2_LIB)
  53. ALL_TGTS += menuselect
  54. all: $(ALL_TGTS)
  55. $(OBJS) $(C_OBJS) $(N_OBJS) $(G_OBJS) $(M_OBJS): autoconfig.h menuselect.h
  56. makeopts autoconfig.h: autoconfig.h.in makeopts.in
  57. @./configure $(CONFIGURE_SILENT)
  58. @echo "****"
  59. @echo "**** The configure script was just executed, so 'make' needs to be"
  60. @echo "**** restarted."
  61. @echo "****"
  62. @exit 1
  63. ifdef C_OBJS
  64. menuselect_curses.o: CFLAGS+=$(C_INCLUDE)
  65. cmenuselect: $(OBJS) $(C_OBJS)
  66. $(CC) $(LDFLAGS) -o $@ $^ $(C_LIBS) $(LIBXML2_LIB)
  67. else
  68. cmenuselect:
  69. endif
  70. ifdef G_OBJS
  71. menuselect_gtk.o: CFLAGS+=$(G_INCLUDE)
  72. gmenuselect: $(OBJS) $(G_OBJS)
  73. $(CC) $(LDFLAGS) -o $@ $^ $(G_LIBS) $(LIBXML2_LIB)
  74. else
  75. gmenuselect:
  76. endif
  77. ifdef N_OBJS
  78. menuselect_newt.o: CFLAGS+=$(N_INCLUDE)
  79. nmenuselect: $(OBJS) $(N_OBJS)
  80. $(CC) $(LDFLAGS) -o $@ $^ $(N_LIBS) $(LIBXML2_LIB)
  81. else
  82. nmenuselect:
  83. endif
  84. menuselect.o: CFLAGS+=$(LIBXML2_INCLUDE)
  85. menuselect: $(OBJS) $(M_OBJS)
  86. $(CC) $(LDFLAGS) -o $@ $^ $(M_LIBS)
  87. test: menuselect
  88. (cd test; ../$< menuselect.makeopts)
  89. ctest: cmenuselect
  90. (cd test; ../$< menuselect.makeopts)
  91. gtest: gmenuselect
  92. (cd test; ../$< menuselect.makeopts)
  93. ntest: nmenuselect
  94. (cd test; ../$< menuselect.makeopts)
  95. clean:
  96. rm -f menuselect cmenuselect gmenuselect nmenuselect $(OBJS) $(M_OBJS) $(C_OBJS) $(G_OBJS) $(N_OBJS)
  97. dist-clean: distclean
  98. distclean: clean
  99. rm -f autoconfig.h config.status config.log makeopts
  100. rm -rf autom4te.cache