change the CFLAGS controlled by menuselect to be placed in a header file
[asterisk/asterisk.git] / build_tools / Makefile
index 7f4d8b4..d48017f 100644 (file)
@@ -1,6 +1,18 @@
-MENUSELECT_OBJS=menuselect.o menuselect_curses.o ../strcompat.o
-MENUSELECT_CFLAGS=-g -c -D_GNU_SOURCE -I../ -I../include/
-MENUSELECT_LIBS=../mxml/libmxml.a $(CURSES_LIB)
+MENUSELECT_OBJS=menuselect.o menuselect_curses.o
+MENUSELECT_CFLAGS=-g -c -D_GNU_SOURCE -DMENUSELECT -I../ -I../include/
+MENUSELECT_LIBS=../mxml/libmxml.a
+
+ifeq ($(OSARCH),SunOS)
+  MENUSELECT_OBJS+=../strcompat.o
+endif
+
+ifneq ($(NCURSES_LIB),)
+  MENUSELECT_LIBS+=$(NCURSES_LIB)
+  MENUSELECT_INCLUDE=$(NCURSES_INCLUDE)
+else
+  MENUSELECT_LIBS+=$(CURSES_LIB)
+  MENUSELECT_INCLUDE=$(CURSES_INCLUDE)
+endif
 
 menuselect: $(MENUSELECT_OBJS)
        $(CC) -g -o $@ $(MENUSELECT_OBJS) $(MENUSELECT_LIBS)
@@ -9,7 +21,7 @@ menuselect.o: menuselect.c menuselect.h
        $(CC) -o $@ $(MENUSELECT_CFLAGS) $<
 
 menuselect_curses.o: menuselect_curses.c menuselect.h
-       $(CC) -o $@ $(MENUSELECT_CFLAGS) $(CURSES_INCLUDE) $<
+       $(CC) -o $@ $(MENUSELECT_CFLAGS) $(MENUSELECT_INCLUDE) $<
 
 clean:
        rm -f menuselect *.o