1 LIBS
= -lslang
-lm
#-lefence
2 SHLIBS
= -lslang
-lm
-lc
4 GPM_SUPPORT
=@gpm_support@
6 CFLAGS
= $(RPM_OPT_FLAGS
) -Wall
-I
/usr
/include/slang
-D_GNU_SOURCE
7 ifeq ($(RPM_OPT_FLAGS
),)
12 CVSTAG
= r
$(subst .
,-,$(VERSION
))
15 PYTHONVERS
= $(shell ls
-d
/usr
/include/python
* | sed
"s|/usr/include/||g")
20 PROGS
= test whiptail
$(WHIPTCLSO
) testgrid testtree
22 NDIALOGOBJS
= whiptail.o dialogboxes.o
23 WHIPTCLOBJS
= whiptcl.o dialogboxes.o
25 LIBNEWTSH
= libnewt.so.
$(VERSION
)
26 LIBNEWTSONAME
= libnewt.so.
$(SONAME
)
27 LIBOBJS
= newt.o button.o form.o checkbox.o entry.o label.o listbox.o \
28 scrollbar.o textbox.o scale.o grid.o windows.o buttonbar.o \
34 includedir = $(prefix)/include
35 libdir = $(prefix)/lib
36 bindir = $(prefix)/bin
37 ARCHNAME
= $(shell uname
-m | sed
's/i.86/i386/')
39 #--------------------------------------
41 SOURCES
= $(subst .o
,.c
,$(TESTOBJS
) $(NDIALOGOBJS
) $(LIBOBJS
))
44 SHAREDOBJS
= $(patsubst %,$(SHAREDDIR
)/%, $(LIBOBJS
))
46 ifeq (.depend
,$(wildcard .depend
))
49 TARGET
=depend
$(PROGS
)
52 all: $(TARGET
) _snackmodule.so
54 test: $(TESTOBJS
) $(LIBNEWT
)
55 gcc
-g
-o
test $(TESTOBJS
) $(LIBNEWT
) $(LIBS
) -static
57 testgrid
: testgrid.o
$(LIBNEWT
)
58 gcc
-g
-o testgrid testgrid.o
$(LIBNEWT
) $(LIBS
)
60 testtree
: testtree.o
$(LIBNEWT
)
61 gcc
-g
-o testtree testtree.o
$(LIBNEWT
) $(LIBS
)
63 _snackmodule.so
: snackmodule.c
$(LIBNEWTSH
)
64 for ver in
$(PYTHONVERS
) ; do \
65 if
[ ! -f
"$$ver/_snackmodule.so" -o
$(LIBNEWTSH
) -nt
"$$ver/_snackmodule.so" ]; then \
67 gcc
$(CFLAGS
) -I
/usr
/include/$$ver -fPIC
-c
-o
$$ver/snackmodule.o snackmodule.c
;\
68 gcc
--shared
$(SHCFLAGS
) -o
$$ver/_snackmodule.so
$$ver/snackmodule.o
-L .
$(LIBNEWTSH
) ;\
72 whiptail
: $(NDIALOGOBJS
) $(LIBNEWTSH
)
73 gcc
-g
-o whiptail
$(NDIALOGOBJS
) -L .
$(LIBNEWTSH
) $(LIBS
) -lpopt
75 whiptcl.so
: $(WHIPTCLOBJS
) $(LIBNEWTSH
)
76 gcc
-shared
$(SHCFLAGS
) -o whiptcl.so
$(WHIPTCLOBJS
) -L .
$(LIBNEWTSH
) -ltcl
-lslang
-lpopt
-lm
78 $(LIBNEWT
): $(LIBOBJS
)
81 newt.o
: newt.c Makefile
82 $(CC
) $(CFLAGS
) -DVERSION
=\"$(VERSION
)\" -c
-o
$@
$<
88 rm -f
$(PROGS
) *.o
$(LIBNEWT
) core
$(LIBNEWTSH
) \
92 $(CPP
) $(CFLAGS
) -M
$(SOURCES
) > .depend
97 sharedlib
: $(LIBNEWTSH
)
99 $(LIBNEWTSH
): $(SHAREDDIR
) $(SHAREDOBJS
)
100 gcc
-shared
-o
$(LIBNEWTSH
) -Wl
,-soname
,$(LIBNEWTSONAME
) $(SHAREDOBJS
) $(SHLIBS
)
102 $(SHAREDDIR
)/%.o
: %.c
103 $(CC
) $(SHCFLAGS
) -c
$(CFLAGS
) -o
$@
$<
105 $(SHAREDDIR
)/newt.o
: newt.c Makefile
106 $(CC
) $(SHCFLAGS
) $(CFLAGS
) -DVERSION
=\"$(VERSION
)\" -c
-o
$@
$<
109 install: $(LIBNEWT
) install-sh whiptail
110 [ -d
$(instroot
)/$(bindir) ] ||
install -m
755 -d
$(instroot
)/$(bindir)
111 [ -d
$(instroot
)/$(libdir) ] ||
install -m
755 -d
$(instroot
)/$(libdir)
112 [ -d
$(instroot
)/$(includedir) ] ||
install -m
755 -d
$(instroot
)/$(includedir)
113 install -m
644 newt.h
$(instroot
)/$(includedir)
114 install -m
644 $(LIBNEWT
) $(instroot
)/$(libdir)
115 install -m
755 whiptail
$(instroot
)/$(bindir)
117 install-sh
: sharedlib
$(WHIPTCLSO
) _snackmodule.so
118 [ -d
$(instroot
)/$(libdir) ] ||
install -m
755 -d
$(instroot
)/$(libdir)
119 install -m
755 $(LIBNEWTSH
) $(instroot
)/$(libdir)
120 ln
-sf
$(LIBNEWTSH
) $(instroot
)/$(libdir)/libnewt.so
121 [ -n
"$(WHIPTCLSO)" ] && install -m
755 whiptcl.so
$(instroot
)/$(libdir) ||
:
122 for ver in
$(PYTHONVERS
) ; do \
123 [ -d
$(instroot
)/$(libdir)/$$ver/site-packages
] ||
install -m
755 -d
$(instroot
)/$(libdir)/$$ver/site-packages
;\
124 install -m
755 $$ver/_snackmodule.so
$(instroot
)/$(libdir)/$$ver/site-packages
;\
125 install -m
755 snack.py
$(instroot
)/$(libdir)/$$ver/site-packages
;\
128 configure
: configure.in
130 echo
"You need to rerun ./configure before continuing"
134 @cvs tag
-F
$(CVSTAG
)
135 @
rm -rf
/tmp
/newt-
$(VERSION
) /tmp
/newt
136 @cd
/tmp
; cvs
export -r
$(CVSTAG
) newt
; mv newt newt-
$(VERSION
)
137 @cd
/tmp
/newt-
$(VERSION
); autoconf
138 @cd
/tmp
; tar czSpf newt-
$(VERSION
).
tar.gz newt-
$(VERSION
)
139 @
rm -rf
/tmp
/newt-
$(VERSION
)
140 @cp
/tmp
/newt-
$(VERSION
).
tar.gz .
141 @
rm -f
/tmp
/newt-
$(VERSION
).
tar.gz
143 @echo
"The final archive is ./newt-$(VERSION).tar.gz."
145 ifeq (.depend
,$(wildcard .depend
))