Include info about the git-revision, if possible.
[screen-lua.git] / src / Makefile.in
blobd8ee8d289934db8984204df1f8d764bca8c9102f
2 # Makefile template for screen
4 # See machine dependant config.h for more configuration options.
7 srcdir = @srcdir@
8 VPATH = @srcdir@
10 DESTDIR =
12 # Where to install screen.
14 prefix = @prefix@
15 exec_prefix = @exec_prefix@
16 datarootdir = @datarootdir@
17 datadir = @datadir@
19 # don't forget to change mandir and infodir in doc/Makefile.
20 bindir = $(exec_prefix)/bin
22 VERSION = @VERSION@
23 SCREEN = screen-$(VERSION)
25 GIT = which git
26 GIT_REV = "`git-describe --always 2>/dev/null`"
27 DEFS = @DEFS@ -DGIT_REV=\"$(GIT_REV)\"
29 ETCSCREENRC = $(prefix)/etc/screenrc
30 SCREENENCODINGS = $(datadir)/screen/utf8encodings
32 CC = @CC@
33 CFLAGS = @CFLAGS@
34 CPPFLAGS = @CPPFLAGS@ -DETCSCREENRC='"$(ETCSCREENRC)"' \
35 -DSCREENENCODINGS='"$(SCREENENCODINGS)"'
36 LDFLAGS = @LDFLAGS@
37 LIBS = @LIBS@
39 CPP=@CPP@
40 CPP_DEPEND=$(CC) -MM
42 INSTALL = @INSTALL@
43 INSTALL_PROGRAM = @INSTALL_PROGRAM@
44 INSTALL_DATA = @INSTALL_DATA@
46 AWK = @AWK@
48 ### Chose some debug configuration options:
49 # -DDEBUG
50 # Turn on really heavy debug output. This is written to
51 # /tmp/debug/{SCREEN,screen}.<pid>. Look at these files and quote
52 # questionable sections when sending bug-reports to the author.
53 # -DDUMPSHADOW
54 # With shadow-pw screen would never dump core. Use this option if
55 # you still want to have a core. Use only for debugging.
56 OPTIONS=
57 #OPTIONS= -DDEBUG
59 SHELL=/bin/sh
61 CFILES= screen.c ansi.c fileio.c mark.c misc.c resize.c socket.c \
62 search.c tty.c term.c window.c utmp.c loadav.c putenv.c help.c \
63 termcap.c input.c attacher.c pty.c process.c display.c comm.c \
64 kmapdef.c acls.c braille.c braille_tsi.c logfile.c layer.c \
65 sched.c teln.c nethack.c encoding.c
66 OFILES= screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o \
67 search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o \
68 termcap.o input.o attacher.o pty.o process.o display.o comm.o \
69 kmapdef.o acls.o braille.o braille_tsi.o logfile.o layer.o \
70 sched.o teln.o nethack.o encoding.o
72 all: screen
74 screen: $(OFILES)
75 $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
77 .c.o:
78 $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(CPPFLAGS) $(DEFS) \
79 $(OPTIONS) $(CFLAGS) $<
81 install_bin: .version screen
82 -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
83 then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi
84 $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN)
85 -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN)
86 # This doesn't work if $(bindir)/screen is a symlink
87 -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi
88 rm -f $(DESTDIR)$(bindir)/screen
89 (cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen)
90 cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)
92 ###############################################################################
93 install: installdirs install_bin
94 cd doc ; $(MAKE) install
95 -if [ -d /usr/lib/terminfo ]; then \
96 PATH="$$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \
97 chmod 644 /usr/lib/terminfo/s/screen*; \
99 # Better do this by hand. E.g. under RCS...
100 # cat ${srcdir}/terminfo/screencap >> /etc/termcap
101 @echo "termcap entry (${srcdir}/terminfo/screencap) should be installed manually."
102 @echo "You may also want to install $(srcdir)/etc/etcscreenrc in" $(ETCSCREENRC)
104 installdirs:
105 # Path leading to ETCSCREENRC and Socketdirectory not checked.
106 $(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(SCREENENCODINGS)
107 cd doc ; $(MAKE) installdirs
109 uninstall: .version
110 rm -f $(DESTDIR)$(bindir)/$(SCREEN)
111 rm -f $(DESTDIR)$(bindir)/screen
112 -mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen
113 rm -f $(DESTDIR)$(ETCSCREENRC)
114 cd doc; $(MAKE) uninstall
116 shadow:
117 mkdir shadow;
118 cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc .
119 rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h
120 echo "install all Makefiles and config:" > shadow/Makefile
121 echo " rm -f config.cache" >> shadow/Makefile
122 echo " sh ./configure" >> shadow/Makefile
124 term.h: term.c term.sh
125 AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh
127 kmapdef.c: term.h
129 tty.c: tty.sh
130 sh $(srcdir)/tty.sh tty.c
132 comm.h: comm.c comm.sh config.h
133 AWK=$(AWK) CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh
135 osdef.h: osdef.sh config.h osdef.h.in
136 CPP="$(CPP) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh
138 docs:
139 cd doc; $(MAKE) dvi screen.info
141 dvi info screen.info:
142 -cd doc; $(MAKE) $@
144 mostlyclean:
145 rm -f $(OFILES) screen config.cache osdef0.c osdef1.sed osdef2.sed
147 clean celan: mostlyclean
148 rm -f tty.c term.h comm.h osdef.h kmapdef.c core
150 # Delete all files from the current directory that are created by
151 # configuring or building the program.
152 # building of term.h/comm.h requires awk. Keep it in the distribution
153 # we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC.
154 #distclean: mostlyclean
155 # rm -f $(SCREEN).tar $(SCREEN).tar.gz
156 # rm -f config.status Makefile
157 # rm -f osdef.h doc/Makefile
159 maintainer-clean:
160 @echo "This command is not even intended for maintainers to use;"
161 @echo "it deletes files that may require special tools to rebuild."
164 # Delete everything from the current directory that can be
165 # reconstructed with this Makefile.
166 realclean: .version mostlyclean
167 rm -f $(SCREEN).tar $(SCREEN).tar.gz
168 rm -f config.status Makefile doc/Makefile
169 rm -f tty.c term.h comm.h osdef.h kmapdef.c
170 rm -f config.h
171 echo "install all Makefiles and config:" > Makefile
172 echo " sh ./configure" >> Makefile
174 tags TAGS: $(CFILES)
175 -ctags *.sh $(CFILES) *.h
176 -etags *.sh $(CFILES) *.h
178 dist: .version $(SCREEN).tar.gz
180 $(SCREEN).tar: .version term.h comm.h tty.c kmapdef.c
181 -rm -rf dist
182 mkdir dist
183 mkdir dist/$(SCREEN)
184 ln acls.h ansi.h display.h extern.h logfile.h mark.h os.h \
185 layer.h patchlevel.h screen.h window.h image.h \
186 osdef.h.in term.sh tty.sh comm.sh osdef.sh braille.h \
187 sched.h \
188 $(CFILES) \
189 ChangeLog COPYING INSTALL NEWS* TODO install.sh \
190 dist/$(SCREEN)
191 cd dist/$(SCREEN); mv tty.c tty.c.dist
192 cd dist/$(SCREEN); mv kmapdef.c kmapdef.c.dist
193 ln configure.in configure dist/$(SCREEN)
194 sed -e 's@"/local/screens@"/tmp/screens@' -e 's@"/local@"/usr/local@g' < config.h.in > dist/$(SCREEN)/config.h.in
195 sed -e 's@[ ]/local@ /usr/local@g' -e 's/^CFLAGS = -g/CFLAGS = -O/' < Makefile.in > dist/$(SCREEN)/Makefile.in
196 ln term.h dist/$(SCREEN)/term.h.dist
197 ln comm.h dist/$(SCREEN)/comm.h.dist
198 ln README dist/$(SCREEN)/README
199 mkdir dist/$(SCREEN)/terminfo
200 cd terminfo; ln 8bits README checktc.c screencap \
201 screeninfo.src test.txt tetris.c \
202 ../dist/$(SCREEN)/terminfo
203 mkdir dist/$(SCREEN)/etc
204 cd etc; ln * ../dist/$(SCREEN)/etc
205 mkdir dist/$(SCREEN)/utf8encodings
206 cd utf8encodings; ln * ../dist/$(SCREEN)/utf8encodings
207 # sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/$(SCREEN)/etc/etcscreenrc
208 cp $(HOME)/.screenrc dist/$(SCREEN)/etc/screenrc
209 mkdir dist/$(SCREEN)/doc
210 sed -e 's@/local/emacs@/usr/local@g' < doc/Makefile.in > dist/$(SCREEN)/doc/Makefile.in
211 cd doc; ln FAQ README.DOTSCREEN screen.1 screen.texinfo fdpat.ps make.help window_to_display.ps \
212 ../dist/$(SCREEN)/doc
213 cd doc; if test -f screen.info; then ln screen.info* \
214 ../dist/$(SCREEN)/doc; fi
215 cd dist/$(SCREEN)/doc; ln -s ../install.sh .
216 cd dist/$(SCREEN); ln -s doc/FAQ .
217 echo "install all Makefiles and config:" > dist/$(SCREEN)/Makefile
218 echo " rm -f config.cache" >> dist/$(SCREEN)/Makefile
219 echo " sh ./configure" >> dist/$(SCREEN)/Makefile
220 cd dist; tar cf ../$(SCREEN).tar $(SCREEN)
221 rm -rf dist
223 $(SCREEN).tar.gz: $(SCREEN).tar
224 gzip -nf $(SCREEN).tar || gzip -f $(SCREEN).tar
226 # Perform self-tests (if any).
227 check:
229 lint:
230 lint -I. $(CFILES)
232 saber:
233 #load $(CFLAGS) screen.c ansi.c $(LIBS)
235 config:
236 rm -f config.cache
237 sh ./configure
240 ###############################################################################
242 .version:
243 @rev=`sed < $(srcdir)/patchlevel.h -n -e '/#define REV/s/#define REV *//p'`; \
244 vers=`sed < $(srcdir)/patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`; \
245 pat=`sed < $(srcdir)/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`; \
246 if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \
247 echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \
248 echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi
250 ###############################################################################
252 mdepend: $(CFILES) term.h
253 @rm -f DEPEND ; \
254 for i in ${CFILES} ; do \
255 echo "$$i" ; \
256 echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\
257 cc -E $$i |\
258 grep '^# .*"\./.*\.h"' |\
259 (sort -t'"' -u -k 2,2 2>/dev/null || sort -t'"' -u +1 -2) |\
260 sed -e 's/.*"\.\/\(.*\)".*/\1/'\
261 ` >> DEPEND ; \
262 done
265 depend: depend.in
266 ./config.status || ./configure
268 depend.in: $(CFILES) term.h
269 cp Makefile.in Makefile.in~
270 sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make
271 for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done
272 mv tmp_make Makefile.in
274 ###############################################################################
276 ### Dependencies:
277 screen.o: screen.c config.h screen.h os.h osdef.h ansi.h acls.h \
278 comm.h layer.h term.h image.h display.h window.h braille.h \
279 patchlevel.h logfile.h extern.h
280 ansi.o: ansi.c config.h screen.h os.h osdef.h ansi.h acls.h \
281 comm.h layer.h term.h image.h display.h window.h braille.h extern.h \
282 logfile.h
283 fileio.o: fileio.c config.h screen.h os.h osdef.h ansi.h acls.h \
284 comm.h layer.h term.h image.h display.h window.h extern.h
285 mark.o: mark.c config.h screen.h os.h osdef.h ansi.h acls.h \
286 comm.h layer.h term.h image.h display.h window.h mark.h extern.h
287 misc.o: misc.c config.h screen.h os.h osdef.h ansi.h acls.h \
288 comm.h layer.h term.h image.h display.h window.h extern.h
289 resize.o: resize.c config.h screen.h os.h osdef.h ansi.h acls.h \
290 comm.h layer.h term.h image.h display.h window.h extern.h
291 socket.o: socket.c config.h screen.h os.h osdef.h ansi.h acls.h \
292 comm.h layer.h term.h image.h display.h window.h extern.h
293 search.o: search.c config.h screen.h os.h osdef.h ansi.h acls.h \
294 comm.h layer.h term.h image.h display.h window.h mark.h extern.h
295 tty.o: tty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
296 layer.h term.h image.h display.h window.h extern.h
297 term.o: term.c term.h
298 window.o: window.c config.h screen.h os.h osdef.h ansi.h acls.h \
299 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
300 utmp.o: utmp.c config.h screen.h os.h osdef.h ansi.h acls.h \
301 comm.h layer.h term.h image.h display.h window.h extern.h
302 loadav.o: loadav.c config.h screen.h os.h osdef.h ansi.h acls.h \
303 comm.h layer.h term.h image.h display.h window.h extern.h
304 putenv.o: putenv.c config.h
305 help.o: help.c config.h screen.h os.h osdef.h ansi.h acls.h \
306 comm.h layer.h term.h image.h display.h window.h extern.h
307 termcap.o: termcap.c config.h screen.h os.h osdef.h ansi.h acls.h \
308 comm.h layer.h term.h image.h display.h window.h extern.h
309 input.o: input.c config.h screen.h os.h osdef.h ansi.h acls.h \
310 comm.h layer.h term.h image.h display.h window.h extern.h
311 attacher.o: attacher.c config.h screen.h os.h osdef.h ansi.h \
312 acls.h comm.h layer.h term.h image.h display.h window.h extern.h
313 pty.o: pty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
314 layer.h term.h image.h display.h window.h extern.h
315 process.o: process.c config.h screen.h os.h osdef.h ansi.h acls.h \
316 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
317 display.o: display.c config.h screen.h os.h osdef.h ansi.h acls.h \
318 comm.h layer.h term.h image.h display.h window.h extern.h braille.h
319 comm.o: comm.c config.h acls.h comm.h
320 kmapdef.o: kmapdef.c config.h
321 acls.o: acls.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
322 layer.h term.h image.h display.h window.h extern.h
323 braille.o: braille.c config.h screen.h os.h osdef.h ansi.h acls.h \
324 comm.h layer.h term.h image.h display.h window.h extern.h braille.h
325 braille_tsi.o: braille_tsi.c config.h screen.h os.h osdef.h ansi.h \
326 acls.h comm.h layer.h term.h image.h display.h window.h extern.h \
327 braille.h
328 logfile.o: logfile.c config.h screen.h os.h osdef.h ansi.h acls.h \
329 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
330 layer.o: layer.c config.h screen.h os.h osdef.h ansi.h acls.h \
331 comm.h layer.h term.h image.h display.h window.h extern.h
332 sched.o: sched.c config.h screen.h os.h osdef.h ansi.h acls.h \
333 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
334 teln.o: teln.c config.h screen.h os.h osdef.h ansi.h acls.h \
335 comm.h layer.h term.h image.h display.h window.h extern.h
336 nethack.o: nethack.c config.h screen.h os.h osdef.h ansi.h acls.h \
337 comm.h layer.h term.h image.h display.h window.h extern.h
338 encoding.o: encoding.c config.h screen.h os.h osdef.h ansi.h acls.h \
339 comm.h layer.h term.h image.h display.h window.h extern.h