2
LIBTCL = @TCL_LIB_FLAG@
8
CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang @CPPFLAGS@
12
TAG = r$(subst .,-,$(VERSION))
15
PYTHONVERS = $(shell pyversions --supported)
16
WHIPTCLSO = @WHIPTCLSO@
18
PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey
19
TESTOBJS = test.o testgrid.o testtree.o showchars.o showkey.o
20
NDIALOGOBJS = whiptail.o dialogboxes.o
21
WHIPTCLOBJS = shared/whiptcl.o shared/dialogboxes.o
23
LIBNEWTSH = libnewt.so.$(VERSION)
24
LIBNEWTSONAME = libnewt.so.$(SONAME)
25
LIBOBJS = newt.o button.o form.o checkbox.o entry.o label.o listbox.o \
26
scrollbar.o textbox.o scale.o grid.o windows.o buttonbar.o \
30
SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver -Wl,-soname,$(LIBNEWTSONAME)
38
includedir = @includedir@
39
exec_prefix = @exec_prefix@
43
datarootdir = @datarootdir@
45
man1dir = $(mandir)/man1
46
pkgconfigdir = $(libdir)/pkgconfig
47
instroot ?= $(DESTDIR)
49
#--------------------------------------
51
SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS))
54
SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS))
56
ifeq (.depend,$(wildcard .depend))
59
TARGET=depend $(PROGS)
62
all: $(TARGET) _snackmodule.so whiptcl.so
64
test: test.o $(LIBNEWT)
65
$(CC) -g -o test test.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
67
testgrid: testgrid.o $(LIBNEWT)
68
$(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
70
testtree: testtree.o $(LIBNEWT)
71
$(CC) -g -o testtree testtree.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
73
showchars: showchars.o $(LIBNEWT)
74
$(CC) -g -o showchars showchars.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
76
showkey: showkey.o $(LIBNEWT)
77
$(CC) -g -o showkey showkey.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
79
_snackmodule.so: snackmodule.c $(LIBNEWTSH)
80
[ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) ; do \
82
PCFLAGS=`$$ver-config --cflags`; \
83
PIFLAGS=`$$ver-config --includes`; \
84
PLDFLAGS=`$$ver-config --ldflags`; \
85
PLFLAGS=`$$ver-config --libs`; \
86
$(CC) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snackmodule.o snackmodule.c ;\
87
$(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L. -lnewt $(LIBS);\
88
$(CC) $(subst -O2,-O0,$(CFLAGS)) -I/usr/include/$${ver}_d -fPIC -c -o $$ver/snackmodule_d.o snackmodule.c ;\
89
$(CC) --shared $(SHCFLAGS) -o $$ver/_snackmodule_d.so $$ver/snackmodule_d.o -L . -lnewt ;\
93
whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
94
$(CC) -g -o whiptail $(NDIALOGOBJS) -L. $(LDFLAGS) -lnewt $(LIBS) -lpopt
96
whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH)
97
$(CC) -shared $(SHCFLAGS) $(LDFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L. -lnewt $(LIBTCL) -lpopt $(LIBS)
99
$(LIBNEWT): $(LIBOBJS)
102
newt.o $(SHAREDDIR)/newt.o: newt.c Makefile
108
rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWTSH) \
109
$(SHAREDDIR)/*.o *.so*
112
$(CPP) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend
115
mkdir -p $(SHAREDDIR)
117
sharedlib: $(LIBNEWTSH)
119
$(LIBNEWTSH): $(SHAREDDIR) $(SHAREDOBJS)
120
$(CC) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) $(SHAREDOBJS) $(LDFLAGS) $(LIBS)
121
ln -fs $(LIBNEWTSONAME) libnewt.so
122
ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME)
124
$(SHAREDDIR)/%.o : %.c
125
$(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
127
install: $(LIBNEWT) install-sh whiptail
128
[ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir)
129
[ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
130
[ -d $(instroot)/$(includedir) ] || install -m 755 -d $(instroot)/$(includedir)
131
[ -d $(instroot)/$(man1dir) ] || install -m 755 -d $(instroot)/$(man1dir)
132
[ -d $(instroot)/$(pkgconfigdir) ] || install -m 755 -d $(instroot)/$(pkgconfigdir)
133
install -m 644 newt.h $(instroot)/$(includedir)
134
install -m 644 $(LIBNEWT) $(instroot)/$(libdir)
135
install -m 755 whiptail $(instroot)/$(bindir)
136
install -m 644 whiptail.1 $(instroot)/$(man1dir)
137
make -C po datadir=$(instroot)/$(datadir) install
138
install -m 644 libnewt.pc $(instroot)/$(pkgconfigdir)
140
install-sh: sharedlib $(WHIPTCLSO) _snackmodule.so
141
[ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
142
install -m 755 $(LIBNEWTSH) $(instroot)/$(libdir)
143
ln -sf $(LIBNEWTSONAME) $(instroot)/$(libdir)/libnewt.so
144
ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME)
145
[ -n "$(WHIPTCLSO)" ] && install -m 755 whiptcl.so $(instroot)/$(libdir) || :
146
[ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) ; do \
147
[ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
148
install -m 755 $$ver/_snackmodule.so $(instroot)/$(libdir)/$$ver/site-packages ;\
149
install -m 755 $$ver/_snackmodule_d.so $(instroot)/$(libdir)/$$ver/site-packages ;\
150
install -m 644 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
154
echo "You need to rerun ./configure before continuing"
157
create-archive: Makefile
158
@rm -rf /tmp/newt-$(VERSION)
159
@git archive --prefix=newt-$(VERSION)/ $(TAG) | tar x -C /tmp
160
@cd /tmp/newt-$(VERSION) && ./autogen.sh && rm -rf autom4te.cache .tx
161
@cd /tmp; tar czSpf newt-$(VERSION).tar.gz newt-$(VERSION)
162
@rm -rf /tmp/newt-$(VERSION)
163
@cp /tmp/newt-$(VERSION).tar.gz .
164
@rm -f /tmp/newt-$(VERSION).tar.gz
166
@echo "The final archive is ./newt-$(VERSION).tar.gz."
168
tag-archive: Makefile
171
archive: tag-archive create-archive
173
ifeq (.depend,$(wildcard .depend))