1# 2# Makefile template for screen 3# 4# See machine dependant config.h for more configuration options. 5# 6 7srcdir = @srcdir@ 8VPATH = @srcdir@ 9 10DESTDIR = 11 12# Where to install screen. 13 14prefix = @prefix@ 15exec_prefix = @exec_prefix@ 16 17# don't forget to change mandir and infodir in doc/Makefile. 18bindir = $(exec_prefix)/bin 19 20VERSION = @VERSION@ 21SCREEN = screen-$(VERSION) 22 23ETCSCREENRC = `sed < config.h -n -e '/define ETCSCREENRC/s/^.*"\([^"]*\)"/\1/p'` 24SCREENENCODINGS = `sed < config.h -n -e '/define SCREENENCODINGS/s/^.*"\([^"]*\)"/\1/p'` 25 26CC = @CC@ 27CFLAGS = @CFLAGS@ 28CPPFLAGS = @CPPFLAGS@ 29LDFLAGS = @LDFLAGS@ 30LIBS = @LIBS@ 31 32CPP=@CPP@ 33CPP_DEPEND=$(CC) -MM 34 35INSTALL = @INSTALL@ 36INSTALL_PROGRAM = @INSTALL_PROGRAM@ 37INSTALL_DATA = @INSTALL_DATA@ 38 39AWK = @AWK@ 40 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. 49OPTIONS= 50#OPTIONS= -DDEBUG 51 52SHELL=/bin/sh 53 54CFILES= 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 59OFILES= 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 64 65all: screen 66 67screen: $(OFILES) 68 $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) 69 70.c.o: 71 $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $< 72 73install_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 -sf $(SCREEN) screen) 82 cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS) 83 84############################################################################### 85install: 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*; \ 90 fi 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) 95 96installdirs: 97# Path leading to ETCSCREENRC and Socketdirectory not checked. 98 $(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(SCREENENCODINGS) 99 cd doc ; $(MAKE) installdirs 100 101uninstall: .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 107 108shadow: 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 115 116term.h: term.c term.sh 117 AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh 118 119kmapdef.c: term.h 120 121tty.c: tty.sh 122 sh $(srcdir)/tty.sh tty.c 123 124comm.h: comm.c comm.sh config.h 125 AWK=$(AWK) CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh 126 127osdef.h: osdef.sh config.h osdef.h.in 128 CPP="$(CPP) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh 129 130docs: 131 cd doc; $(MAKE) dvi screen.info 132 133dvi info screen.info: 134 -cd doc; $(MAKE) $@ 135 136mostlyclean: 137 rm -f $(OFILES) screen config.cache osdef0.c osdef1.sed osdef2.sed 138 139clean celan: mostlyclean 140 rm -f tty.c term.h comm.h osdef.h kmapdef.c core 141 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 150 151maintainer-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." 154 155 156# Delete everything from the current directory that can be 157# reconstructed with this Makefile. 158realclean: .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 165 166tags TAGS: $(CFILES) 167 -ctags *.sh $(CFILES) *.h 168 -ctags -e *.sh $(CFILES) *.h 169 170dist: .version $(SCREEN).tar.gz 171 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 214 215$(SCREEN).tar.gz: $(SCREEN).tar 216 gzip -nf $(SCREEN).tar || gzip -f $(SCREEN).tar 217 218# Perform self-tests (if any). 219check: 220 221lint: 222 lint -I. $(CFILES) 223 224saber: 225 #load $(CFLAGS) screen.c ansi.c $(LIBS) 226 227config: 228 rm -f config.cache 229 sh ./configure 230 231 232############################################################################### 233 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 241 242############################################################################### 243 244mdepend: $(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 255 256 257depend: depend.in 258 ./config.status || ./configure 259 260depend.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 265 266############################################################################### 267 268### Dependencies: 269screen.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 272ansi.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 275fileio.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 277mark.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 279misc.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 281resize.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 283socket.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 285search.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 287tty.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 289term.o: term.c term.h 290window.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 292utmp.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 294loadav.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 296putenv.o: putenv.c config.h 297help.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 299termcap.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 301input.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 303attacher.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 305pty.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 307process.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 309display.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 311comm.o: comm.c config.h acls.h comm.h 312kmapdef.o: kmapdef.c config.h 313acls.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 315braille.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 317braille_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 320logfile.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 322layer.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 324sched.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 326teln.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 328nethack.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 330encoding.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 332