1
# Clif - A C-like Interpreter Framework
2
# Copyright (C) 1997 T. Hruz, L. Koren
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
exec_prefix = $(prefix)
23
bindir = $(exec_prefix)/bin
34
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/example
36
X_LIBS = @X_LIBS@ -lX11
37
X_EXTRA_LIBS = @X_EXTRA_LIBS@
46
ALL_CFLAGS = $(ADD_IDIR) $(CFLAGS) $(X_CFLAGS)
52
OBJS = c-parser.o c-lex.o keyword.o rs-parser.o rs-lex.o tables.o \
53
help.o global.o store_cont.o virtual_machine.o clif.o getc_unix.o \
54
comp_maint.o allocx.o printf_unix.o input.o memmove.o symbols.o \
55
remote_call.o ch-parser.o ch-lex.o channel_maint.o s-conv.o \
57
$(ADD_OBJS) $(SH_OBJS)
59
ALL = all.config all.progs
61
version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.h`
64
$(CC) -c $(DEFS) $(ALL_CFLAGS) $(INCLUDES) $<
70
all.config: config.status auto-config.h
78
cd $(srcdir)/tests; ./check-them $$cwd
81
$(CC) $(OBJS) $(LIBS) $(X_LIBS) $(X_EXTRA_LIBS) -o clif
83
dvi: doc/guide_users.dvi doc/guide_programmers.dvi
86
# Avoid a lot of time thinking about remaking Makefile.in.
89
Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.h
90
cp config.status config.run
94
$(srcdir)/configure: $(srcdir)/configure.in
95
cd $(srcdir); autoconf
97
# autoheader might not change config.h.in, so touch a stamp file.
98
$(srcdir)/config.in: $(srcdir)/stamp-h.in
99
$(srcdir)/stamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
100
cd $(srcdir) && autoheader
101
echo timestamp > $(srcdir)/stamp-h.in
103
auto-config.h: stamp-h
104
stamp-h: config.in config.status
105
CONFIG_HEADERS=auto-config.h:config.in $(SHELL) config.status
108
config.status: configure
109
@if [ ! -f config.status ]; then \
110
echo You must configure clif. ; \
113
$(SHELL) config.status --recheck; \
118
# object of the main parser function
120
c-parser.o: c-parser.c global.h instr.h geninstr.h \
121
control.h type.h mystdio.h struct.h ys.h parser.h \
122
allocx.h load.h virtual_machine.h ls.h memmove.h \
123
tables.h remote_call.h printfx.h s-conv.h flags.h \
126
c-lex.o: c-lex.c config.h global.h mystdio.h token.h \
127
input.h buf.h allocx.h dbg-out.h tables.h
129
keyword.o: keyword.c token.h config.h
131
# interaface to remote procedure call
133
remote_call.o: remote_call.c global.h intrinsic.h myintrinsic.c \
134
type.h struct.h define.h load.c load.h mystdio.h allocx.h \
135
remote_call.h config.h
138
# object of the run string compiler
140
rs-parser.o: rs-parser.c flags.h
143
rs-lex.o: rs-lex.c init_rs.c allocx.h rs-parser.h
145
# object of the virtual machine
147
virtual_machine.o: virtual_machine.c global.h cast.h instr.h \
148
input.h virtual_machine.h printfx.h tables.h config.h lex_t.h
151
# global variables and parameters
153
global.o: global.c type.h
156
# inerrupt handler maintenance
158
inter_handl_svr3.o: inter_handl_svr3.c global.h config.h
160
inter_handl_bsd.o: inter_handl_bsd.c global.h config.h
162
inter_handl_svr4.o: inter_handl_svr4.c global.h config.h
164
inter_handl_lin.o: inter_handl_lin.c global.h config.h
166
inter_handl_posix.o: inter_handl_posix.c global.h config.h
168
# procedures for switching context of the virtual
169
# machine in interrupt handling
171
store_cont.o: store_cont.c global.h mystdio.h input.h \
174
# machine dependent main function
176
clif.o: clif.c global.h config.h
179
# machine dependent getc function
181
getc_unix.o: getc_unix.c
184
# main compiler maintenance
186
comp_maint.o: comp_maint.c global.h define.h control.h \
187
struct.h type.h mystdio.h instr.h token.h geninstr.h \
188
comp_maint.h version.h allocx.h ys.h run_str.h ls.h \
189
tables.h input.h printfx.h s-conv.h config.h flags.h \
192
# symbol table maintenance
194
tables.o: tables.c global.h cast.h struct.h define.h mystdio.h \
195
type.h token.h instr.h allocx.h comp_maint.h tables.h printfx.h \
198
# machine dependent alloc function
200
allocx.o: allocx.c config.h allocx.h global.h
202
# machine dependent "print" function
204
printf_unix.o: printf_unix.c printfx.h
206
# machine dependent "memmove" function
208
memmove.o: memmove.c global.h cast.h memmove.h
210
# redefined input of the main compiler
212
input.o: input.c global.h input.h lex_t.h
214
# function printing command line options
218
# saving a copy of each string
220
symbols.o: symbols.c allocx.h
224
s-conv.o: s-conv.c global.h allocx.h type.h struct.h comp_maint.h \
229
dbg-out.o: dbg-out.c global.h allocx.h printfx.h dbg-out.h
231
# parser support functions
233
pso.o: pso.c global.h geninstr.h flags.h comp_maint.h pso.h \
234
struct.h tables.h type.h instr.h allocx.h
238
# non compulsive parts begin here
240
# graphics interface - dynamic library
242
libclif_x.so: ch-parser.o ch-lex.o remote_call.o channel_maint.o \
243
example/lin_clnt.o example/lin_xdr.o
244
ld $(ALL_LDFLAGS) ch-parser.o ch-lex.o remote_call.o \
245
channel_maint.o example/lin_clnt.o example/lin_xdr.o -o libclif_x.so
246
cp libclif_x.so $(HOME)/lib/libclif_x.so
248
ch-parser.o: ch-parser.c global.h mystdio.h channel_maint.h \
251
ch-lex.o: ch-lex.c buf.h init_ch.c mystdio.h
253
channel_maint.o: channel_maint.c channel_maint.h mystdio.h \
254
xwin.c graph.c wind.c wind_w.c
256
$(srcdir)/ch-parser.c: $(srcdir)/channel.y
257
cd $(srcdir); $(YACC) $(YACCFLAGS) channel.y
258
@$(srcdir)/utils/yy _channel $(srcdir)/y.tab.c > $(srcdir)/ch-parser.c
259
@$(srcdir)/utils/yy _channel $(srcdir)/y.tab.h > $(srcdir)/ch-parser.h
260
@rm $(srcdir)/y.tab.c $(srcdir)/y.tab.h
262
$(srcdir)/ch-lex.c: $(srcdir)/channel.l
263
cd $(srcdir); $(LEX) channel.l
264
@$(srcdir)/utils/yy _channel $(srcdir)/lex.yy.c > $(srcdir)/ch-lex.c
265
@rm $(srcdir)/lex.yy.c
267
rw: $(srcdir)/rw.c $(srcdir)/sigig.c $(srcdir)/sigig_bsd.c \
268
$(srcdir)/sigig_lin.c $(srcdir)/sigig_posix.c
269
$(CC) $(DEFS) $(ALL_CFLAGS) $(INCLUDES) $(srcdir)/rw.c \
270
$(ADD_FORK) $(LDFLAGS) $(LIBS) $(X_LIBS) $(X_EXTRA_LIBS) -o rw
274
# grammar of the clif
276
$(srcdir)/c-parser.c: $(srcdir)/ys.y
277
cd $(srcdir); $(YACC) $(YACCFLAGS) ys.y
278
@mv $(srcdir)/y.tab.c $(srcdir)/c-parser.c
279
@mv $(srcdir)/y.tab.h $(srcdir)/token.h
281
# lexical analysis of the clif
283
$(srcdir)/c-lex.c: $(srcdir)/ls.l
284
cd $(srcdir); $(LEX) ls.l
285
@mv $(srcdir)/lex.yy.c $(srcdir)/c-lex.c
286
@if test $(LEX) = flex; then \
287
echo "#define FLEX_SCANNER" > lex_t.h; \
289
echo "#undef FLEX_SCANNER" > lex_t.h; \
292
# grammar of the run string parsing
294
$(srcdir)/rs-parser.c: $(srcdir)/run_str.y
295
cd $(srcdir); $(YACC) $(YACCFLAGS) run_str.y
296
@$(srcdir)/utils/yy _rs_ $(srcdir)/y.tab.c > $(srcdir)/rs-parser.c
297
@$(srcdir)/utils/yy _rs_ $(srcdir)/y.tab.h > $(srcdir)/rs-parser.h
298
@rm $(srcdir)/y.tab.c $(srcdir)/y.tab.h
300
# lexical analysis of a run string
302
$(srcdir)/rs-lex.c: $(srcdir)/run_str.l
303
cd $(srcdir); $(LEX) run_str.l
304
@$(srcdir)/utils/yy _rs_ $(srcdir)/lex.yy.c > $(srcdir)/rs-lex.c
305
@rm $(srcdir)/lex.yy.c
307
$(srcdir)/keyword.c: $(srcdir)/keyword.gperf
308
gperf -t -p -k 2,3 $(srcdir)/keyword.gperf > $(srcdir)/keyword.c
314
lin_clnt.o: example/lin_clnt.c example/lin.h
315
$(CC) -c $(DEFS) $(ALL_CFLAGS) $(INCLUDES) $<
317
lin_xdr.o: example/lin_xdr.c example/lin.h
318
$(CC) -c $(DEFS) $(ALL_CFLAGS) $(INCLUDES) $<
322
$(srcdir)/utils/yy: $(srcdir)/utils/yy.c
323
cd $(srcdir)/utils; $(CC) yy.c -o yy
326
#############################################################
328
# Update the tags table
332
mv -f *-parser.[ch] temp; \
337
#############################################################
343
rm -f $(HOME)/libclif_x.so
345
extraclean: distclean
346
-rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
350
-rm -rf clif-$(version) tmp
352
maintainer-clean: distclean
353
-rm -f c-lex.c *-parser.* ch-lex.* rs-lex.* y.*
358
-rm -f config.status config.cache auto-config.h
359
-rm -f doc/*.aux doc/*.idx doc/*.ilg doc/*.ind \
360
doc/*.log doc/*.lof doc/*.toc
368
-rm -f *.o *~ "#"*"#" *.dvi *.log *core code *.flc
372
# Create the distribution tar.gz file
374
gzip --best < clif.xtar > tmp-clif.xtar.gz
375
mv tmp-clif.xtar.gz clif-$(version).tar.gz
379
tar -chf clif.xtar clif-$(version)
381
distdir: distdir-start distdir-finish
384
@if grep -s "\myver}{$(version)" doc/guide_programmers.tex > /dev/null; \
386
else echo "You must update version number in \`doc/guide_programmers.tex'"; sleep 10; \
388
# Update version number in README
389
awk '$$1 == "Version" \
390
{ $$2 = version; print "\t\t\t",$$0 } \
392
version=$(version) README > tmp.README
394
-rm -rf clif-$(version) tmp
395
# Put all the files in a temporary subdirectory
396
# which has the name that we want to have in the tar file.
402
for file in *[0-9a-zA-Z+]; do \
403
ln $$file tmp > /dev/null 2>&1 || cp $$file tmp; \
406
for file in *[0-9a-zA-Z+]; do \
407
if test -d $$file && test "$$file" != RCS; then \
408
mkdir ../tmp/example/$$file; \
410
for subfile in *[0-9a-zA-Z+]; do \
411
ln $$subfile ../../tmp/example/$$file > /dev/null 2>&1 \
412
|| cp $$subfile ../../tmp/example/$$file; \
416
ln $$file ../tmp/example > /dev/null 2>&1 \
417
|| cp $$file ../tmp/example; \
421
for file in *[0-9a-zA-Z+]; do \
422
if test -d $$file && test "$$file" != RCS; then \
423
mkdir ../tmp/tests/$$file; \
425
for subfile in *[0-9a-zA-Z+]; do \
426
ln $$subfile ../../tmp/tests/$$file > /dev/null 2>&1 \
427
|| cp $$subfile ../../tmp/tests/$$file; \
431
ln $$file ../tmp/tests > /dev/null 2>&1 \
432
|| cp $$file ../tmp/tests; \
436
for file in *[0-9a-zA-Z+]; do \
437
if test -d $$file && test "$$file" != RCS; then \
438
mkdir ../tmp/doc/$$file; \
440
for subfile in *[0-9a-zA-Z+]; do \
441
ln $$subfile ../../tmp/doc/$$file > /dev/null 2>&1 \
442
|| cp $$subfile ../../tmp/doc/$$file; \
446
ln $$file ../tmp/doc > /dev/null 2>&1 \
447
|| cp $$file ../tmp/doc; \
451
for file in *[0-9a-zA-Z+]; do \
452
if test -d $$file && test "$$file" != RCS; then \
453
mkdir ../tmp/utils/$$file; \
455
for subfile in *[0-9a-zA-Z+]; do \
456
ln $$subfile ../../tmp/utils/$$file > /dev/null 2>&1 \
457
|| cp $$subfile ../../tmp/utils/$$file; \
461
ln $$file ../tmp/utils > /dev/null 2>&1 \
462
|| cp $$file ../tmp/utils; \
467
mv tmp clif-$(version)
468
cd clif-$(version); make extraclean
470
# make diff oldversion=M.N
471
# creates a diff file between an older distribution and this one.
472
# The -P option assumes this is GNU diff.
474
diff -rc2P -x "*.dvi" \
475
-x TAGS -x INSTALL -x configure \
476
clif-$(oldversion) clif-$(version) > clif-$(oldversion)-$(version).diff
480
doc/guide_programmers.dvi: doc/guide_programmers.tex
481
cd doc; latex guide_programmers.tex
482
cd doc; latex guide_programmers.tex
483
cd doc; makeindex guide_programmers.idx
484
cd doc; latex guide_programmers.tex
486
doc/guide_users.dvi: doc/guide_users.tex
487
cd doc; latex guide_users.tex
488
cd doc; latex guide_users.tex
489
cd doc; makeindex guide_users.idx
490
cd doc; latex guide_users.tex