File: Makefile.in

package info (click to toggle)
scsh 0.5.1-2
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 6,540 kB
  • ctags: 8,656
  • sloc: lisp: 39,346; ansic: 13,466; sh: 1,669; makefile: 624
file content (688 lines) | stat: -rw-r--r-- 21,653 bytes parent folder | download
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
# Scheme Shell Makefile
# Last updated October 1995 by BDC

# Documentation in files INSTALL and doc/install.txt

srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
DEFS = @DEFS@
LIBS = @LIBS@
#DBOPEN = @DBOPEN@
CFLAGS = @CFLAGS@
CPPFLAGS= @CPPFLAGS@ -I$(srcdir)/cig -I$(srcdir)/scsh/regexp
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ -c
INSTALL_DATA = @INSTALL_DATA@ -c

LDFLAGS = -g @LDFLAGS@
LDFLAGS_AIX= @LDFLAGS_AIX@

RM	= rm -f

AR	= @AR@
RANLIB	= @RANLIB@

SHELL	= /bin/sh

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
incdir = $(exec_prefix)/include
mandir = $(prefix)/man
manext = 1

# HP 9000 series, if you don't have gcc
#   CC = cc 
#   CFLAGS = -Aa -O +Obb1800
#   DEFS = -D_HPUX_SOURCE -Dhpux

# Ultrix
#   LDFLAGS = -N

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) -I. $(CFLAGS) -o $@ $<

# You might want to change RUNNABLE to "s48" # NOT -bri
RUNNABLE = scsh
MANPAGE = $(RUNNABLE).$(manext)
LIB = $(libdir)/$(RUNNABLE)

distdir = /users/ftp/pub/s48
#distdir = /net/mini-wheats/fs/admin/ftp/pub/s48

# If make barfs on this include line, just comment it out.  It's only
# really needed if you want to build the linker or rebuild initial.image.
include $(srcdir)/filenames.make
#
# Berkeley make wants to see this instead: (or use GNU make on BSD. -bri)
#.include "$(srcdir)/filenames.make"


# Static linker:
#
# You only need the linker if you're going to make changes to the
# things that go into the initial.image, which in general means the
# files in rts/.  If you decide you need to use the linker, then you
# gots your choice; it can run in just about any version of Scheme 48
# or Pseudoscheme.  (It has also been made to run in Scheme->C.)  It
# doesn't matter a whole lot which Scheme you use as long as it's not
# broken or unavailable.  The two best choices are:
# 1. As below: build the linker on the scheme48vm and scheme48.image
#    that are in the current directory.
# 2. LINKER_VM = $(RUNNABLE) $(BIG_HEAP)
#    LINKER_RUNNABLE = $(RUNNABLE)
#    These settings requires you to already have a $(RUNNABLE)
#    command.  This is desirable if you are making changes to the
#    system that might break scheme48vm and/or scheme48.image.  But it
#    requires you to have squirreled away a previous working version
#    of scheme48.

BIG_HEAP = -h 4000000
LINKER_VM = ./$(VM) $(BIG_HEAP)
LINKER_RUNNABLE = $(LINKER_VM) -i $(IMAGE)
LINKER_IMAGE = link/linker.image
LINKER = $(LINKER_VM) -i $(LINKER_IMAGE)
START_LINKER = echo ,batch; echo ,bench on;


# --------------------
# You shouldn't have to change anything below this point.

# Targets:

IMAGE = scheme48.image
INITIAL = $(srcdir)/initial.image
VM = scshvm
LIBCIG = cig/lib$(VM).a
CIG = cig/cig
CIGOBJS = cig/libcig.o cig/libcig1.o
LIBSCSH = scsh/lib$(VM).a
SCSHVMHACKS = proc2.o # postgcstub.o

SCSHOBJS = \
	scsh/dirstuff1.o \
	scsh/fdports1.o \
	scsh/flock.o scsh/flock1.o \
	scsh/machine/stdio_dep.o \
	scsh/machine/time_dep1.o \
	scsh/machine/signals1.o \
	scsh/machine/libansi.o \
	scsh/network.o scsh/network1.o \
	scsh/putenv.o \
	scsh/rdelim.o \
	scsh/re.o scsh/re1.o \
	scsh/regexp/regexp.o \
	scsh/regexp/regsub.o \
	scsh/select.o scsh/select1.o \
	scsh/sleep1.o \
	scsh/syscalls.o scsh/syscalls1.o \
	scsh/time.o scsh/time1.o \
	scsh/tty.o scsh/tty1.o \
	scsh/userinfo1.o \
	scsh/sighandlers1.o scsh/sighandlers.o 

#	scsh/jcontrol2.o scsh/jcontrol1.o \
#    	scsh/$(DBOPEN) \
#    	scsh/dbm.o scsh/dbm1.o

OBJS = unix.o dynload.o prescheme.o extension.o scheme48vm.o \
	process_args.o $(CIGOBJS) $(SCSHVMHACKS) $(SCSHOBJS) 

# Sources:

CONFIG_FILES = interfaces.scm low-packages.scm rts-packages.scm \
	       comp-packages.scm

# Rules:

# The following is the first rule and therefore the "make" command's
# default target.
enough: $(VM) $(IMAGE) script $(LIBCIG) scsh $(LIBSCSH) $(MANPAGE) .notify

# The developers are curious to know.  Don't be concerned if this fails.
# You may comment these lines out if you wish to be discourteous.
.notify: minor-version-number
	touch .notify
	-echo SCSH 0.`cat $(srcdir)/scsh/minor-version-number` \
	   Scheme48 0.`cat $(srcdir)/minor-version-number` infestation. \
	   | mail scheme-48-notifications@martigny.ai.mit.edu 
	-echo Another scsh 0.`cat $(srcdir)/scsh/minor-version-number` \
	infestation. | mail scsh-notifications@martigny.ai.mit.edu 

# This says how to process .scm files with cig to make .c stubs.
.SUFFIXES: .scm
.scm.c:
	$(srcdir)/$(VM) -o $(srcdir)/$(VM) -i $(CIG) < $< > $*.c

# These .h files mediate between the code exported from foo1.c
# and imported into foo.scm's stub foo.c.

scsh/dirstuff1.o: scsh/dirstuff1.h
scsh/rdelim.o:    scsh/fdports1.h
scsh/userinfo1.o: scsh/userinfo1.h

scsh/fdports1.o	  scsh/fdports.o:  scsh/fdports1.h
scsh/flock1.o	  scsh/flock.o:	   scsh/flock1.h
scsh/network1.o	  scsh/network.o:  scsh/network1.h
scsh/re1.o	  scsh/re.o:	   scsh/re1.h
scsh/select1.o	  scsh/select.o:   scsh/select1.h
scsh/syscalls1.o  scsh/syscalls.o: scsh/syscalls1.h
scsh/time1.o	  scsh/time.o:	   scsh/time1.h
scsh/tty1.o       scsh/tty.o:	   scsh/tty1.h

scsh/syscalls.o:  scsh/syscalls1.h scsh/dirstuff1.h scsh/fdports1.h \
		  scsh/select1.h   scsh/userinfo1.h

scsh/sighandlers1.o scsh/sighandlers.o: scsh/sighandlers1.h

include $(srcdir)/scsh/machine/Makefile.inc
# Berkeley make wants to see this instead: (or use GNU make on BSD. -bri)
#.include "$(srcdir)/scsh/machine/Makefile.inc"

$(VM): main.o $(OBJS) $(AIX_P)
	$(CC) $(LDFLAGS) $(LDFLAGS_AIX) -o $@ main.o $(OBJS) $(LIBS)

$(LIBCIG): main.o $(OBJS)
#	$(CC) -r -o $@ main.o $(OBJS)
	$(RM) $@
	$(AR) $@ main.o $(OBJS) 
	$(RANLIB) $@

$(LIBSCSH): smain.o $(OBJS)
	$(RM) $@
	$(AR) $@ smain.o $(OBJS) 
	$(RANLIB) $@

main.o: main.c
	$(CC) -c -o $@ -DDEFAULT_IMAGE_NAME=\"$(LIB)/scsh.image\" \
	    $(CPPFLAGS) $(CFLAGS) $(srcdir)/main.c
scheme48vm.o: scheme48vm.c prescheme.h
extension.o: extension.c sysdep.h scheme48.h
unix.o: unix.c sysdep.h
dynload.o: dynload.c sysdep.h scheme48.h

# --------------------
# Make scheme48.image from initial.image and library .scm files.
#
# In the following, "make" passes $$USER to the shell as $USER, which
# the shell sees as an environment variable reference.
#
# For bootstrap reasons, initial.image is *not* listed as a source,
# even though it really is.

$(IMAGE): $(VM) env/init-defpackage.scm more-interfaces.scm link-packages.scm \
	   more-packages.scm $(usual-files) initial.debug build-usual-image
	sh $(srcdir)/build-usual-image "$(srcdir)" "$(LIB)" "$(IMAGE)" \
	   "$(VM)" "$(INITIAL)"

# Unix man page...

$(MANPAGE): scsh.man Makefile
	sed 's=LBIN=$(bindir)=g' $(srcdir)/scsh.man \
	 | sed 's=LLIB=$(LIB)=g' \
	 | sed 's=LSCSH=$(RUNNABLE)=g' >$@
	-chmod +r $@

script:
	(echo '#!/bin/sh'; \
	 echo exec '$(LIB)/$(VM)' -o '$(LIB)/$(VM)' -i '$(LIB)/$(IMAGE)' \"\$$\@\") \
	   > script
	-chmod +x script

### Fake targets:  all clean install man dist

install: install-dirs install-vm install-misc \
	install-man install-inc install-cig install-scsh

#install: script install-dirs install-vm install-image install-misc \
#	install-man install-inc install-cig install-scsh
#	This is now install-scsh
#	$(INSTALL_PROGRAM) script $(bindir)/$(RUNNABLE)

install-dirs:
	if [ ! -d $(prefix) ] ; then mkdir $(prefix); fi
	if [ ! -d $(exec_prefix) ] ; then mkdir $(exec_prefix); fi
	if [ ! -d $(bindir) ] ; then mkdir $(bindir); fi
	if [ ! -d $(libdir) ] ; then mkdir $(libdir); fi
	if [ ! -d $(incdir) ] ; then mkdir $(incdir); fi
	if [ ! -d $(mandir) ] ; then mkdir $(mandir); fi
	if [ ! -d $(mandir)/man$(manext) ] ; then mkdir $(mandir)/man$(manext); fi
	$(RM) -r $(LIB).old
	if [ -d $(LIB) ] ; then mv $(LIB) $(LIB).old ; fi
	mkdir $(LIB)
	mkdir $(LIB)/big
	mkdir $(LIB)/cig
#	mkdir $(LIB)/doc
#	mkdir $(LIB)/doc/scsh-manual
	mkdir $(LIB)/env
	mkdir $(LIB)/link
	mkdir $(LIB)/misc
	mkdir $(LIB)/opt
	mkdir $(LIB)/scsh
	mkdir $(LIB)/rts
	mkdir $(LIB)/vm

install-vm: $(VM)
	$(INSTALL_PROGRAM) $(VM) $(LIB)/

install-image: $(IMAGE)
	$(INSTALL_DATA) $(IMAGE) $(LIB)/

install-man: $(MANPAGE)
	if test -d $(mandir)/man$(manext);  \
	  then $(INSTALL_DATA) $(MANPAGE) $(mandir)/man$(manext); \
          else echo "No man directory, not installing man page"; fi

install-inc: scheme48.h
	$(INSTALL_DATA) $(srcdir)/scheme48.h $(incdir)/

install-cig: cig
	$(INSTALL_PROGRAM) $(srcdir)/$(CIG) $(LIB)/cig
	$(INSTALL_PROGRAM) $(srcdir)/$(CIG).image $(LIB)/cig
	$(INSTALL_DATA) $(srcdir)/$(LIBCIG) $(LIB)/cig
	$(INSTALL_DATA) $(srcdir)/cig/libcig.h $(LIB)/cig

install-misc: $(LIB)/rts $(LIB)/env $(LIB)/big $(LIB)/opt \
	      $(LIB)/misc $(LIB)/link $(LIB)/vm # $(LIB)/doc
	for f in $(srcdir)/rts/*num.scm; \
	    do $(INSTALL_DATA) $$f $(LIB)/rts/; done
	for f in $(srcdir)/env/*.scm; do $(INSTALL_DATA) $$f $(LIB)/env/; done
	for f in $(srcdir)/big/*.scm; do $(INSTALL_DATA) $$f $(LIB)/big/; done
	for f in $(srcdir)/opt/*.scm; do $(INSTALL_DATA) $$f $(LIB)/opt/; done
	for f in $(srcdir)/misc/*.scm; \
	    do $(INSTALL_DATA) $$f $(LIB)/misc/; done
	for f in $(srcdir)/link/*.scm; \
	    do $(INSTALL_DATA) $$f $(LIB)/link/; done
	for f in $(srcdir)/vm/*.scm; do $(INSTALL_DATA) $$f $(LIB)/vm/; done
#	for f in $(srcdir)/doc/*.txt; do $(INSTALL_DATA) $$f $(LIB)/doc/; done
#	for f in $(srcdir)/doc/*.tex; do $(INSTALL_DATA) $$f $(LIB)/doc/; done
#	for f in $(srcdir)/doc/*.ps; do $(INSTALL_DATA) $$f $(LIB)/doc/; done
#	for f in $(srcdir)/doc/scsh-manual/*.tex; \
#	    do $(INSTALL_DATA) $$f $(LIB)/doc/scsh-manual/; done
	$(INSTALL_DATA) $(srcdir)/rts/jar-defrecord.scm $(LIB)/rts/
#  -p: Intermediate directories are created as necessary.
# -p not portable...it is POSIX 2, bit its not widely available -bri
# just added install-dirs
$(LIB)/rts:
	mkdir $(LIB)/rts
$(LIB)/env:
	mkdir $(LIB)/env
$(LIB)/opt:
	mkdir $(LIB)/opt
$(LIB)/big:
	mkdir $(LIB)/big
$(LIB)/misc:
	mkdir $(LIB)/misc
$(LIB)/link:
	mkdir $(LIB)/link

configure: configure.in
	cd $(srcdir); autoconf

clean: clean-cig clean-scsh
	-rm -f $(VM) *.o TAGS $(IMAGE) *.tmp script $(MANPAGE) \
	    link/*.image debug/*.image debug/*.debug mini mini-heap.c

clean-cig:
	-rm -f cig/*.o $(CIG) $(CIG).image $(LIBCIG)

distclean: clean
	$(RM) Makefile sysdep.h config.status config.log config.cache \
		scsh/machine scsh/regexp/Makefile scsh/endian.scm \
		exportlist.aix
	-find . -name '*~' -o -name '#*'  -o -name core -exec rm {} \;

man:	$(MANPAGE)

check:	$(VM) $(IMAGE) debug/check.scm
	(echo ,translate =scheme48/ $(srcdir)/; \
	 echo ,config ,load $(srcdir)/debug/test.scm; \
	 echo ,exec ,load $(srcdir)/debug/check.scm; echo ,exec "(done)") \
	| ./$(VM) -o ./$(VM) -i $(IMAGE) batch

# --------------------
# Rules from here on down are not essential for the basic installation
# procedure, and are not expected to work when srcdir is not the
# distribution directory.

all: vm linker
	$(MAKE) image
vm: $(VM)
linker: $(LINKER_IMAGE)
image: $(INITIAL)
	$(MAKE) $(IMAGE)

tags:
	etags scsh/*.scm scsh/*.c \
	  rts/*.scm bcomp/*.scm *.scm env/*.scm big/*.scm \
	  link/*.scm opt/*.scm debug/*.scm misc/*.scm \
	  vm/*.scm

# --------------------
# Increment the minor version number
inc:
	(cat minor-version-number; echo 1+p) | dc >minor-version-number.tmp
	mv minor-version-number.tmp minor-version-number
	echo \(define version-info \"0.`cat minor-version-number`\"\) \
	  >env/version-info.scm


# --------------------
# Generate filenames.make from *packages.scm
#
# This hack traces the module dependencies described in the
# various configuration files and converts them into dependency lists
# that "make" can use for its purposes.
#
# Since the distribution comes with a filenames.make, this rule
# shouldn't be invoked for simple installations.  But it will be used
# if you change any of the *-packages.scm files.
#
# You can actually the forms in filenames.scm to any Scheme
# implementation that has syntax-rules and explicit-renaming low-level
# macros (e.g., most versions of Scheme 48 and Pseudoscheme).
# If there are errors running this script, and you need to debug,
# don't use the initial.image, use something that has a reasonable
# environment.
#
# If this fails and you don't feel like debugging or fixing the problem,
# try "touch filenames.make" and hope for the best.

PACKAGES=packages.scm rts-packages.scm alt-packages.scm \
		comp-packages.scm initial-packages.scm link-packages.scm \
		more-packages.scm filenames.scm

filenames.make: $(PACKAGES)
	$(MAKE) $(VM) PACKAGES=
	./$(VM) -o ./$(VM) -i $(INITIAL) batch <filenames.scm
# or:	$(RUNNABLE) -s filenames.scm

# --------------------
# Static linker
#
# The linker is capable of rebuilding an image from sources, even
# across an incompatible change in VM data representations.

link/linker.image: $(linker-files) alt/init-defpackage.scm
	(echo ,batch; echo ,bench on;                  \
	 echo ,open signals handle features;           \
	 echo ,open bitwise ascii code-vectors record; \
	 echo ,load $(linker-files);		       \
	 echo ,load alt/init-defpackage.scm;	       \
	 echo ,dump link/linker.image)		       \
	| $(LINKER_RUNNABLE)

# Or, to bootstrap from Lucid Common Lisp: (last tested with
# Pseudoscheme 2.9 and Scheme 48 version 0.19)

PSEUDODIR = ../pseudo

link/linker-in-lucid: link/lucid-script.lisp $(linker-files) \
	    alt/pseudoscheme-features.scm alt/pseudoscheme-record.scm
	(echo \(defvar pseudoscheme-directory \"$(PSEUDODIR)/\"\); \
	 cat link/lucid-script.lisp; \
	 echo \(dump-linker\) \(lcl:quit\)) \
	| lisp

# --------------------
# Initial image
#
# The initial.image is built by the static linker.  The image contains
# Scheme, the byte-code compiler, and a minimal command processor, but
# no debugging environment to speak of.

$(INITIAL): $(LINKER_IMAGE) $(CONFIG_FILES) initial.scm $(initial-files) \
	scsh/scsh-read.scm scsh/here.scm # gross and Olin hates it -bri
	($(START_LINKER)               \
	 echo \(load-configuration \"interfaces.scm\"\); \
	 echo \(load-configuration \"packages.scm\"\); \
	 echo \(flatload initial-structures\); \
	 echo \(load \"initial.scm\"\);  \
	 echo \(link-initial-system\))   \
	| $(LINKER)

# --------------------
# Various small images for debugging low-level changes

LOAD_DEBUG = \
	 $(START_LINKER) \
	 echo \(load-configuration \"interfaces.scm\"\); \
	 echo \(load-configuration \"packages.scm\"\); \
	 echo \(flatload debug-structures\)

debug/tiny.image: $(LINKER_IMAGE) debug/tiny-packages.scm debug/tiny.scm
	($(START_LINKER) \
	 echo \(load-configuration \"debug/tiny-packages.scm\"\); \
	 echo \(link-simple-system \'\(debug tiny\) \'start tiny-system\)) \
	| $(LINKER)

debug/little.image: $(LINKER_IMAGE) $(CONFIG_FILES) debug-packages.scm
	($(LOAD_DEBUG); echo \(link-little-system\)) \
	| time $(LINKER)

debug/mini.image: $(LINKER_IMAGE) $(CONFIG_FILES)
	($(LOAD_DEBUG); echo \(link-mini-system\)) \
	| $(LINKER)

debug/medium.image: $(LINKER_IMAGE) $(CONFIG_FILES)
	($(LOAD_DEBUG); echo \(flatload compiler-structures\); \
	 echo \(link-medium-system\)) \
	| $(LINKER)

smain.o: main.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -DSTATIC_AREAS -o $@ $(srcdir)/main.c

mini: mini-heap.o smain.o
	$(CC) $(LDFLAGS) -o $@ smain.o mini-heap.o $(OBJS) $(LIBS)
mini-heap.o: mini-heap.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $(srcdir)/mini-heap.c
mini-heap.c: debug/mini1.image
	(echo ,batch on; \
	 echo ,exec ,load misc/load-static.scm; \
	 echo \(do-it 150000 \"$(srcdir)/debug/mini1.image\" \"$@\"\)) \
	| ./$(VM) -o ./$(VM) -h 3000000  -i $(IMAGE)
debug/mini1.image: $(VM) debug/mini.image
	echo "(write-image \"debug/mini1.image\" \
			   (usual-resumer (lambda (args) \
					    (command-processor #f args))) \
			   \"foo\")" \
	| ./$(VM) -i debug/mini.image

# --------------------
# Generate scheme48.h from VM sources

scheme48.h: vm/arch.scm vm/data.scm link/generate-c-header.scm
	(echo ,bench; \
	 echo ,load-package big-scheme; echo ,open big-scheme; \
	 echo ,load link/generate-c-header.scm; \
	 echo \(make-c-header-file \"$@\" \
				   \"$(srcdir)/vm/arch.scm\" \"$(srcdir)/vm/data.scm\"\)) \
	| $(RUNNABLE) -s-

#scheme48vm.c: $(vm-files)
#	prescheme $(srcdir)/vm/compile-vm

cig: $(CIG) $(CIG).image $(LIBCIG)

$(CIG): $(VM) $(IMAGE) $(srcdir)/cig/cig.scm $(srcdir)/cig/libcig.scm
	(echo ",batch"; \
	 echo ",translate =scheme48/ $(srcdir)/"; \
	 echo ",config ,load $(srcdir)/cig/cig.scm"; \
	 echo ",config ,load $(srcdir)/cig/libcig.scm"; \
	 echo ",load-package cig-standalone"; \
	 echo ",in cig-standalone"; \
	 echo ",translate =scheme48/ $(LIB)/"; \
	 echo ",build cig-standalone-toplevel /tmp/cig") \
	| ./$(VM) -i ./$(IMAGE)
	$(srcdir)/cig/image2script $(LIB)/$(VM) </tmp/cig > $(CIG)
	-chmod +x $(CIG)
	$(RM) /tmp/cig

$(CIG)2:
	(echo ",batch"; \
	 echo ",translate =scheme48/ $(srcdir)/"; \
	 echo ",config ,load $(srcdir)/cig/cig2.scm"; \
	 echo ",config ,load $(srcdir)/cig/libcig.scm"; \
	 echo ",load-package cig-standalone"; \
	 echo ",in cig-standalone"; \
	 echo ",translate =scheme48/ $(LIB)/"; \
	 echo '(dump-scsh-program cig-standalone-toplevel "/tmp/cig")') \
	| ./$(VM) -o ./$(VM) -i ./scsh/scsh.image
	$(srcdir)/cig/image2script $(LIB)/$(VM) </tmp/cig > $(CIG)2
	-chmod +x $(CIG)2
	$(RM) /tmp/cig

$(CIG).image: $(IMAGE) $(VM) $(srcdir)/cig/cig.scm $(srcdir)/cig/libcig.scm
	(echo ",batch"; \
	 echo ",translate =scheme48/ $(srcdir)/"; \
	 echo ",config ,load $(srcdir)/cig/cig.scm"; \
	 echo ",config ,load $(srcdir)/cig/libcig.scm"; \
	 echo ",load-package cig-aux"; \
	 echo ",open define-foreign-syntax"; \
	 echo ",translate =scheme48/ $(LIB)/"; \
	 echo ",dump /tmp/cig \"(CIG Preloaded -bri)\"") \
	| ./$(VM) -o ./$(VM) -i ./$(IMAGE)
	$(srcdir)/cig/image2script $(LIB)/$(VM) \
			-o $(LIB)/$(VM) \
			</tmp/cig > $(CIG).image
	-chmod +x $(CIG).image
	$(RM) /tmp/cig

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# SCSH Specifics
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
scsh: cig scsh/scsh scsh/scsh.image

SCHEME =scsh/awk.scm \
	scsh/char-set.scm \
	scsh/defrec.scm \
	scsh/endian.scm \
	scsh/enumconst.scm \
	scsh/fdports.scm \
	scsh/fileinfo.scm \
	scsh/filemtch.scm \
	scsh/filesys.scm \
	scsh/flock.scm \
	scsh/fname.scm \
	scsh/fr.scm \
	scsh/glob.scm \
	scsh/here.scm \
	scsh/machine/bufpol.scm \
	scsh/machine/errno.scm \
	scsh/machine/fdflags.scm \
	scsh/machine/netconst.scm \
	scsh/machine/packages.scm \
	scsh/machine/signals.scm \
	scsh/machine/time_dep.scm \
	scsh/machine/tty-consts.scm \
	scsh/machine/waitcodes.scm \
	scsh/meta-arg.scm \
	scsh/network.scm \
	scsh/newports.scm \
	scsh/procobj.scm \
	scsh/pty.scm \
	scsh/rdelim.scm \
	scsh/re.scm \
	scsh/rw.scm \
	scsh/scsh-condition.scm \
	scsh/scsh-interfaces.scm \
	scsh/scsh-package.scm \
	scsh/scsh-read.scm \
	scsh/scsh-version.scm \
	scsh/scsh.scm \
	scsh/select.scm \
	scsh/startup.scm \
	scsh/stringcoll.scm \
	scsh/syntax-helpers.scm \
	scsh/syntax.scm \
	scsh/syscalls.scm \
	scsh/time.scm \
	scsh/top.scm \
	scsh/tty.scm \
	scsh/utilities.scm

#    	scsh/dbm.scm db.scm ndbm.scm
#	static.scm static-heap.scm static1.scm
#	jcontrol

# Bogus, but it makes the scm->c->o two-ply dependency work.
# Explicitly giving the .o/.c dependency also makes it go.
############################################################
cig/libcig.c:		cig/libcig.scm
scsh/flock.c:		scsh/flock.scm
scsh/jcontrol2.c:	scsh/jcontrol2.scm
scsh/network.c:		scsh/network.scm
scsh/rdelim.c:		scsh/rdelim.scm
scsh/re.c:		scsh/re.scm
scsh/select.c:	    	scsh/select.scm
scsh/syscalls.c:	scsh/syscalls.scm
scsh/tty.c:		scsh/tty.scm
scsh/time.c:		scsh/time.scm

scsh/scsh: scsh/scsh-tramp.c
	$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) \
	-DVM=\"$(LIB)/$(VM)\" \
	-DIMAGE=\"$(LIB)/scsh.image\" \
	scsh/scsh-tramp.c

scsh/scsh.image: $(VM) $(SCHEME) $(CIG).image
	(echo ",translate =scheme48/ $(srcdir)/"; \
	 echo ",batch on"; \
	 echo ",load-package floatnums"; \
	 echo ",open externals"; \
	 echo "(lookup-all-externals)"; \
	 echo ",config"; \
	 echo ",load $(srcdir)/scsh/let-opt.scm"; \
	 echo ",load $(srcdir)/scsh/scsh-interfaces.scm"; \
	 echo ",load $(srcdir)/scsh/machine/packages.scm"; \
	 echo ",load $(srcdir)/scsh/scsh-package.scm"; \
	 echo ",load-package scsh"; \
	 echo ",load-package scsh-here-string-hax"; \
	 echo ",translate =scheme48/ $(LIB)/"; \
	 echo ",in scsh-level-0"; \
	 echo "(%install-scsh-handlers)"; \
	 echo "(autoreap-policy 'early)"; \
	 echo ",user"; \
	 echo ",open floatnums"; \
	 echo ",open scsh"; \
	 echo "(dump-scsh \"scsh/scsh.image\")") \
	| ./$(VM) -o ./$(VM) -i $(CIG).image

# Removed these lines from scsh/scsh.image rule so you don't lose so
# badly when you are debugging in scsh. -Olin 6/95
#	 echo ",flush";
#	 echo ",flush maps source names files table";

#scsh/scsh.runnable: scsh/scsh.image
#	cig/image2script $(LIB)/$(VM) -o $(LIB)/$(VM) -h 1800000 \
#	    < scsh/scsh.image > $@
#	-chmod +x $@

scsh/regexp/libregexp.a:
	cd ./scsh/regexp; $(MAKE)

scsh/scsh.vm: $(LIBSCSH) $(VM) scsh/scsh.image
	./$(VM) -o ./$(VM) -h 8000000 -i scsh/scsh.image \
		-lm ./vm/ps-interface.scm \
		-lm ./vm/interfaces.scm \
		-lm ./vm/package-defs.scm \
		-lm ./vm/s48-package-defs.scm \
		-dm -m static-heaps -e static-heap-linker \
		-s scsh/static.scm \
		-i scsh/scsh.image -o $@

install-scsh: scsh
	$(RM) $(bindir)/$(RUNNABLE)
	$(INSTALL_PROGRAM) $(srcdir)/scsh/scsh $(bindir)/$(RUNNABLE)
	$(INSTALL_PROGRAM) $(srcdir)/scsh/scsh.image $(LIB)/scsh.image
	$(INSTALL_PROGRAM) $(srcdir)/$(LIBSCSH) $(libdir)/$(LIBSCSH)
	$(RANLIB) $(libdir)/$(LIBSCSH)
	for f in $(srcdir)/scsh/*.scm; \
	    do $(INSTALL_DATA) $$f $(LIB)/scsh/; done

clean-scsh:
	$(RM) scsh/*.o scsh/regexp/*.o scsh/machine/*.o scsh/*.image scsh/scsh 
	$(RM) $(LIBSCSH) scsh/scsh.vm
	-cd scsh/regexp; $(MAKE) clean