File: Makefile.in

package info (click to toggle)
newt 0.50.17-9.6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 572 kB
  • ctags: 1,065
  • sloc: ansic: 7,315; python: 537; makefile: 402; sh: 229
file content (183 lines) | stat: -rw-r--r-- 5,595 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
LIBS = -lslang -lm -ldl #-lefence
SHLIBS = -lslang -lm -ldl -lc
UTF8SHLIBS = -lslang -lm -ldl -lc
LIBTCL = -ltcl8.3

GPM_SUPPORT=@gpm_support@

CFLAGS = $(RPM_OPT_FLAGS) -Wall -I/usr/include/slang
ifeq ($(RPM_OPT_FLAGS),)
CFLAGS += -g -O2 # -I/usr/include/slang
endif

ifeq ("$(BUILDINGUTF8)","true")
CFLAGS += -D_GNU_SOURCE -DUTF8 
endif

VERSION = @VERSION@
CVSTAG = r$(subst .,-,$(VERSION))
SONAME = @SONAME@
PYVER = 2.1

PROGS = testing whiptail whiptcl.so testgrid testtree
TESTOBJS = test.o
NDIALOGOBJS = whiptail.o dialogboxes.o
WHIPTCLOBJS = whiptcl.o dialogboxes.o
LIBNEWT = libnewt.a
LIBNEWTSH = libnewt.so.$(VERSION)
UTF8LIBNEWTSH = libnewt-utf8.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
UTF8SHCFLAGS = $(SHCFLAGS) 

prefix = /usr
includedir = $(prefix)/include
libdir = $(prefix)/lib
bindir = $(prefix)/bin
mandir = $(prefix)/share/man
ARCHNAME = $(shell uname -m | sed 's/i.86/i386/')
pythondir = $(prefix)/lib/python$(PYVER)
pythonbindir = $(prefix)/lib/python$(PYVER)/site-packages

#--------------------------------------

SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS))

SHAREDDIR = shared
SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS))
UTF8SHAREDDIR = utf8shared
UTF8SHAREDOBJS = $(patsubst %,$(UTF8SHAREDDIR)/%, $(LIBOBJS))

ifeq (.depend,$(wildcard .depend))
TARGET=$(PROGS)
else
TARGET=depend $(PROGS)
endif

all:	$(TARGET) _snackmodule.so

testing:	$(TESTOBJS) $(LIBNEWT)
	gcc -g -o testing $(TESTOBJS) $(LIBNEWT) $(LIBS)

testgrid:	testgrid.o $(LIBNEWT)
	gcc -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)

testtree:	testtree.o $(LIBNEWT)
	gcc -g -o testtree testtree.o $(LIBNEWT) $(LIBS)

_snackmodule.so:   snackmodule.o $(LIBNEWTSH)
	gcc --shared $(SHCFLAGS) -o _snackmodule.so snackmodule.o -L . $(LIBNEWTSH)

snackmodule.o:   snackmodule.c
	gcc -I/usr/include/python$(PYVER) -fPIC $(CFLAGS) -c snackmodule.c

whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
	gcc -g -o whiptail $(NDIALOGOBJS) -L . $(LIBNEWTSH) $(LIBS) -lpopt

whiptail.1.gz:
	gzip -9c whiptail.1 >whiptail.1.gz

dialogboxes.o:   dialogboxes.c
	gcc -fPIC $(CFLAGS) -c dialogboxes.c

whiptcl.o:   whiptcl.c
	gcc -I/usr/include/tcl8.3 -fPIC $(CFLAGS) -c whiptcl.c

whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH)
	gcc -shared $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . $(LIBNEWTSH) $(LIBTCL) -lslang -lpopt -lm

$(LIBNEWT): $(LIBNEWT)($(LIBOBJS))

newt.o: newt.c Makefile
	$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<

veryclean: clean
	rm -f .depend

clean:
	rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWTSH) $(UTF8LIBNEWTSH) \
		$(SHAREDOBJS) $(UTF8SHAREDOBJS) *.so* whiptail.1.gz

depend:
	$(CPP) $(CFLAGS) -M $(SOURCES) > .depend

$(SHAREDDIR):
	mkdir -p $(SHAREDDIR)

sharedlib: $(LIBNEWTSH)

$(LIBNEWTSH): $(SHAREDDIR) $(SHAREDOBJS)
	gcc -shared -o $(LIBNEWTSH) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(SHLIBS)

$(SHAREDDIR)/%.o : %.c
	$(CC) $(SHCFLAGS) -c $(CFLAGS) -o $@ $<

$(SHAREDDIR)/newt.o: newt.c Makefile
	$(CC) $(SHCFLAGS) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<


$(UTF8SHAREDDIR):
	mkdir -p $(UTF8SHAREDDIR)

utf8sharedlib: $(UTF8LIBNEWTSH)

$(UTF8LIBNEWTSH): $(UTF8SHAREDDIR) $(UTF8SHAREDOBJS)
	gcc -shared -o $(UTF8LIBNEWTSH) -Wl,-soname,$(LIBNEWTSONAME) $(UTF8SHAREDOBJS) $(UTF8SHLIBS)

$(UTF8SHAREDDIR)/%.o : %.c
	$(CC) $(UTF8SHCFLAGS) -c $(CFLAGS) -o $@ $<

$(UTF8SHAREDDIR)/newt.o: newt.c Makefile
	$(CC) $(UTF8SHCFLAGS) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<


install: $(LIBNEWT) install-sh whiptail whiptail.1.gz
	[ -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)/$(mandir) ] || install -m 755 -d $(instroot)/$(mandir)
	[ -d $(instroot)/$(mandir)/man1 ] || install -m 755 -d $(instroot)/$(mandir)/man1
	install -m 644 newt.h $(instroot)/$(includedir)
	install -m 644 $(LIBNEWT) $(instroot)/$(libdir)
	install -s -m 755 whiptail $(instroot)/$(bindir)
	install -m 644 whiptail.1.gz $(instroot)/$(mandir)/man1

install-sh: sharedlib whiptcl.so _snackmodule.so
	[ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
	install -s -m 644 $(LIBNEWTSH) $(instroot)/$(libdir)
	ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/libnewt.so.$(SONAME)
	ln -sf libnewt.so.$(SONAME) $(instroot)/$(libdir)/libnewt.so
	install -s -m 755 whiptcl.so $(instroot)/$(libdir)
	[ -d $(instroot)/$(pythonbindir) ] || install -m 755 -d $(instroot)/$(pythonbindir)
	install -s -m 644 _snackmodule.so $(instroot)/$(pythonbindir)
	install -m 644 snack.py $(instroot)/$(pythonbindir)

install-utf8sh: utf8sharedlib
	[ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
	install -s -m 644 $(UTF8LIBNEWTSH) $(instroot)/$(libdir)
	ln -sf $(UTF8LIBNEWTSH) $(instroot)/$(libdir)/libnewt.so.$(SONAME)

configure:  configure.in
	autoconf
	echo "You need to rerun ./configure before continuing"
	exit 1

archive:    configure
	@cvs tag -F $(CVSTAG)
	@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; 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."

ifeq (.depend,$(wildcard .depend))
include .depend
endif