File: Makefile.in

package info (click to toggle)
newt 0.52.25-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,196 kB
  • sloc: ansic: 9,336; python: 713; makefile: 276; sh: 37; xml: 7
file content (205 lines) | stat: -rw-r--r-- 6,321 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
LIBS = -lslang @LIBS@
LIBTCL = @TCL_LIB_FLAG@

CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
CPPFLAGS = -D_GNU_SOURCE @CPPFLAGS@
GNU_LD = @GNU_LD@

VERSION = @VERSION@
TAG = r$(subst .,-,$(VERSION))
SONAME = @SONAME@
SOEXT = so

PYTHONVERS = @PYTHONVERS@
PYTHONDBG := $(addsuffix -dbg, $(PYTHONVERS))
ifeq ($(PYTHONVERS),)
SNACKSO =
else
SNACKSO = _snack.$(SOEXT)
endif

WHIPTCLLIB = @WHIPTCLLIB@
ifneq ($(WHIPTCLLIB),)
WHIPTCLSO = $(WHIPTCLLIB).$(SOEXT)
else
WHIPTCLSO =
endif

PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey
TESTOBJS = test.o testgrid.o testtree.o showchars.o showkey.o
NDIALOGOBJS = whiptail.o dialogboxes.o
WHIPTCLOBJS = shared/whiptcl.o shared/dialogboxes.o
LIBNEWT = libnewt.a
LIBNEWTSH = libnewt.$(SOEXT).$(VERSION)
LIBNEWTSONAME = libnewt.$(SOEXT).$(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

ifneq ($(GNU_LD),)
SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver -Wl,-soname,$(LIBNEWTSONAME)
else
SHLIBFLAGS=
endif

SHCFLAGS = -fPIC

prefix = @prefix@
includedir = @includedir@
exec_prefix = @exec_prefix@
libdir = @libdir@
bindir = @bindir@
datadir = @datadir@
datarootdir = @datarootdir@
mandir = @mandir@
man1dir = $(mandir)/man1
pkgconfigdir = $(libdir)/pkgconfig
instroot ?= $(DESTDIR)

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

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

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

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

all:	$(TARGET) $(SNACKSO) $(WHIPTCLSO)

test:	test.o $(LIBNEWT)
	$(CC) -g -o test test.o $(LIBNEWT) $(LDFLAGS) $(LIBS)

testgrid:	testgrid.o $(LIBNEWT)
	$(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LDFLAGS) $(LIBS)

testtree:	testtree.o $(LIBNEWT)
	$(CC) -g -o testtree testtree.o $(LIBNEWT) $(LDFLAGS) $(LIBS)

showchars:	showchars.o $(LIBNEWT)
	$(CC) -g -o showchars showchars.o $(LIBNEWT) $(LDFLAGS) $(LIBS)

showkey:	showkey.o $(LIBNEWT)
	$(CC) -g -o showkey showkey.o $(LIBNEWT) $(LDFLAGS) $(LIBS)

_snack.$(SOEXT):   snack.c $(LIBNEWTSH)
ifneq ($(PYTHONVERS),)
	@for ver in $(PYTHONVERS) $(PYTHONDBG) ; do \
		pyconfig=`command -v $(ac_tool_prefix)$$ver-config || echo $$ver-config`; \
		if ! $$pyconfig --cflags > /dev/null 2>&1 && \
				python-config --cflags > /dev/null 2>&1; then \
			echo $$pyconfig not found, using python-config; \
			pyconfig=python-config; \
		fi; \
		mkdir -p $$ver; \
		PCFLAGS=`$$pyconfig --cflags`; \
		PLDFLAGS=`$$pyconfig --ldflags --embed || $$pyconfig --ldflags`; \
		echo $(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PCFLAGS -c -o $$ver/snack.o snack.c; \
		$(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PCFLAGS -c -o $$ver/snack.o snack.c; \
		echo $(CC) --shared $(LDFLAGS) $$PLDFLAGS -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \
		$(CC) --shared $(LDFLAGS) $$PLDFLAGS -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \
	done
endif
	touch $@

whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
	$(CC) -g -o whiptail $(NDIALOGOBJS) -L. $(LDFLAGS) -lnewt $(LIBS) -lpopt

ifneq ($(WHIPTCLSO),)
$(WHIPTCLSO): $(WHIPTCLOBJS) $(LIBNEWTSH)
	$(CC) -shared $(SHCFLAGS) $(LDFLAGS) -o whiptcl.$(SOEXT) $(WHIPTCLOBJS) -L. -lnewt  $(LIBTCL) -lpopt $(LIBS)
endif

$(LIBNEWT): $(LIBOBJS)
	ar rv $@ $^

newt.o $(SHAREDDIR)/newt.o: newt.c Makefile

veryclean: clean
	rm -f .depend *.pc

clean:
	rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWTSH)  \
		$(SHAREDDIR)/*.o *.$(SOEXT)*

depend:
	$(CC) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend

sharedlib: $(LIBNEWTSH)

$(LIBNEWTSH): $(SHAREDOBJS)
	$(CC) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) $(SHAREDOBJS) $(LDFLAGS) $(LIBS)
	ln -fs $(LIBNEWTSONAME) libnewt.$(SOEXT)
	ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME)

$(SHAREDDIR)/%.o : %.c
	@mkdir -p $(SHAREDDIR)
	$(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)/$(man1dir) ] || install -m 755 -d $(instroot)/$(man1dir)
	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 install-tcl install-py
	[ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
	[ -d $(instroot)/$(includedir) ] || install -m 755 -d $(instroot)/$(includedir)
	[ -d $(instroot)/$(pkgconfigdir) ] || install -m 755 -d $(instroot)/$(pkgconfigdir)
	install -m 644 newt.h $(instroot)/$(includedir)
	install -m 755 $(LIBNEWTSH) $(instroot)/$(libdir)
	ln -sf $(LIBNEWTSONAME) $(instroot)/$(libdir)/libnewt.$(SOEXT)
	ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME)
	install -m 644 libnewt.pc $(instroot)/$(pkgconfigdir)

install-tcl: $(WHIPTCLSO)
ifneq ($(WHIPTCLSO),)
	[ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
	install -m 755 $(WHIPTCLSO) $(instroot)/$(libdir)
endif

install-py: _snack.$(SOEXT)
ifneq ($(PYTHONVERS),)
	@for ver in $(PYTHONVERS); do \
		PLATLIB=`$$ver -c "import sysconfig; print(sysconfig.get_path('platlib'))"`; \
		[ -d $(instroot)/$$PLATLIB ] || install -m 755 -d $(instroot)/$$PLATLIB ;\
		echo install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$$PLATLIB;\
		install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$$PLATLIB;\
		echo install -m 644 snack.py $(instroot)/$$PLATLIB;\
		install -m 644 snack.py $(instroot)/$$PLATLIB;\
	done
endif

Makefile: configure.ac
	@echo "You need to rerun ./autogen.sh and ./configure before continuing"
	@exit 1

create-archive: Makefile
	@rm -rf /tmp/newt-$(VERSION)
	@git archive --prefix=newt-$(VERSION)/ $(TAG) | tar x -C /tmp
	@cd /tmp/newt-$(VERSION) && ./autogen.sh && rm -rf autom4te.cache .gitignore
	@cd /tmp; tar c --owner root --group root newt-$(VERSION) | gzip -9 > newt-$(VERSION).tar.gz
	@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."

tag-archive: Makefile
	@git tag $(TAG)

archive: tag-archive create-archive

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