Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. ifneq ($(findstring dragonfly,$(OSARCH)),)
  24. CFLAGS += -isystem /usr/local/include
  25. else ifneq ($(findstring netbsd,$(OSARCH)),)
  26. CFLAGS += -isystem /usr/pkg/include
  27. else ifneq ($(findstring bsd,$(OSARCH)),)
  28. CFLAGS += -isystem /usr/local/include
  29. endif
  30. ifeq ($(MENUSELECT_DEBUG),yes)
  31. CFLAGS += -DMENUSELECT_DEBUG
  32. endif
  33. ifdef NCURSES_LIB
  34. C_OBJS += menuselect_curses.o
  35. C_LIBS +=$(NCURSES_LIB)
  36. C_INCLUDE += $(NCURSES_INCLUDE)
  37. ALL_TGTS += cmenuselect
  38. CFLAGS += -DHAVE_NCURSES
  39. ifeq ($(HAVE_NCURSES_SUBDIR),yes)
  40. CFLAGS += -DHAVE_NCURSES_SUBDIR
  41. endif
  42. else
  43. ifdef CURSES_LIB
  44. C_OBJS += menuselect_curses.o
  45. C_LIBS +=$(CURSES_LIB)
  46. C_INCLUDE += $(CURSES_INCLUDE)
  47. ALL_TGTS += cmenuselect
  48. endif
  49. endif
  50. ifdef GTK2_LIB
  51. G_OBJS += menuselect_gtk.o
  52. G_LIBS += $(GTK2_LIB)
  53. G_INCLUDE += $(GTK2_INCLUDE)
  54. ALL_TGTS += gmenuselect
  55. endif
  56. ifdef NEWT_LIB
  57. N_OBJS += menuselect_newt.o
  58. N_LIBS += $(NEWT_LIB)
  59. N_INCLUDE += $(NEWT_INCLUDE)
  60. ALL_TGTS += nmenuselect
  61. endif
  62. M_OBJS += menuselect_stub.o
  63. M_LIBS += $(LIBXML2_LIB)
  64. ALL_TGTS += menuselect
  65. all: $(ALL_TGTS)
  66. $(OBJS) $(C_OBJS) $(N_OBJS) $(G_OBJS) $(M_OBJS): autoconfig.h menuselect.h
  67. makeopts: configure
  68. @./configure $(CONFIGURE_SILENT)
  69. @echo "****"
  70. @echo "**** The configure script was just executed, so 'make' needs to be"
  71. @echo "**** restarted."
  72. @echo "****"
  73. @exit 1
  74. ifdef C_OBJS
  75. menuselect_curses.o: CFLAGS+=$(C_INCLUDE)
  76. cmenuselect: $(OBJS) $(C_OBJS)
  77. $(CC) $(LDFLAGS) -o $@ $^ $(C_LIBS) $(LIBXML2_LIB)
  78. else
  79. cmenuselect:
  80. endif
  81. ifdef G_OBJS
  82. menuselect_gtk.o: CFLAGS+=$(G_INCLUDE)
  83. gmenuselect: $(OBJS) $(G_OBJS)
  84. $(CC) $(LDFLAGS) -o $@ $^ $(G_LIBS) $(LIBXML2_LIB)
  85. else
  86. gmenuselect:
  87. endif
  88. ifdef N_OBJS
  89. menuselect_newt.o: CFLAGS+=$(N_INCLUDE)
  90. nmenuselect: $(OBJS) $(N_OBJS)
  91. $(CC) $(LDFLAGS) -o $@ $^ $(N_LIBS) $(LIBXML2_LIB)
  92. else
  93. nmenuselect:
  94. endif
  95. menuselect.o: CFLAGS+=$(LIBXML2_INCLUDE)
  96. menuselect: $(OBJS) $(M_OBJS)
  97. $(CC) $(LDFLAGS) -o $@ $^ $(M_LIBS)
  98. test: menuselect
  99. (cd test; ../$< menuselect.makeopts)
  100. ctest: cmenuselect
  101. (cd test; ../$< menuselect.makeopts)
  102. gtest: gmenuselect
  103. (cd test; ../$< menuselect.makeopts)
  104. ntest: nmenuselect
  105. (cd test; ../$< menuselect.makeopts)
  106. clean:
  107. rm -f menuselect cmenuselect gmenuselect nmenuselect $(OBJS) $(M_OBJS) $(C_OBJS) $(G_OBJS) $(N_OBJS)
  108. dist-clean: distclean
  109. distclean: clean
  110. rm -f autoconfig.h config.status config.log makeopts
  111. rm -rf autom4te.cache