Commit | Line | Data |
---|---|---|
b585a9fa EZ |
1 | # |
2 | # Makefile template for rlfe | |
3 | # | |
4 | # See machine dependant config.h for more configuration options. | |
5 | # | |
6 | ||
7 | srcdir = @srcdir@ | |
8 | VPATH = @srcdir@ | |
9 | ||
10 | DESTDIR = | |
11 | ||
12 | # Where to install screen. | |
13 | ||
14 | prefix = @prefix@ | |
15 | exec_prefix = @exec_prefix@ | |
16 | ||
17 | # don't forget to change mandir and infodir in doc/Makefile. | |
18 | bindir = $(exec_prefix)/bin | |
19 | ||
20 | VERSION = @VERSION@ | |
21 | SCREEN = screen-$(VERSION) | |
22 | ||
23 | CC = @CC@ | |
24 | CFLAGS = @CFLAGS@ | |
25 | CPPFLAGS = @CPPFLAGS@ | |
26 | #LDFLAGS = -L$(READLINE_DIR) | |
27 | LDFLAGS = @LDFLAGS@ | |
cc88a640 | 28 | LIBS = -lreadline -lhistory @LIBS@ |
b585a9fa EZ |
29 | |
30 | CPP=@CPP@ | |
31 | CPP_DEPEND=$(CC) -MM | |
32 | ||
33 | INSTALL = @INSTALL@ | |
34 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
35 | INSTALL_DATA = @INSTALL_DATA@ | |
36 | ||
37 | AWK = @AWK@ | |
38 | ||
39 | OPTIONS= | |
40 | #OPTIONS= -DDEBUG | |
41 | ||
42 | SHELL=/bin/sh | |
43 | ||
44 | CFILES= rlfe.c pty.c | |
45 | HFILES= extern.h os.h screen.h | |
46 | EXTRA_DIST=configure.in configure Makefile.in config.h.in ChangeLog README | |
47 | OFILES= rlfe.o pty.o | |
48 | ||
49 | all: rlfe | |
50 | ||
51 | rlfe: $(OFILES) | |
52 | $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) | |
53 | ||
54 | rlfe-$(VERSION).tar.gz: | |
55 | tar czf $@ $(CFILES) $(HFILES) $(EXTRA_DIST) | |
56 | ||
57 | .c.o: | |
cc88a640 | 58 | $(CC) -c -I. -I$(srcdir) $(CPPFLAGS) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $< |
b585a9fa EZ |
59 | |
60 | install_bin: .version screen | |
61 | -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \ | |
62 | then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi | |
63 | $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN) | |
64 | -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN) | |
65 | # This doesn't work if $(bindir)/screen is a symlink | |
66 | -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi | |
67 | rm -f $(DESTDIR)$(bindir)/screen | |
68 | (cd $(DESTDIR)$(bindir) && ln -sf $(SCREEN) screen) | |
69 | cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS) | |
70 | ||
b585a9fa EZ |
71 | uninstall: .version |
72 | rm -f $(DESTDIR)$(bindir)/$(SCREEN) | |
73 | rm -f $(DESTDIR)$(bindir)/screen | |
74 | -mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen | |
75 | rm -f $(DESTDIR)$(ETCSCREENRC) | |
76 | cd doc; $(MAKE) uninstall | |
77 | ||
78 | shadow: | |
79 | mkdir shadow; | |
80 | cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc . | |
81 | rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h | |
82 | echo "install all Makefiles and config:" > shadow/Makefile | |
83 | echo " rm -f config.cache" >> shadow/Makefile | |
84 | echo " sh ./configure" >> shadow/Makefile | |
85 | ||
86 | term.h: term.c term.sh | |
87 | AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh | |
88 | ||
89 | kmapdef.c: term.h | |
90 | ||
91 | tty.c: tty.sh | |
92 | sh $(srcdir)/tty.sh tty.c | |
93 | ||
94 | mostlyclean: | |
95 | rm -f $(OFILES) rlfe *.o | |
96 | ||
97 | clean celan: mostlyclean | |
98 | rm -f tty.c term.h comm.h osdef.h kmapdef.c core | |
99 | ||
100 | # Delete all files from the current directory that are created by | |
101 | # configuring or building the program. | |
102 | # building of term.h/comm.h requires awk. Keep it in the distribution | |
103 | # we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC. | |
104 | #distclean: mostlyclean | |
105 | # rm -f $(SCREEN).tar $(SCREEN).tar.gz | |
106 | # rm -f config.status Makefile | |
107 | # rm -f osdef.h doc/Makefile | |
108 | ||
109 | maintainer-clean: | |
110 | @echo "This command is not even intended for maintainers to use;" | |
111 | @echo "it deletes files that may require special tools to rebuild." | |
112 | ||
113 | ||
114 | # Delete everything from the current directory that can be | |
115 | # reconstructed with this Makefile. | |
116 | realclean: .version mostlyclean | |
117 | rm -f $(SCREEN).tar $(SCREEN).tar.gz | |
118 | rm -f config.status Makefile doc/Makefile | |
119 | rm -f tty.c term.h comm.h osdef.h kmapdef.c | |
120 | rm -f config.h | |
121 | echo "install all Makefiles and config:" > Makefile | |
122 | echo " sh ./configure" >> Makefile | |
123 | ||
124 | tags TAGS: $(CFILES) | |
125 | -ctags *.sh $(CFILES) *.h | |
126 | -ctags -e *.sh $(CFILES) *.h | |
127 | ||
128 | dist: .version $(SCREEN).tar.gz | |
129 | ||
130 | ||
131 | # Perform self-tests (if any). | |
132 | check: | |
133 | ||
134 | config: | |
135 | rm -f config.cache | |
136 | sh ./configure | |
137 | ||
138 | ||
139 | ############################################################################### | |
140 | ||
141 | .version: | |
142 | @rev=`sed < $(srcdir)/patchlevel.h -n -e '/#define REV/s/#define REV *//p'`; \ | |
143 | vers=`sed < $(srcdir)/patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`; \ | |
144 | pat=`sed < $(srcdir)/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`; \ | |
145 | if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \ | |
146 | echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \ | |
147 | echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi | |
148 | ||
149 | ############################################################################### | |
150 | ||
151 | mdepend: $(CFILES) term.h | |
152 | @rm -f DEPEND ; \ | |
153 | for i in ${CFILES} ; do \ | |
154 | echo "$$i" ; \ | |
155 | echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\ | |
156 | cc -E $$i |\ | |
157 | grep '^# .*"\./.*\.h"' |\ | |
158 | (sort -t'"' -u -k 2,2 2>/dev/null || sort -t'"' -u +1 -2) |\ | |
159 | sed -e 's/.*"\.\/\(.*\)".*/\1/'\ | |
160 | ` >> DEPEND ; \ | |
161 | done | |
162 | ||
163 | depend: depend.in | |
164 | ./config.status || ./configure | |
165 | ||
166 | depend.in: $(CFILES) term.h | |
167 | cp Makefile.in Makefile.in~ | |
168 | sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make | |
169 | for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done | |
170 | mv tmp_make Makefile.in | |
171 | ||
cc88a640 JK |
172 | Makefile makefile: config.status $(srcdir)/Makefile.in |
173 | CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status | |
174 | ||
175 | config.status: $(srcdir)/configure | |
176 | $(SHELL) ./config.status --recheck | |
177 | ||
178 | $(srcdir)/configure: $(srcdir)/configure.in | |
179 | cd $(srcdir) && autoconf | |
180 | ||
b585a9fa EZ |
181 | ############################################################################### |
182 | ||
183 | ### Dependencies: | |
184 | pty.o: pty.c config.h |