LIBS = -lslang LIBTCL = -ltcl8.4 CC = @CC@ CPP = @CPP@ CFLAGS = @CFLAGS@ CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang @CPPFLAGS@ SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver VERSION = @VERSION@ CVSTAG = r$(subst .,-,$(VERSION)) CVSROOT = $(shell cat CVS/Root) SONAME = @SONAME@ PYTHONVERS = @PYTHONVERS@ WHIPTCLSO = @WHIPTCLSO@ PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey TESTOBJS = test.o testgrid.o testtree.o showchars.o showkey.o NDIALOGOBJS = whiptail.o dialogboxes.o WHIPTCLOBJS = shared/whiptcl.o shared/dialogboxes.o LIBNEWT = libnewt.a LIBNEWTSH = libnewt.so.$(VERSION) 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 prefix = @prefix@ includedir = @includedir@ exec_prefix = @exec_prefix@ libdir = @libdir@ bindir = @bindir@ datadir = @datadir@ mandir = @mandir@ man1dir = $(mandir)/man1 #-------------------------------------- SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS)) SHAREDDIR = shared SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS)) ifeq (.depend,$(wildcard .depend)) TARGET=$(PROGS) else TARGET=depend $(PROGS) endif all: $(TARGET) _snackmodule.so test: test.o $(LIBNEWT) $(CC) -g -o test test.o $(LIBNEWT) $(LIBS) testgrid: testgrid.o $(LIBNEWT) $(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS) testtree: testtree.o $(LIBNEWT) $(CC) -g -o testtree testtree.o $(LIBNEWT) $(LIBS) showchars: showchars.o $(LIBNEWT) $(CC) -g -o showchars showchars.o $(LIBNEWT) $(LIBS) showkey: showkey.o $(LIBNEWT) $(CC) -g -o showkey showkey.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 ;\ $(CC) $(CFLAGS) -I/usr/include/$$ver $(SHCFLAGS) -c -o $$ver/snackmodule.o snackmodule.c ;\ $(CC) --shared $(SHCFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L . -lnewt -lslang ;\ fi ; \ done touch $@ whiptail: $(NDIALOGOBJS) $(LIBNEWTSH) $(CC) -g -o whiptail $(NDIALOGOBJS) -L . -lnewt $(LIBS) -lpopt whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH) $(CC) -shared $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . -lnewt $(LIBTCL) -lslang -lpopt -lm $(LIBNEWT): $(LIBOBJS) ar rv $@ $^ newt.o $(SHAREDDIR)/newt.o: newt.c Makefile veryclean: clean rm -f .depend clean: rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWTSH) \ $(SHAREDDIR)/*.o *.so* depend: $(CPP) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend $(SHAREDDIR): mkdir -p $(SHAREDDIR) sharedlib: $(LIBNEWTSH) $(LIBNEWTSH): $(SHAREDDIR) $(SHAREDOBJS) $(CC) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(LIBS) ln -fs $(LIBNEWTSONAME) libnewt.so ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME) $(SHAREDDIR)/%.o : %.c $(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $< install: $(LIBNEWT) install-sh whiptail [ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir) [ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir) [ -d $(instroot)/$(includedir) ] || install -m 755 -d $(instroot)/$(includedir) [ -d $(instroot)/$(man1dir) ] || install -m 755 -d $(instroot)/$(man1dir) install -m 644 newt.h $(instroot)/$(includedir) install -m 644 $(LIBNEWT) $(instroot)/$(libdir) install -m 755 whiptail $(instroot)/$(bindir) install -m 644 whiptail.1 $(instroot)/$(man1dir) make -C po datadir=$(instroot)/$(datadir) install install-sh: sharedlib $(WHIPTCLSO) _snackmodule.so [ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir) install -m 755 $(LIBNEWTSH) $(instroot)/$(libdir) ln -sf $(LIBNEWTSONAME) $(instroot)/$(libdir)/libnewt.so ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME) [ -n "$(WHIPTCLSO)" ] && install -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 -m 755 $$ver/_snackmodule.so $(instroot)/$(libdir)/$$ver/site-packages ;\ install -m 755 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\ done configure: configure.ac newt.spec autoconf echo "You need to rerun ./configure before continuing" exit 1 create-archive: configure @rm -rf /tmp/newt-$(VERSION) /tmp/newt @cd /tmp; cvs -d $(CVSROOT) export -r$(CVSTAG) newt; mv newt newt-$(VERSION) @cd /tmp/newt-$(VERSION); ./autogen.sh @cd /tmp; tar czSpf newt-$(VERSION).tar.gz newt-$(VERSION) @rm -rf /tmp/newt-$(VERSION) @cp /tmp/newt-$(VERSION).tar.gz . @rm -f /tmp/newt-$(VERSION).tar.gz @echo " " @echo "The final archive is ./newt-$(VERSION).tar.gz." tag-archive: @cvs tag -F $(CVSTAG) archive: tag-archive create-archive ifeq (.depend,$(wildcard .depend)) include .depend endif