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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
--- Makefile.in.orig Thu Aug 15 13:18:11 2002
+++ Makefile.in Fri Mar 19 03:29:21 2004
@@ -1,36 +1,43 @@
-LIBS = -lslang -lm #-lefence
-SHLIBS = -lslang -lm -lc
+LIBS = -lslang -lm -lpopt -lncurses #-lefence
+SHLIBS = -lslang -lm -lc -lpopt -lncurses
GPM_SUPPORT=@gpm_support@
-CFLAGS = $(RPM_OPT_FLAGS) -Wall -I/usr/include/slang -D_GNU_SOURCE
-ifeq ($(RPM_OPT_FLAGS),)
-CFLAGS += -g
-endif
+CFLAGS += -I${LOCALBASE}/include -I${PREFIX}/include
+LDFLAGS += -L${LOCALBASE}/lib -L${PREFIX}/lib
VERSION = @VERSION@
CVSTAG = r$(subst .,-,$(VERSION))
SONAME = @SONAME@
-PYTHONVERS = $(shell ls -d /usr/include/python* | sed "s|/usr/include/||g")
+#PYTHONVERS = $(shell ls -d /usr/include/python* | sed "s|/usr/include/||g")
-WHIPTCLSO=
-#WHIPTCLSO=whiptcl.so
+.if defined(WITH_TCL)
+WHIPTCLSO=whiptcl.so
+CFLAGS += -I${LOCALBASE}/include/${TCLVERSION}
+LDFLAGS += -L${LOCALBASE}/lib/${TCLVERSION}
+SHLIBS += -l${TCLVERSION:S,.,,}
+.endif
+TARGET=${LIBNEWT} ${PROGS} ${WHIPTCLSO}
-PROGS = test whiptail $(WHIPTCLSO) testgrid testtree
+PROGS = test whiptail testgrid testtree
TESTOBJS = test.o
NDIALOGOBJS = whiptail.o dialogboxes.o
WHIPTCLOBJS = whiptcl.o dialogboxes.o
LIBNEWT = libnewt.a
-LIBNEWTSH = libnewt.so.$(VERSION)
+LIBNEWTSH = libnewt.so.$(SONAME)
LIBNEWTSONAME = libnewt.so.$(SONAME)
LIBOBJS = newt.o button.o form.o checkbox.o entry.o label.o listbox.o \
scrollbar.o textbox.o scale.o grid.o windows.o buttonbar.o \
checkboxtree.o
-SHCFLAGS = -fPIC
+LIBSHOBJS = newt.So button.So form.So checkbox.So entry.So label.So listbox.So \
+ scrollbar.So textbox.So scale.So grid.So windows.So buttonbar.So \
+ checkboxtree.So
-prefix = /usr
+SHCFLAGS = ${CFLAGS} -fPIC
+
+prefix = ${PREFIX}
includedir = $(prefix)/include
libdir = $(prefix)/lib
bindir = $(prefix)/bin
@@ -38,44 +45,41 @@
#--------------------------------------
-SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS))
+SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS)) $(subst .So,.c,$(LIBSHOBJS))
-SHAREDDIR = shared
-SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS))
+.SUFFIXES: .o .So
-ifeq (.depend,$(wildcard .depend))
-TARGET=$(PROGS)
-else
-TARGET=depend $(PROGS)
-endif
+SHAREDOBJS = ${LIBSHOBJS}
-all: $(TARGET) _snackmodule.so
+all: $(TARGET)
test: $(TESTOBJS) $(LIBNEWT)
- gcc -g -o test $(TESTOBJS) $(LIBNEWT) $(LIBS) -static
+ ${CC} -g ${LDFLAGS} -o test $(TESTOBJS) $(LIBNEWT) $(LIBS) -static
testgrid: testgrid.o $(LIBNEWT)
- gcc -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
+ ${CC} -g ${LDFLAGS} -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
testtree: testtree.o $(LIBNEWT)
- gcc -g -o testtree testtree.o $(LIBNEWT) $(LIBS)
+ ${CC} -g ${LDFLAGS} -o testtree testtree.o $(LIBNEWT) $(LIBS)
_snackmodule.so: snackmodule.c $(LIBNEWTSH)
for ver in $(PYTHONVERS) ; do \
if [ ! -f "$$ver/_snackmodule.so" -o $(LIBNEWTSH) -nt "$$ver/_snackmodule.so" ]; then \
mkdir -p $$ver ;\
- gcc $(CFLAGS) -I/usr/include/$$ver -fPIC -c -o $$ver/snackmodule.o snackmodule.c ;\
- gcc --shared $(SHCFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L . $(LIBNEWTSH) ;\
+ ${CC} $(CFLAGS) -I/usr/include/$$ver -fPIC -c -o $$ver/snackmodule.o snackmodule.c ;\
+ ${CC} --shared $(SHCFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L . $(LIBNEWTSH) ;\
fi ; \
done
whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
- gcc -g -o whiptail $(NDIALOGOBJS) -L . $(LIBNEWTSH) $(LIBS) -lpopt
+ ${CC} -g ${LDFLAGS} -o whiptail $(NDIALOGOBJS) -L . $(LIBNEWTSH) $(LIBS) -lpopt
whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH)
- gcc -shared $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . $(LIBNEWTSH) -ltcl -lslang -lpopt -lm
+ ${CC} -shared ${LDFLAGS} $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . $(LIBNEWTSH) ${LIBS}
-$(LIBNEWT): $(LIBNEWT)($(LIBOBJS))
+$(LIBNEWT): $(LIBOBJS)
+ ar q ${LIBNEWT} ${LIBOBJS}
+ ranlib ${LIBNEWT}
newt.o: newt.c Makefile
$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
@@ -90,20 +94,16 @@
depend:
$(CPP) $(CFLAGS) -M $(SOURCES) > .depend
-$(SHAREDDIR):
- mkdir -p $(SHAREDDIR)
-
sharedlib: $(LIBNEWTSH)
-$(LIBNEWTSH): $(SHAREDDIR) $(SHAREDOBJS)
- gcc -shared -o $(LIBNEWTSH) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(SHLIBS)
+$(LIBNEWTSH): $(SHAREDOBJS)
+ ${CC} -shared ${LDFLAGS} -o $(LIBNEWTSH) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(SHLIBS)
-$(SHAREDDIR)/%.o : %.c
+.c.So:
$(CC) $(SHCFLAGS) -c $(CFLAGS) -o $@ $<
-$(SHAREDDIR)/newt.o: newt.c Makefile
- $(CC) $(SHCFLAGS) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
-
+newt.So: newt.c Makefile
+ $(CC) $(SHCFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
install: $(LIBNEWT) install-sh whiptail
[ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir)
@@ -113,16 +113,11 @@
install -m 644 $(LIBNEWT) $(instroot)/$(libdir)
install -s -m 755 whiptail $(instroot)/$(bindir)
-install-sh: sharedlib $(WHIPTCLSO) _snackmodule.so
+install-sh: sharedlib $(WHIPTCLSO)
[ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
install -s -m 755 $(LIBNEWTSH) $(instroot)/$(libdir)
ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/libnewt.so
[ -n "$(WHIPTCLSO)" ] && install -s -m 755 whiptcl.so $(instroot)/$(libdir) || :
- for ver in $(PYTHONVERS) ; do \
- [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
- install -s -m 755 $$ver/_snackmodule.so $(instroot)/$(libdir)/$$ver/site-packages ;\
- install -m 755 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
- done
configure: configure.in
autoconf
@@ -140,7 +135,3 @@
@rm -f /tmp/newt-$(VERSION).tar.gz
@echo " "
@echo "The final archive is ./newt-$(VERSION).tar.gz."
-
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
|