-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
120 lines (96 loc) · 2.79 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#
# Asterisk -- A telephony toolkit for Linux.
#
# Makefile for Menuselect
#
# Copyright (C) 2005-2006, Digium, Inc.
#
# Russell Bryant <russell@digium.com>
#
# This program is free software, distributed under the terms of
# the GNU General Public License
#
# even though we could use '-include makeopts' here, use a wildcard
# lookup anyway, so that make won't try to build makeopts if it doesn't
# exist (other rules will force it to be built if needed)
ifneq ($(wildcard makeopts),)
include makeopts
endif
.PHONY: clean dist-clean distclean test ntest ctest gtest
# Basic set of sources and flags/libraries/includes
OBJS:=menuselect.o strcompat.o
CFLAGS:=-g -c -D_GNU_SOURCE -Wall
ifeq ($(MENUSELECT_DEBUG),yes)
CFLAGS += -DMENUSELECT_DEBUG
endif
# Pick a curses library if available
ifneq ($(NCURSES_LIB),)
C_OBJS += menuselect_curses.o
C_LIBS +=$(NCURSES_LIB)
C_INCLUDE += $(NCURSES_INCLUDE)
else
ifneq ($(CURSES_LIB),)
C_OBJS += menuselect_curses.o
C_LIBS +=$(CURSES_LIB)
C_INCLUDE += $(CURSES_INCLUDE)
endif
endif
# Pick gtk library if available
ifneq ($(GTK2_LIB),)
G_OBJS += menuselect_gtk.o
G_LIBS += $(GTK2_LIB)
G_INCLUDE += $(GTK2_INCLUDE)
endif
# Pick newt if available
ifneq ($(NEWT_LIB),)
N_OBJS += menuselect_newt.o
N_LIBS += $(NEWT_LIB)
N_INCLUDE += $(NEWT_INCLUDE)
endif
ifneq ($(N_OBJS),)
M_OBJS += $(N_OBJS)
M_LIBS += $(N_LIBS)
else
ifneq ($(C_OBJS),)
M_OBJS += $(C_OBJS)
M_LIBS += $(C_LIBS)
else
M_OBJS += menuselect_stub.o
endif
endif
all:
@$(MAKE) menuselect
$(OBJS) menuselect_gtk.o menuselect_curses.o menuselect_stub.o: autoconfig.h menuselect.h
makeopts autoconfig.h: autoconfig.h.in makeopts.in
@./configure $(CONFIGURE_SILENT) CC= LD= AR= CFLAGS=
menuselect cmenuselect gmenuselect nmenuselect: mxml/libmxml.a
menuselect_curses.o: CFLAGS+=$(C_INCLUDE)
cmenuselect: $(OBJS) $(C_OBJS)
$(CC) -o $@ $^ $(C_LIBS)
menuselect_gtk.o: CFLAGS+=$(G_INCLUDE)
gmenuselect: $(OBJS) $(G_OBJS)
$(CC) -o $@ $^ $(G_LIBS)
menuselect_newt.o: CFLAGS+=$(N_INCLUDE)
nmenuselect: $(OBJS) $(N_OBJS)
$(CC) -o $@ $^ $(N_LIBS)
menuselect: $(OBJS) $(M_OBJS)
$(CC) -o $@ $^ $(M_LIBS)
mxml/libmxml.a:
@if test ! -f mxml/Makefile ; then cd mxml && ./configure ; fi
@$(MAKE) -C mxml libmxml.a
test: menuselect
(cd test; ../$< menuselect.makeopts)
ctest: cmenuselect
(cd test; ../$< menuselect.makeopts)
gtest: gmenuselect
(cd test; ../$< menuselect.makeopts)
ntest: nmenuselect
(cd test; ../$< menuselect.makeopts)
clean:
rm -f menuselect cmenuselect gmenuselect nmenuselect $(OBJS) $(M_OBJS) $(C_OBJS) $(G_OBJS) $(N_OBJS)
@if test -f mxml/Makefile ; then $(MAKE) -C mxml clean ; fi
dist-clean: distclean
distclean: clean
@if test -f mxml/Makefile ; then $(MAKE) -C mxml distclean ; fi
rm -f autoconfig.h config.status config.log makeopts
rm -rf autom4te.cache