Merge branch 'master' into lua-scripting
[screen-lua.git] / src / Makefile.in
blob7091425b5fb20396b69d54c76031f566dffcec09
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@
17 # don't forget to change mandir and infodir in doc/Makefile.
18 bindir = $(exec_prefix)/bin
20 VERSION = @VERSION@
21 SCREEN = screen-$(VERSION)
23 ETCSCREENRC = `sed < config.h -n -e '/define ETCSCREENRC/s/^.*"\([^"]*\)"/\1/p'`
24 SCREENENCODINGS = `sed < config.h -n -e '/define SCREENENCODINGS/s/^.*"\([^"]*\)"/\1/p'`
26 CC = @CC@
27 CFLAGS = @CFLAGS@
28 CPPFLAGS = @CPPFLAGS@
29 LDFLAGS = @LDFLAGS@
30 LIBS = @LIBS@
32 CPP=@CPP@
33 CPP_DEPEND=$(CC) -MM
35 INSTALL = @INSTALL@
36 INSTALL_PROGRAM = @INSTALL_PROGRAM@
37 INSTALL_DATA = @INSTALL_DATA@
39 AWK = @AWK@
41 ### Chose some debug configuration options:
42 # -DDEBUG
43 # Turn on really heavy debug output. This is written to
44 # /tmp/debug/{SCREEN,screen}.<pid>. Look at these files and quote
45 # questionable sections when sending bug-reports to the author.
46 # -DDUMPSHADOW
47 # With shadow-pw screen would never dump core. Use this option if
48 # you still want to have a core. Use only for debugging.
49 OPTIONS=
50 #OPTIONS= -DDEBUG
52 SHELL=/bin/sh
54 CFILES= screen.c ansi.c fileio.c mark.c misc.c resize.c socket.c \
55 search.c tty.c term.c window.c utmp.c loadav.c putenv.c help.c \
56 termcap.c input.c attacher.c pty.c process.c display.c comm.c \
57 kmapdef.c acls.c braille.c braille_tsi.c logfile.c layer.c \
58 sched.c teln.c nethack.c encoding.c lua.c script.c
59 OFILES= screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o \
60 search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o \
61 termcap.o input.o attacher.o pty.o process.o display.o comm.o \
62 kmapdef.o acls.o braille.o braille_tsi.o logfile.o layer.o \
63 sched.o teln.o nethack.o encoding.o lua.o script.o
65 all: screen
67 screen: $(OFILES)
68 $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
70 .c.o:
71 $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $<
73 install_bin: .version screen
74 -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
75 then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi
76 $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN)
77 -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN)
78 # This doesn't work if $(bindir)/screen is a symlink
79 -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi
80 rm -f $(DESTDIR)$(bindir)/screen
81 (cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen)
82 cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)
84 ###############################################################################
85 install: installdirs install_bin
86 cd doc ; $(MAKE) install
87 -if [ -d /usr/lib/terminfo ]; then \
88 PATH="$$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \
89 chmod 644 /usr/lib/terminfo/s/screen*; \
91 # Better do this by hand. E.g. under RCS...
92 # cat ${srcdir}/terminfo/screencap >> /etc/termcap
93 @echo "termcap entry (${srcdir}/terminfo/screencap) should be installed manually."
94 @echo "You may also want to install $(srcdir)/etc/etcscreenrc in" $(ETCSCREENRC)
96 installdirs:
97 # Path leading to ETCSCREENRC and Socketdirectory not checked.
98 $(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(SCREENENCODINGS)
99 cd doc ; $(MAKE) installdirs
101 uninstall: .version
102 rm -f $(DESTDIR)$(bindir)/$(SCREEN)
103 rm -f $(DESTDIR)$(bindir)/screen
104 -mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen
105 rm -f $(DESTDIR)$(ETCSCREENRC)
106 cd doc; $(MAKE) uninstall
108 shadow:
109 mkdir shadow;
110 cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc .
111 rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h
112 echo "install all Makefiles and config:" > shadow/Makefile
113 echo " rm -f config.cache" >> shadow/Makefile
114 echo " sh ./configure" >> shadow/Makefile
116 term.h: term.c term.sh
117 AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh
119 kmapdef.c: term.h
121 tty.c: tty.sh
122 sh $(srcdir)/tty.sh tty.c
124 comm.h: comm.c comm.sh config.h
125 AWK=$(AWK) CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh
127 osdef.h: osdef.sh config.h osdef.h.in
128 CPP="$(CPP) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh
130 docs:
131 cd doc; $(MAKE) dvi screen.info
133 dvi info screen.info:
134 -cd doc; $(MAKE) $@
136 mostlyclean:
137 rm -f $(OFILES) screen config.cache osdef0.c osdef1.sed osdef2.sed
139 clean celan: mostlyclean
140 rm -f tty.c term.h comm.h osdef.h kmapdef.c core
142 # Delete all files from the current directory that are created by
143 # configuring or building the program.
144 # building of term.h/comm.h requires awk. Keep it in the distribution
145 # we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC.
146 #distclean: mostlyclean
147 # rm -f $(SCREEN).tar $(SCREEN).tar.gz
148 # rm -f config.status Makefile
149 # rm -f osdef.h doc/Makefile
151 maintainer-clean:
152 @echo "This command is not even intended for maintainers to use;"
153 @echo "it deletes files that may require special tools to rebuild."
156 # Delete everything from the current directory that can be
157 # reconstructed with this Makefile.
158 realclean: .version mostlyclean
159 rm -f $(SCREEN).tar $(SCREEN).tar.gz
160 rm -f config.status Makefile doc/Makefile
161 rm -f tty.c term.h comm.h osdef.h kmapdef.c
162 rm -f config.h
163 echo "install all Makefiles and config:" > Makefile
164 echo " sh ./configure" >> Makefile
166 tags TAGS: $(CFILES)
167 -ctags *.sh $(CFILES) *.h
168 -ctags -e *.sh $(CFILES) *.h
170 dist: .version $(SCREEN).tar.gz
172 $(SCREEN).tar: .version term.h comm.h tty.c kmapdef.c
173 -rm -rf dist
174 mkdir dist
175 mkdir dist/$(SCREEN)
176 ln acls.h ansi.h display.h extern.h logfile.h mark.h os.h \
177 layer.h patchlevel.h screen.h window.h image.h \
178 osdef.h.in term.sh tty.sh comm.sh osdef.sh braille.h \
179 sched.h \
180 $(CFILES) \
181 ChangeLog COPYING INSTALL NEWS* TODO install.sh \
182 dist/$(SCREEN)
183 cd dist/$(SCREEN); mv tty.c tty.c.dist
184 cd dist/$(SCREEN); mv kmapdef.c kmapdef.c.dist
185 ln configure.in configure dist/$(SCREEN)
186 sed -e 's@"/local/screens@"/tmp/screens@' -e 's@"/local@"/usr/local@g' < config.h.in > dist/$(SCREEN)/config.h.in
187 sed -e 's@[ ]/local@ /usr/local@g' -e 's/^CFLAGS = -g/CFLAGS = -O/' < Makefile.in > dist/$(SCREEN)/Makefile.in
188 ln term.h dist/$(SCREEN)/term.h.dist
189 ln comm.h dist/$(SCREEN)/comm.h.dist
190 ln README dist/$(SCREEN)/README
191 mkdir dist/$(SCREEN)/terminfo
192 cd terminfo; ln 8bits README checktc.c screencap \
193 screeninfo.src test.txt tetris.c \
194 ../dist/$(SCREEN)/terminfo
195 mkdir dist/$(SCREEN)/etc
196 cd etc; ln * ../dist/$(SCREEN)/etc
197 mkdir dist/$(SCREEN)/utf8encodings
198 cd utf8encodings; ln * ../dist/$(SCREEN)/utf8encodings
199 # sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/$(SCREEN)/etc/etcscreenrc
200 cp $(HOME)/.screenrc dist/$(SCREEN)/etc/screenrc
201 mkdir dist/$(SCREEN)/doc
202 sed -e 's@/local/emacs@/usr/local@g' < doc/Makefile.in > dist/$(SCREEN)/doc/Makefile.in
203 cd doc; ln FAQ README.DOTSCREEN screen.1 screen.texinfo fdpat.ps make.help window_to_display.ps \
204 ../dist/$(SCREEN)/doc
205 cd doc; if test -f screen.info; then ln screen.info* \
206 ../dist/$(SCREEN)/doc; fi
207 cd dist/$(SCREEN)/doc; ln -s ../install.sh .
208 cd dist/$(SCREEN); ln -s doc/FAQ .
209 echo "install all Makefiles and config:" > dist/$(SCREEN)/Makefile
210 echo " rm -f config.cache" >> dist/$(SCREEN)/Makefile
211 echo " sh ./configure" >> dist/$(SCREEN)/Makefile
212 cd dist; tar cf ../$(SCREEN).tar $(SCREEN)
213 rm -rf dist
215 $(SCREEN).tar.gz: $(SCREEN).tar
216 gzip -nf $(SCREEN).tar || gzip -f $(SCREEN).tar
218 # Perform self-tests (if any).
219 check:
221 lint:
222 lint -I. $(CFILES)
224 saber:
225 #load $(CFLAGS) screen.c ansi.c $(LIBS)
227 config:
228 rm -f config.cache
229 sh ./configure
232 ###############################################################################
234 .version:
235 @rev=`sed < $(srcdir)/patchlevel.h -n -e '/#define REV/s/#define REV *//p'`; \
236 vers=`sed < $(srcdir)/patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`; \
237 pat=`sed < $(srcdir)/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`; \
238 if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \
239 echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \
240 echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi
242 ###############################################################################
244 mdepend: $(CFILES) term.h
245 @rm -f DEPEND ; \
246 for i in ${CFILES} ; do \
247 echo "$$i" ; \
248 echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\
249 cc -E $$i |\
250 grep '^# .*"\./.*\.h"' |\
251 (sort -t'"' -u -k 2,2 2>/dev/null || sort -t'"' -u +1 -2) |\
252 sed -e 's/.*"\.\/\(.*\)".*/\1/'\
253 ` >> DEPEND ; \
254 done
257 depend: depend.in
258 ./config.status || ./configure
260 depend.in: $(CFILES) term.h
261 cp Makefile.in Makefile.in~
262 sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make
263 for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done
264 mv tmp_make Makefile.in
266 ###############################################################################
268 ### Dependencies:
269 screen.o: screen.c config.h screen.h os.h osdef.h ansi.h acls.h \
270 comm.h layer.h term.h image.h display.h window.h braille.h \
271 patchlevel.h logfile.h extern.h
272 ansi.o: ansi.c config.h screen.h os.h osdef.h ansi.h acls.h \
273 comm.h layer.h term.h image.h display.h window.h braille.h extern.h \
274 logfile.h
275 fileio.o: fileio.c config.h screen.h os.h osdef.h ansi.h acls.h \
276 comm.h layer.h term.h image.h display.h window.h extern.h
277 mark.o: mark.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 mark.h extern.h
279 misc.o: misc.c config.h screen.h os.h osdef.h ansi.h acls.h \
280 comm.h layer.h term.h image.h display.h window.h extern.h
281 resize.o: resize.c config.h screen.h os.h osdef.h ansi.h acls.h \
282 comm.h layer.h term.h image.h display.h window.h extern.h
283 socket.o: socket.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 search.o: search.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 tty.o: tty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
288 layer.h term.h image.h display.h window.h extern.h
289 term.o: term.c term.h
290 window.o: window.c config.h screen.h os.h osdef.h ansi.h acls.h \
291 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
292 utmp.o: utmp.c config.h screen.h os.h osdef.h ansi.h acls.h \
293 comm.h layer.h term.h image.h display.h window.h extern.h
294 loadav.o: loadav.c config.h screen.h os.h osdef.h ansi.h acls.h \
295 comm.h layer.h term.h image.h display.h window.h extern.h
296 putenv.o: putenv.c config.h
297 help.o: help.c config.h screen.h os.h osdef.h ansi.h acls.h \
298 comm.h layer.h term.h image.h display.h window.h extern.h
299 termcap.o: termcap.c config.h screen.h os.h osdef.h ansi.h acls.h \
300 comm.h layer.h term.h image.h display.h window.h extern.h
301 input.o: input.c config.h screen.h os.h osdef.h ansi.h acls.h \
302 comm.h layer.h term.h image.h display.h window.h extern.h
303 attacher.o: attacher.c config.h screen.h os.h osdef.h ansi.h \
304 acls.h comm.h layer.h term.h image.h display.h window.h extern.h
305 pty.o: pty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
306 layer.h term.h image.h display.h window.h extern.h
307 process.o: process.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 logfile.h
309 display.o: display.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 braille.h
311 comm.o: comm.c config.h acls.h comm.h
312 kmapdef.o: kmapdef.c config.h
313 acls.o: acls.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 braille.o: braille.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 braille.h
317 braille_tsi.o: braille_tsi.c config.h screen.h os.h osdef.h ansi.h \
318 acls.h comm.h layer.h term.h image.h display.h window.h extern.h \
319 braille.h
320 logfile.o: logfile.c config.h screen.h os.h osdef.h ansi.h acls.h \
321 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
322 layer.o: layer.c config.h screen.h os.h osdef.h ansi.h acls.h \
323 comm.h layer.h term.h image.h display.h window.h extern.h
324 sched.o: sched.c config.h screen.h os.h osdef.h ansi.h acls.h \
325 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
326 teln.o: teln.c config.h screen.h os.h osdef.h ansi.h acls.h \
327 comm.h layer.h term.h image.h display.h window.h extern.h
328 nethack.o: nethack.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
330 encoding.o: encoding.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