* user-friendly(?) build system, based on linux Menuconfig script.
[vlc.git] / lxdialog / Makefile
1 HOSTCC = gcc
2 HOSTCFLAGS += -DLOCALE 
3 LIBS = -lncurses
4
5 ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
6         HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
7 else
8 ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
9         HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
10 else
11 ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
12         HOSTCFLAGS += -DCURSES_LOC="<ncurses.h>"
13 else
14         HOSTCFLAGS += -DCURSES_LOC="<curses.h>"
15 endif
16 endif
17 endif
18
19
20 OBJS = checklist.o menubox.o textbox.o yesno.o inputbox.o \
21        util.o lxdialog.o msgbox.o
22
23 %.o: %.c
24         $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
25
26 all: ncurses lxdialog
27
28 lxdialog: $(OBJS)
29         $(HOSTCC) -o lxdialog $(OBJS) $(LIBS)
30
31 ncurses:
32         @echo "main() {}" > lxtemp.c
33         @if $(HOSTCC) -lncurses lxtemp.c ; then \
34                 rm -f lxtemp.c a.out; \
35         else \
36                 rm -f lxtemp.c; \
37                 echo -e "\007" ;\
38                 echo ">> Unable to find the Ncurses libraries." ;\
39                 echo ">>" ;\
40                 echo ">> You must have Ncurses installed in order" ;\
41                 echo ">> to use 'make menuconfig'" ;\
42                 echo ;\
43                 exit 1 ;\
44         fi
45
46 clean:
47         rm -f core *.o *~ lxdialog