]> git.ipfire.org Git - thirdparty/newt.git/blob - Makefile.in
try python-config --ldflags --embed first
[thirdparty/newt.git] / Makefile.in
1 LIBS = -lslang @LIBS@
2 LIBTCL = @TCL_LIB_FLAG@
3
4 CC = @CC@
5 CPP = @CPP@
6 CFLAGS = @CFLAGS@
7 LDFLAGS = @LDFLAGS@
8 CPPFLAGS = -D_GNU_SOURCE @CPPFLAGS@
9 GNU_LD = @GNU_LD@
10
11 VERSION = @VERSION@
12 TAG = r$(subst .,-,$(VERSION))
13 SONAME = @SONAME@
14 SOEXT = so
15
16 PYTHONVERS = @PYTHONVERS@
17 WHIPTCLLIB = @WHIPTCLLIB@
18 ifneq ($(WHIPTCLLIB),)
19 WHIPTCLSO = $(WHIPTCLLIB).$(SOEXT)
20 else
21 WHIPTCLSO =
22 endif
23
24 PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey
25 TESTOBJS = test.o testgrid.o testtree.o showchars.o showkey.o
26 NDIALOGOBJS = whiptail.o dialogboxes.o
27 WHIPTCLOBJS = shared/whiptcl.o shared/dialogboxes.o
28 LIBNEWT = libnewt.a
29 LIBNEWTSH = libnewt.$(SOEXT).$(VERSION)
30 LIBNEWTSONAME = libnewt.$(SOEXT).$(SONAME)
31 LIBOBJS = newt.o button.o form.o checkbox.o entry.o label.o listbox.o \
32 scrollbar.o textbox.o scale.o grid.o windows.o buttonbar.o \
33 checkboxtree.o
34
35 ifneq ($(GNU_LD),)
36 SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver -Wl,-soname,$(LIBNEWTSONAME)
37 else
38 SHLIBFLAGS=
39 endif
40
41 SHCFLAGS = -fPIC
42
43 prefix = @prefix@
44 includedir = @includedir@
45 exec_prefix = @exec_prefix@
46 libdir = @libdir@
47 bindir = @bindir@
48 datadir = @datadir@
49 datarootdir = @datarootdir@
50 mandir = @mandir@
51 man1dir = $(mandir)/man1
52 pkgconfigdir = $(libdir)/pkgconfig
53 instroot ?= $(DESTDIR)
54
55 #--------------------------------------
56
57 SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS))
58
59 SHAREDDIR = shared
60 SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS))
61
62 ifeq (.depend,$(wildcard .depend))
63 TARGET=$(PROGS)
64 else
65 TARGET=depend $(PROGS)
66 endif
67
68 all: $(TARGET) _snack.$(SOEXT)
69
70 test: test.o $(LIBNEWT)
71 $(CC) -g -o test test.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
72
73 testgrid: testgrid.o $(LIBNEWT)
74 $(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
75
76 testtree: testtree.o $(LIBNEWT)
77 $(CC) -g -o testtree testtree.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
78
79 showchars: showchars.o $(LIBNEWT)
80 $(CC) -g -o showchars showchars.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
81
82 showkey: showkey.o $(LIBNEWT)
83 $(CC) -g -o showkey showkey.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
84
85 _snack.$(SOEXT): snack.c $(LIBNEWTSH)
86 @[ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS); do \
87 pyconfig=$$ver-config; \
88 if ! $$pyconfig --cflags > /dev/null 2>&1 && \
89 python-config --cflags > /dev/null 2>&1; then \
90 echo $$pyconfig not found, using python-config; \
91 pyconfig=python-config; \
92 fi; \
93 mkdir -p $$ver; \
94 PCFLAGS=`$$pyconfig --cflags`; \
95 PLDFLAGS=`$$pyconfig --ldflags --embed || $$pyconfig --ldflags`; \
96 echo $(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PCFLAGS -c -o $$ver/snack.o snack.c; \
97 $(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PCFLAGS -c -o $$ver/snack.o snack.c; \
98 echo $(CC) --shared $(LDFLAGS) $$PLDFLAGS -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \
99 $(CC) --shared $(LDFLAGS) $$PLDFLAGS -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \
100 done || :
101 touch $@
102
103 whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
104 $(CC) -g -o whiptail $(NDIALOGOBJS) -L. $(LDFLAGS) -lnewt $(LIBS) -lpopt
105
106 whiptcl.$(SOEXT): $(WHIPTCLOBJS) $(LIBNEWTSH)
107 $(CC) -shared $(SHCFLAGS) $(LDFLAGS) -o whiptcl.$(SOEXT) $(WHIPTCLOBJS) -L. -lnewt $(LIBTCL) -lpopt $(LIBS)
108
109 $(LIBNEWT): $(LIBOBJS)
110 ar rv $@ $^
111
112 newt.o $(SHAREDDIR)/newt.o: newt.c Makefile
113
114 veryclean: clean
115 rm -f .depend *.pc
116
117 clean:
118 rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWTSH) \
119 $(SHAREDDIR)/*.o *.$(SOEXT)*
120
121 depend:
122 $(CC) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend
123
124 sharedlib: $(LIBNEWTSH)
125
126 $(LIBNEWTSH): $(SHAREDOBJS)
127 $(CC) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) $(SHAREDOBJS) $(LDFLAGS) $(LIBS)
128 ln -fs $(LIBNEWTSONAME) libnewt.$(SOEXT)
129 ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME)
130
131 $(SHAREDDIR)/%.o : %.c
132 @mkdir -p $(SHAREDDIR)
133 $(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
134
135 install: $(LIBNEWT) install-sh whiptail
136 [ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir)
137 [ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
138 [ -d $(instroot)/$(man1dir) ] || install -m 755 -d $(instroot)/$(man1dir)
139 install -m 644 $(LIBNEWT) $(instroot)/$(libdir)
140 install -m 755 whiptail $(instroot)/$(bindir)
141 install -m 644 whiptail.1 $(instroot)/$(man1dir)
142 make -C po datadir=$(instroot)/$(datadir) install
143
144 install-sh: sharedlib $(WHIPTCLSO) _snack.$(SOEXT)
145 [ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
146 [ -d $(instroot)/$(includedir) ] || install -m 755 -d $(instroot)/$(includedir)
147 [ -d $(instroot)/$(pkgconfigdir) ] || install -m 755 -d $(instroot)/$(pkgconfigdir)
148 install -m 644 newt.h $(instroot)/$(includedir)
149 install -m 755 $(LIBNEWTSH) $(instroot)/$(libdir)
150 ln -sf $(LIBNEWTSONAME) $(instroot)/$(libdir)/libnewt.$(SOEXT)
151 ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME)
152 [ -n "$(WHIPTCLSO)" ] && install -m 755 whiptcl.$(SOEXT) $(instroot)/$(libdir) || :
153 [ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) ; do \
154 [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
155 install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$(libdir)/$$ver/site-packages ;\
156 install -m 644 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
157 done || :
158 install -m 644 libnewt.pc $(instroot)/$(pkgconfigdir)
159
160 Makefile: configure.ac
161 @echo "You need to rerun ./autogen.sh and ./configure before continuing"
162 @exit 1
163
164 create-archive: Makefile
165 @rm -rf /tmp/newt-$(VERSION)
166 @git archive --prefix=newt-$(VERSION)/ $(TAG) | tar x -C /tmp
167 @cd /tmp/newt-$(VERSION) && ./autogen.sh && rm -rf autom4te.cache .gitignore
168 @cd /tmp; tar c --owner root --group root newt-$(VERSION) | gzip -9 > newt-$(VERSION).tar.gz
169 @rm -rf /tmp/newt-$(VERSION)
170 @cp /tmp/newt-$(VERSION).tar.gz .
171 @rm -f /tmp/newt-$(VERSION).tar.gz
172 @echo " "
173 @echo "The final archive is ./newt-$(VERSION).tar.gz."
174
175 tag-archive: Makefile
176 @git tag $(TAG)
177
178 archive: tag-archive create-archive
179
180 ifeq (.depend,$(wildcard .depend))
181 include .depend
182 endif