-LIBS = -L. -lnewt -lslang -lm #-lefence
+LIBS = -lslang -lm #-lefence
CFLAGS = $(RPM_OPT_FLAGS) -Wall
ifeq ($(RPM_OPT_FLAGS),)
VERSION = 0.8
SONAME = 0
-PROGS = test
-OBJS = test.o
+PROGS = test whiptail
+TESTOBJS = test.o
+NDIALOGOBJS = whiptail.o popt.o
LIBNEWT = libnewt.a
LIBNEWTSH = libnewt.so.$(VERSION)
LIBNEWTSONAME = libnewt.so.$(SONAME)
prefix = /usr
includedir = $(prefix)/include
libdir = $(prefix)/lib
+bindir = $(prefix)/bin
#--------------------------------------
-SOURCES = $(subst .o,.c,$(OBJS) $(LIBOBJS))
+SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS))
SHAREDDIR = shared
SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS))
all: $(TARGET)
-test: $(OBJS) $(LIBNEWT)
- gcc -g -o test $(OBJS) $(LIBS)
+test: $(TESTOBJS) $(LIBNEWT)
+ gcc -g -o test $(TESTOBJS) $(LIBNEWT) $(LIBS)
+
+whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
+ gcc -g -o whiptail $(NDIALOGOBJS) $(LIBNEWTSH) $(LIBS)
$(LIBNEWT): $(LIBNEWT)($(LIBOBJS))
shareddir:
mkdir -p shared
-shared: shareddir $(LIBNEWTSH)
+shared: $(LIBNEWTSH)
-$(LIBNEWTSH): $(SHAREDOBJS)
+$(LIBNEWTSH): shareddir $(SHAREDOBJS)
gcc -shared -o $(LIBNEWTSH) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS)
$(SHAREDDIR)/%.o : %.c
[ -d $(includedir) ] || install -m 755 -d $(includedir)
install -m 644 newt.h $(includedir)
install -m 644 $(LIBNEWT) $(libdir)
+ install -s -m 755 whiptail $(bindir)
install-sh: shared
install -m 755 $(LIBNEWTSH) $(libdir)