summaryrefslogtreecommitdiffstats
path: root/Makefile.in
blob: 26ec40450bdbc97fd6c7271d5a00102803cf600c (plain)
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#
# Makefile template for screen 
#
# See machine dependent config.h for more configuration options.
#

srcdir = @srcdir@
VPATH = @srcdir@

DESTDIR = 

# Where to install screen.

prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@

# don't forget to change mandir and infodir in doc/Makefile.
bindir  = $(exec_prefix)/bin

VERSION = @VERSION@
SCREEN = screen-$(VERSION)

GIT_REV = 
DEFS = @DEFS@ -DGIT_REV=\"$(GIT_REV)\"

ETCSCREENRC = @ETCSCREENRC@
ifeq (${ETCSCREENRC}, )
ETCSCREENRC=$(prefix)/etc/screenrc
endif
SCREENENCODINGS = $(datadir)/screen/utf8encodings

CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@ -DETCSCREENRC='"$(ETCSCREENRC)"' \
           -DSCREENENCODINGS='"$(SCREENENCODINGS)"'
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

CPP=@CPP@
CPP_DEPEND=$(CC) -MM

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

AWK = @AWK@

### Chose some debug configuration options:
# -DDEBUG
#	Turn on really heavy debug output. This is written to 
#	/tmp/debug/{SCREEN,screen}.<pid>. Look at these files and quote 
#	questionable sections when sending bug-reports to the author.
# -DDUMPSHADOW
#	With shadow-pw screen would never dump core. Use this option if
#	you still want to have a core. Use only for debugging.
OPTIONS=
#OPTIONS= -DDEBUG

SHELL=/bin/sh

CFILES=	screen.c ansi.c fileio.c mark.c misc.c resize.c socket.c \
	search.c tty.c term.c window.c utmp.c loadav.c putenv.c help.c \
	termcap.c input.c attacher.c pty.c process.c display.c comm.c \
	kmapdef.c acls.c braille.c braille_tsi.c logfile.c layer.c \
	sched.c teln.c nethack.c encoding.c canvas.c layout.c viewport.c \
	list_display.c list_generic.c list_window.c
OFILES=	screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o \
	search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o \
	termcap.o input.o attacher.o pty.o process.o display.o comm.o \
	kmapdef.o acls.o braille.o braille_tsi.o logfile.o layer.o \
	list_generic.o list_display.o list_window.o \
	sched.o teln.o nethack.o encoding.o canvas.o layout.o viewport.o

all:	screen

screen: $(OFILES)
	$(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)

.c.o:
	$(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(CPPFLAGS) $(DEFS) \
	    $(OPTIONS) $(CFLAGS) $<

install_bin: .version screen installdirs
	-if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
		then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi
	$(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN)
	-chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN)
# This doesn't work if $(bindir)/screen is a symlink
	-if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi
	rm -f $(DESTDIR)$(bindir)/screen
	(cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen)
	cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)

###############################################################################
install: installdirs install_bin
	cd doc ; $(MAKE) install
	-if [ -d $(DESTDIR)/usr/lib/terminfo ]; then \
		PATH="$$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \
		chmod 644 $(DESTDIR)/usr/lib/terminfo/s/screen*; \
	fi
# Better do this by hand. E.g. under RCS...
#	cat ${srcdir}/terminfo/screencap >> /etc/termcap
	@echo "termcap entry (${srcdir}/terminfo/screencap) should be installed manually."
	@echo "You may also want to install $(srcdir)/etc/etcscreenrc in" $(ETCSCREENRC)

installdirs:
# Path leading to ETCSCREENRC and Socketdirectory not checked.
	$(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(SCREENENCODINGS)
	cd doc ; $(MAKE) installdirs

uninstall: .version
	rm -f $(DESTDIR)$(bindir)/$(SCREEN)
	rm -f $(DESTDIR)$(bindir)/screen
	-mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen
	rm -f $(DESTDIR)$(ETCSCREENRC)
	cd doc; $(MAKE) uninstall

shadow:
	mkdir shadow;
	cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc .
	rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h
	echo "install all Makefiles and config:" > shadow/Makefile
	echo "	rm -f config.cache" >> shadow/Makefile
	echo "	sh ./configure" >> shadow/Makefile
	
term.h: term.c term.sh
	AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh

kmapdef.c: term.h

tty.c:	tty.sh 
	sh $(srcdir)/tty.sh tty.c

comm.h: comm.c comm.sh config.h
	AWK=$(AWK) CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh

osdef.h: osdef.sh config.h osdef.h.in
	CPP="$(CPP) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh

docs:
	cd doc; $(MAKE) dvi screen.info

dvi info screen.info:
	-cd doc; $(MAKE) $@

mostlyclean:
	rm -f $(OFILES) screen config.cache osdef0.c osdef1.sed osdef2.sed

clean celan: mostlyclean
	rm -f tty.c term.h comm.h osdef.h kmapdef.c core

# Delete all files from the current directory that are created by 
# configuring or building the program.
# building of term.h/comm.h requires awk. Keep it in the distribution
# we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC.
#distclean:	mostlyclean
#	rm -f $(SCREEN).tar $(SCREEN).tar.gz
#	rm -f config.status Makefile
#	rm -f osdef.h doc/Makefile

maintainer-clean:
	@echo "This command is not even intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."


# Delete everything from the current directory that can be
# reconstructed with this Makefile.
realclean: .version mostlyclean
	rm -f $(SCREEN).tar $(SCREEN).tar.gz
	rm -f config.status Makefile doc/Makefile
	rm -f tty.c term.h comm.h osdef.h kmapdef.c
	rm -f config.h
	echo "install all Makefiles and config:" > Makefile
	echo "  sh ./configure" >> Makefile

tags TAGS: $(CFILES)
	-ctags    *.sh $(CFILES) *.h
	-etags    *.sh $(CFILES) *.h

dist: .version $(SCREEN).tar.gz

$(SCREEN).tar: .version term.h comm.h tty.c kmapdef.c
	-rm -rf dist
	mkdir dist
	mkdir dist/$(SCREEN)
	ln acls.h ansi.h display.h extern.h logfile.h mark.h os.h \
	   layer.h patchlevel.h screen.h window.h image.h \
	   osdef.h.in term.sh tty.sh comm.sh osdef.sh braille.h \
	   sched.h \
	   $(CFILES) \
	   ChangeLog COPYING INSTALL NEWS* TODO install.sh \
	   dist/$(SCREEN)
	cd dist/$(SCREEN); mv tty.c tty.c.dist
	cd dist/$(SCREEN); mv kmapdef.c kmapdef.c.dist
	ln configure.in configure dist/$(SCREEN)
	sed -e 's@"/local/screens@"/tmp/screens@' -e 's@"/local@"/usr/local@g' < config.h.in > dist/$(SCREEN)/config.h.in
	sed -e 's@[	 ]/local@ /usr/local@g' -e 's/^CFLAGS = -g/CFLAGS = -O/' < Makefile.in > dist/$(SCREEN)/Makefile.in
	ln term.h dist/$(SCREEN)/term.h.dist
	ln comm.h dist/$(SCREEN)/comm.h.dist
	ln README dist/$(SCREEN)/README
	mkdir dist/$(SCREEN)/terminfo
	cd terminfo; ln 8bits README checktc.c screencap \
	  screeninfo.src test.txt tetris.c \
	  ../dist/$(SCREEN)/terminfo
	mkdir dist/$(SCREEN)/etc
	cd etc; ln * ../dist/$(SCREEN)/etc
	mkdir dist/$(SCREEN)/utf8encodings
	cd utf8encodings; ln * ../dist/$(SCREEN)/utf8encodings
	# sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/$(SCREEN)/etc/etcscreenrc 
	cp $(HOME)/.screenrc dist/$(SCREEN)/etc/screenrc
	mkdir dist/$(SCREEN)/doc
	sed -e 's@/local/emacs@/usr/local@g' < doc/Makefile.in > dist/$(SCREEN)/doc/Makefile.in
	cd doc; ln FAQ README.DOTSCREEN screen.1 screen.texinfo fdpat.ps make.help window_to_display.ps \
	  ../dist/$(SCREEN)/doc
	cd doc; if test -f screen.info; then ln screen.info* \
	   ../dist/$(SCREEN)/doc; fi
	cd dist/$(SCREEN)/doc; ln -s ../install.sh .
	cd dist/$(SCREEN); ln -s doc/FAQ .
	echo "install all Makefiles and config:" > dist/$(SCREEN)/Makefile
	echo "	rm -f config.cache" >> dist/$(SCREEN)/Makefile
	echo "	sh ./configure"     >> dist/$(SCREEN)/Makefile
	cd dist; tar cf ../$(SCREEN).tar $(SCREEN)
	rm -rf dist

$(SCREEN).tar.gz: $(SCREEN).tar
	gzip -nf $(SCREEN).tar || gzip -f $(SCREEN).tar

# Perform self-tests (if any).
check:

lint:
	lint -I. $(CFILES)

saber:
	#load $(CFLAGS) screen.c ansi.c $(LIBS)

config:
	rm -f config.cache
	sh ./configure


###############################################################################

.version:
	@rev=`sed < $(srcdir)/patchlevel.h -n -e '/#define REV/s/#define REV  *//p'`; \
	vers=`sed < $(srcdir)/patchlevel.h -n -e '/#define VERS/s/#define VERS  *//p'`; \
	pat=`sed < $(srcdir)/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL  *//p'`; \
	if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \
	echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \
	echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi

###############################################################################

mdepend: $(CFILES) term.h
	@rm -f DEPEND ; \
	for i in ${CFILES} ; do \
	  echo "$$i" ; \
	  echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\
            cc -E $$i |\
            grep '^# .*"\./.*\.h"' |\
            (sort -t'"' -u -k 2,2 2>/dev/null || sort -t'"' -u +1 -2) |\
            sed -e 's/.*"\.\/\(.*\)".*/\1/'\
          ` >> DEPEND ; \
	done


depend: depend.in
	./config.status || ./configure
	
depend.in: $(CFILES) term.h
	cp Makefile.in Makefile.in~
	sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make
	for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done 
	mv tmp_make Makefile.in

###############################################################################

### Dependencies:
screen.o: layout.h viewport.h canvas.h screen.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h braille.h \
 patchlevel.h logfile.h extern.h
ansi.o: layout.h viewport.h canvas.h ansi.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h braille.h extern.h \
 logfile.h
fileio.o: layout.h viewport.h canvas.h fileio.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
mark.o: layout.h viewport.h canvas.h mark.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h mark.h extern.h
misc.o: layout.h viewport.h canvas.h misc.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
resize.o: layout.h viewport.h canvas.h resize.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
socket.o: layout.h viewport.h canvas.h socket.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
search.o: layout.h viewport.h canvas.h search.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h mark.h extern.h
tty.o: layout.h viewport.h canvas.h tty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
 layer.h term.h image.h display.h window.h extern.h
term.o: layout.h viewport.h canvas.h term.c term.h
window.o: layout.h viewport.h canvas.h window.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
utmp.o: layout.h viewport.h canvas.h utmp.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
loadav.o: layout.h viewport.h canvas.h loadav.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
putenv.o: layout.h viewport.h canvas.h putenv.c config.h
help.o: layout.h viewport.h canvas.h help.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h list_generic.h
termcap.o: layout.h viewport.h canvas.h termcap.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
input.o: layout.h viewport.h canvas.h input.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
attacher.o: layout.h viewport.h canvas.h attacher.c config.h screen.h os.h osdef.h ansi.h \
 acls.h comm.h layer.h term.h image.h display.h window.h extern.h
pty.o: layout.h viewport.h canvas.h pty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
 layer.h term.h image.h display.h window.h extern.h
process.o: layout.h viewport.h canvas.h process.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
display.o: layout.h viewport.h canvas.h display.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h braille.h
canvas.o: layout.h viewport.h canvas.h canvas.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h \
 braille.h
comm.o: layout.h viewport.h canvas.h comm.c config.h acls.h comm.h
kmapdef.o: layout.h viewport.h canvas.h kmapdef.c config.h
acls.o: layout.h viewport.h canvas.h acls.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
 layer.h term.h image.h display.h window.h extern.h
braille.o: layout.h viewport.h canvas.h braille.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h braille.h
braille_tsi.o: layout.h viewport.h canvas.h braille_tsi.c config.h screen.h os.h osdef.h ansi.h \
 acls.h comm.h layer.h term.h image.h display.h window.h extern.h \
 braille.h
logfile.o: layout.h viewport.h canvas.h logfile.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
layer.o: layout.h viewport.h canvas.h layer.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
sched.o: layout.h viewport.h canvas.h sched.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
teln.o: layout.h viewport.h canvas.h teln.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
nethack.o: layout.h viewport.h canvas.h nethack.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
encoding.o: layout.h viewport.h canvas.h encoding.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h
layout.o: layout.h viewport.h canvas.h layout.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h \
 braille.h
viewport.o: layout.h viewport.h canvas.h viewport.c config.h screen.h os.h osdef.h ansi.h acls.h \
 comm.h layer.h term.h image.h display.h window.h extern.h \
 braille.h
list_generic.o: list_generic.h list_generic.c layer.h screen.h osdef.h
list_display.o: list_generic.h list_display.c layer.h screen.h osdef.h
list_window.o: list_generic.h list_window.c window.h layer.h screen.h osdef.h comm.h