File: Makefile.in

package info (click to toggle)
newt 0.52.17-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,676 kB
  • ctags: 2,049
  • sloc: ansic: 9,249; python: 711; makefile: 259; sh: 9
file content (185 lines) | stat: -rw-r--r-- 6,116 bytes parent folder | download
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
LIBS = -lslang @LIBS@
LIBTCL = @TCL_LIB_FLAG@

CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang @CPPFLAGS@ 
GNU_LD = @GNU_LD@

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

PYTHONVERS = $(shell pyversions --supported; py3versions --supported)
PYTHONDBG := $(addsuffix -dbg, $(PYTHONVERS))
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) _snack.$(SOEXT) whiptcl.$(SOEXT)

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)
	@[ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) $(PYTHONDBG) ; do \
		pyconfig=$$ver-config; \
		mkdir -p $$ver; \
		PCFLAGS=`$$pyconfig --cflags`; \
		PIFLAGS=`$$pyconfig --includes`; \
		PLDFLAGS=`$$pyconfig --ldflags  | sed -e 's/\-lpython[0-9.]*[_a-z]*//'`; \
		PLFLAGS=`$$pyconfig --libs  | sed -e 's/\-lpython[0-9.]*[_a-z]*//'`; \
		echo $(CC) $(SHCFLAGS) $(CPPFLAGS) $(CFLAGS) -fPIC $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
		$(CC) $(SHCFLAGS) $(CPPFLAGS) $(CFLAGS) $$PIFLAGS $$PCFLAGS -fPIC -c -o $$ver/snack.o snack.c; \
		echo $(CC) --shared -fPIC $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L.  -lnewt $(LIBS); \
		$(CC) --shared -fPIC $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L.  -lnewt $(LIBS); \
	done || :
	touch $@

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

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

$(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:
	$(CPP) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend

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

sharedlib: $(LIBNEWTSH)

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

$(SHAREDDIR)/%.o : %.c
	$(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)/$(includedir) ] || install -m 755 -d $(instroot)/$(includedir)
	[ -d $(instroot)/$(man1dir) ] || install -m 755 -d $(instroot)/$(man1dir)
	[ -d $(instroot)/$(pkgconfigdir) ] || install -m 755 -d $(instroot)/$(pkgconfigdir)
	install -m 644 newt.h $(instroot)/$(includedir)
	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 -m 644 libnewt.pc $(instroot)/$(pkgconfigdir)

install-sh: sharedlib $(WHIPTCLSO) _snack.$(SOEXT)
	[ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
	install -m 755 $(LIBNEWTSH) $(instroot)/$(libdir)
	ln -sf $(LIBNEWTSONAME) $(instroot)/$(libdir)/libnewt.$(SOEXT)
	ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME)
	[ -n "$(WHIPTCLSO)" ] && install -m 755 whiptcl.$(SOEXT) $(instroot)/$(libdir) || :
	[ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) ; do \
	   [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
	   install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$(libdir)/$$ver/site-packages ;\
	   install -m 644 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
	done || :

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 .tx .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

upload-archive:
	scp -p newt-$(VERSION).tar.gz fedorahosted.org:newt

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