-LIBS = -lslang -lm -ldl #-lefence
-SHLIBS = -lslang -lm -dl -lc
+LIBS = -lslang
LIBTCL = -ltcl8.4
-GPM_SUPPORT=@gpm_support@
-CFLAGS = $(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE -g -O2 -DUTF8 -fPIC -I/usr/include/slang
+CC = @CC@
+CPP = @CPP@
+CFLAGS = @CFLAGS@
+CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang @CPPFLAGS@
-SHLIBFLAGS= -Wl,-O1 -Wl,--version-script,newt.0.52.ver
+SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver
VERSION = @VERSION@
CVSTAG = r$(subst .,-,$(VERSION))
+CVSROOT = $(shell cat CVS/Root)
SONAME = @SONAME@
-PYTHONVERS = python2.4
-
-WHIPTCLSO=whiptcl.so
+PYTHONVERS = @PYTHONVERS@
+WHIPTCLSO = @WHIPTCLSO@
PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey
-TESTOBJS = test.o
+TESTOBJS = test.o testgrid.o testtree.o showchars.o showkey.o
NDIALOGOBJS = whiptail.o dialogboxes.o
-WHIPTCLOBJS = whiptcl.o dialogboxes.o
+WHIPTCLOBJS = shared/whiptcl.o shared/dialogboxes.o
LIBNEWT = libnewt.a
LIBNEWTSH = libnewt.so.$(VERSION)
LIBNEWTSONAME = libnewt.so.$(SONAME)
SHCFLAGS = -fPIC
-prefix = /usr
-includedir = $(prefix)/include
-libdir = $(prefix)/lib
-bindir = $(prefix)/bin
-ARCHNAME = $(shell uname -m | sed 's/i.86/i386/')
+prefix = @prefix@
+includedir = @includedir@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+bindir = @bindir@
+datadir = @datadir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
#--------------------------------------
TARGET=depend $(PROGS)
endif
-all: $(TARGET) _snackmodule.so po/stamp-po
-
-po/stamp-po:
- $(MAKE) -C po stamp-po
+all: $(TARGET) _snackmodule.so
-test: $(TESTOBJS) $(LIBNEWT)
- $(CC) -g -o test $(TESTOBJS) $(LIBNEWT) $(LIBS) -static
+test: test.o $(LIBNEWT)
+ $(CC) -g -o test test.o $(LIBNEWT) $(LIBS)
testgrid: testgrid.o $(LIBNEWT)
$(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
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 -fPIC -c -o $$ver/snackmodule.o snackmodule.c ;\
+ $(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
-# Ensure dialogboxes is compiled -fPIC
-dialogboxes.o: dialogboxes.c
- $(CC) $(CFLAGS) $(SHCFLAGS) -c dialogboxes.c
-
-whiptcl.o: whiptcl.c
- $(CC) -I/usr/include/tcl8.4 $(SHCFLAGS) $(CFLAGS) -c whiptcl.c
-
-
$(LIBNEWT): $(LIBOBJS)
ar rv $@ $^
-newt.o: newt.c Makefile
- $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
+newt.o $(SHAREDDIR)/newt.o: newt.c Makefile
veryclean: clean
rm -f .depend
clean:
rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWTSH) \
- $(SHAREDOBJS) *.so*
+ $(SHAREDDIR)/*.o *.so*
depend:
- $(CPP) $(CFLAGS) -M $(SOURCES) > .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) $(SHLIBS)
- ln -fs $(LIBNEWTSH) libnewt.so
+ $(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) -o $@ $<
-
-$(SHAREDDIR)/newt.o: newt.c Makefile
- $(CC) $(SHCFLAGS) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
-
+ $(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 $(LIBNEWTSH) $(instroot)/$(libdir)/libnewt.so
+ 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 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
done
-configure: configure.in
+configure: configure.ac
autoconf
echo "You need to rerun ./configure before continuing"
exit 1
-archive: configure
- @cvs tag -F $(CVSTAG)
+create-archive: configure
@rm -rf /tmp/newt-$(VERSION) /tmp/newt
- @cd /tmp; cvs export -r$(CVSTAG) newt; mv newt newt-$(VERSION)
- @cd /tmp/newt-$(VERSION); autoconf
+ @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 .
@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