]> git.ipfire.org Git - thirdparty/newt.git/blob - Makefile.in
don't strip the libs
[thirdparty/newt.git] / Makefile.in
1 LIBS = -lslang -lm #-lefence
2 SHLIBS = -lslang -lm -lc
3
4 GPM_SUPPORT=@gpm_support@
5
6 CFLAGS = $(RPM_OPT_FLAGS) -Wall -I/usr/include/slang -D_GNU_SOURCE
7 ifeq ($(RPM_OPT_FLAGS),)
8 CFLAGS += -g
9 endif
10
11 VERSION = @VERSION@
12 CVSTAG = r$(subst .,-,$(VERSION))
13 SONAME = @SONAME@
14
15 PYTHONVERS = $(shell ls -d /usr/include/python* | sed "s|/usr/include/||g")
16
17 WHIPTCLSO=
18 #WHIPTCLSO=whiptcl.so
19
20 PROGS = test whiptail $(WHIPTCLSO) testgrid testtree
21 TESTOBJS = test.o
22 NDIALOGOBJS = whiptail.o dialogboxes.o
23 WHIPTCLOBJS = whiptcl.o dialogboxes.o
24 LIBNEWT = libnewt.a
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 \
29 checkboxtree.o
30
31 SHCFLAGS = -fPIC
32
33 prefix = /usr
34 includedir = $(prefix)/include
35 libdir = $(prefix)/lib
36 bindir = $(prefix)/bin
37 ARCHNAME = $(shell uname -m | sed 's/i.86/i386/')
38
39 #--------------------------------------
40
41 SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS))
42
43 SHAREDDIR = shared
44 SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS))
45
46 ifeq (.depend,$(wildcard .depend))
47 TARGET=$(PROGS)
48 else
49 TARGET=depend $(PROGS)
50 endif
51
52 all: $(TARGET) _snackmodule.so
53
54 test: $(TESTOBJS) $(LIBNEWT)
55 gcc -g -o test $(TESTOBJS) $(LIBNEWT) $(LIBS) -static
56
57 testgrid: testgrid.o $(LIBNEWT)
58 gcc -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
59
60 testtree: testtree.o $(LIBNEWT)
61 gcc -g -o testtree testtree.o $(LIBNEWT) $(LIBS)
62
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 \
66 mkdir -p $$ver ;\
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) ;\
69 fi ; \
70 done
71
72 whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
73 gcc -g -o whiptail $(NDIALOGOBJS) -L . $(LIBNEWTSH) $(LIBS) -lpopt
74
75 whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH)
76 gcc -shared $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . $(LIBNEWTSH) -ltcl -lslang -lpopt -lm
77
78 $(LIBNEWT): $(LIBOBJS)
79 ar rv $@ $^
80
81 newt.o: newt.c Makefile
82 $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
83
84 veryclean: clean
85 rm -f .depend
86
87 clean:
88 rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWTSH) \
89 $(SHAREDOBJS) *.so*
90
91 depend:
92 $(CPP) $(CFLAGS) -M $(SOURCES) > .depend
93
94 $(SHAREDDIR):
95 mkdir -p $(SHAREDDIR)
96
97 sharedlib: $(LIBNEWTSH)
98
99 $(LIBNEWTSH): $(SHAREDDIR) $(SHAREDOBJS)
100 gcc -shared -o $(LIBNEWTSH) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(SHLIBS)
101
102 $(SHAREDDIR)/%.o : %.c
103 $(CC) $(SHCFLAGS) -c $(CFLAGS) -o $@ $<
104
105 $(SHAREDDIR)/newt.o: newt.c Makefile
106 $(CC) $(SHCFLAGS) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
107
108
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)
116
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 ;\
126 done
127
128 configure: configure.in
129 autoconf
130 echo "You need to rerun ./configure before continuing"
131 exit 1
132
133 archive: configure
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
142 @echo " "
143 @echo "The final archive is ./newt-$(VERSION).tar.gz."
144
145 ifeq (.depend,$(wildcard .depend))
146 include .depend
147 endif