1157184Sache#
2157184Sache# Makefile template for rlfe 
3157184Sache#
4157184Sache# See machine dependant config.h for more configuration options.
5157184Sache#
6157184Sache
7157184Sachesrcdir = @srcdir@
8157184SacheVPATH = @srcdir@
9157184Sache
10157184SacheDESTDIR = 
11157184Sache
12157184Sache# Where to install screen.
13157184Sache
14157184Sacheprefix = @prefix@
15157184Sacheexec_prefix = @exec_prefix@
16157184Sache
17157184Sache# don't forget to change mandir and infodir in doc/Makefile.
18157184Sachebindir  = $(exec_prefix)/bin
19157184Sache
20157184SacheVERSION = @VERSION@
21157184SacheSCREEN = screen-$(VERSION)
22157184Sache
23157184SacheCC = @CC@
24157184SacheCFLAGS = @CFLAGS@
25157184SacheCPPFLAGS = @CPPFLAGS@
26157184Sache#LDFLAGS = -L$(READLINE_DIR)
27157184SacheLDFLAGS = @LDFLAGS@
28165670SacheLIBS = -lreadline -lhistory -lncurses @LIBS@
29157184Sache
30157184SacheCPP=@CPP@
31157184SacheCPP_DEPEND=$(CC) -MM
32157184Sache
33157184SacheINSTALL = @INSTALL@
34157184SacheINSTALL_PROGRAM = @INSTALL_PROGRAM@
35157184SacheINSTALL_DATA = @INSTALL_DATA@
36157184Sache
37157184SacheAWK = @AWK@
38157184Sache
39157184SacheOPTIONS=
40157184Sache#OPTIONS= -DDEBUG
41157184Sache
42157184SacheSHELL=/bin/sh
43157184Sache
44157184SacheCFILES=	rlfe.c pty.c
45157184SacheHFILES= extern.h os.h screen.h
46157184SacheEXTRA_DIST=configure.in configure Makefile.in config.h.in ChangeLog README
47157184SacheOFILES=	rlfe.o pty.o
48157184Sache
49157184Sacheall:	rlfe
50157184Sache
51157184Sacherlfe: $(OFILES)
52157184Sache	$(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
53157184Sache
54157184Sacherlfe-$(VERSION).tar.gz:
55157184Sache	tar czf $@ $(CFILES) $(HFILES) $(EXTRA_DIST)
56157184Sache
57157184Sache.c.o:
58157184Sache	$(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $<
59157184Sache
60157184Sacheinstall_bin: .version screen
61157184Sache	-if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
62157184Sache		then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi
63157184Sache	$(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN)
64157184Sache	-chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN)
65157184Sache# This doesn't work if $(bindir)/screen is a symlink
66157184Sache	-if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi
67157184Sache	rm -f $(DESTDIR)$(bindir)/screen
68157184Sache	(cd $(DESTDIR)$(bindir) && ln -sf $(SCREEN) screen)
69157184Sache	cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)
70157184Sache
71157184Sache
72157184Sacheuninstall: .version
73157184Sache	rm -f $(DESTDIR)$(bindir)/$(SCREEN)
74157184Sache	rm -f $(DESTDIR)$(bindir)/screen
75157184Sache	-mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen
76157184Sache	rm -f $(DESTDIR)$(ETCSCREENRC)
77157184Sache	cd doc; $(MAKE) uninstall
78157184Sache
79157184Sacheshadow:
80157184Sache	mkdir shadow;
81157184Sache	cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc .
82157184Sache	rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h
83157184Sache	echo "install all Makefiles and config:" > shadow/Makefile
84157184Sache	echo "	rm -f config.cache" >> shadow/Makefile
85157184Sache	echo "	sh ./configure" >> shadow/Makefile
86157184Sache
87157184Sacheterm.h: term.c term.sh
88157184Sache	AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh
89157184Sache
90157184Sachekmapdef.c: term.h
91157184Sache
92157184Sachetty.c:	tty.sh 
93157184Sache	sh $(srcdir)/tty.sh tty.c
94157184Sache
95157184Sachemostlyclean:
96157184Sache	rm -f $(OFILES) rlfe *.o
97157184Sache
98157184Sacheclean celan: mostlyclean
99157184Sache	rm -f tty.c term.h comm.h osdef.h kmapdef.c core
100157184Sache
101157184Sache# Delete all files from the current directory that are created by 
102157184Sache# configuring or building the program.
103157184Sache# building of term.h/comm.h requires awk. Keep it in the distribution
104157184Sache# we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC.
105157184Sache#distclean:	mostlyclean
106157184Sache#	rm -f $(SCREEN).tar $(SCREEN).tar.gz
107157184Sache#	rm -f config.status Makefile
108157184Sache#	rm -f osdef.h doc/Makefile
109157184Sache
110157184Sachemaintainer-clean:
111157184Sache	@echo "This command is not even intended for maintainers to use;"
112157184Sache	@echo "it deletes files that may require special tools to rebuild."
113157184Sache
114157184Sache
115157184Sache# Delete everything from the current directory that can be
116157184Sache# reconstructed with this Makefile.
117157184Sacherealclean: .version mostlyclean
118157184Sache	rm -f $(SCREEN).tar $(SCREEN).tar.gz
119157184Sache	rm -f config.status Makefile doc/Makefile
120157184Sache	rm -f tty.c term.h comm.h osdef.h kmapdef.c
121157184Sache	rm -f config.h
122157184Sache	echo "install all Makefiles and config:" > Makefile
123157184Sache	echo "  sh ./configure" >> Makefile
124157184Sache
125157184Sachetags TAGS: $(CFILES)
126157184Sache	-ctags    *.sh $(CFILES) *.h
127157184Sache	-ctags -e *.sh $(CFILES) *.h
128157184Sache
129157184Sachedist: .version $(SCREEN).tar.gz
130157184Sache
131157184Sache
132157184Sache# Perform self-tests (if any).
133157184Sachecheck:
134157184Sache
135157184Sacheconfig:
136157184Sache	rm -f config.cache
137157184Sache	sh ./configure
138157184Sache
139157184Sache
140157184Sache###############################################################################
141157184Sache
142157184Sache.version:
143157184Sache	@rev=`sed < $(srcdir)/patchlevel.h -n -e '/#define REV/s/#define REV  *//p'`; \
144157184Sache	vers=`sed < $(srcdir)/patchlevel.h -n -e '/#define VERS/s/#define VERS  *//p'`; \
145157184Sache	pat=`sed < $(srcdir)/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL  *//p'`; \
146157184Sache	if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \
147157184Sache	echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \
148157184Sache	echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi
149157184Sache
150157184Sache###############################################################################
151157184Sache
152157184Sachemdepend: $(CFILES) term.h
153157184Sache	@rm -f DEPEND ; \
154157184Sache	for i in ${CFILES} ; do \
155157184Sache	  echo "$$i" ; \
156157184Sache	  echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\
157157184Sache            cc -E $$i |\
158157184Sache            grep '^# .*"\./.*\.h"' |\
159157184Sache            (sort -t'"' -u -k 2,2 2>/dev/null || sort -t'"' -u +1 -2) |\
160157184Sache            sed -e 's/.*"\.\/\(.*\)".*/\1/'\
161157184Sache          ` >> DEPEND ; \
162157184Sache	done
163157184Sache
164157184Sachedepend: depend.in
165157184Sache	./config.status || ./configure
166157184Sache
167157184Sachedepend.in: $(CFILES) term.h
168157184Sache	cp Makefile.in Makefile.in~
169157184Sache	sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make
170157184Sache	for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done 
171157184Sache	mv tmp_make Makefile.in
172157184Sache
173157184Sache###############################################################################
174157184Sache
175157184Sache### Dependencies:
176157184Sachepty.o: pty.c config.h
177