aboutsummaryrefslogtreecommitdiff
path: root/unix/f2c/src/mkfile.plan9
blob: 73466121ecc93b56e5d6aeb5d18197d4a87d2f97 (plain) (blame)
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
#	Plan 9 mkfile for f2c, a Fortran 77 to C converter

</$objtype/mkfile
NPROC = 1
CC = pcc
CFLAGS = -DANSI_Libraries -DNO_LONG_LONG

%.$O: %.c
	$CC -c $CFLAGS $stem.c

OBJECTSd = main.$O init.$O gram.$O lex.$O proc.$O equiv.$O data.$O format.$O \
	  expr.$O exec.$O intr.$O io.$O misc.$O error.$O mem.$O names.$O \
	  output.$O p1output.$O pread.$O put.$O putpcc.$O vax.$O formatdata.$O \
	  parse_args.$O niceprintf.$O cds.$O sysdep.$O version.$O

MALLOC = malloc.$O
# To use the malloc whose source accompanies the f2c source, add malloc.$O
# to the right-hand side of the "MALLOC =" line above, so it becomes
#	MALLOC = malloc.$O
# This gives faster execution on some systems, but some other systems do
# not tolerate replacement of the system's malloc.

OBJECTS = $OBJECTSd $MALLOC

all:N: xsum.out f2c

f2c: $OBJECTS
	$CC $LDFLAGS $OBJECTS -o f2c

# The following used to be a rule for gram.c rather than gram1.c, but
# there are too many broken variants of yacc around, so now we
# distribute a correctly function gram.c (derived with a Unix variant
# of the yacc from plan9).

gram1.c: gram.head gram.dcl gram.expr gram.exec gram.io defs.h tokdefs.h
	( sed <tokdefs.h "s/#define/%token/" ;\
		cat gram.head gram.dcl gram.expr gram.exec gram.io ) >gram.in
	$YACC $YFLAGS gram.in
	@echo "(There should be 4 shift/reduce conflicts.)"
	sed 's/^# line.*/\/* & *\//' y.tab.c >gram.c
	rm -f gram.in y.tab.c

$OBJECTSd: defs.h ftypes.h defines.h machdefs.h sysdep.h

tokdefs.h: tokens
	grep -n . <tokens | sed 's/([^:]*):(.*)/#define \2 \1/' >tokdefs.h

cds.$O: sysdep.h
exec.$O: p1defs.h names.h
expr.$O: output.h niceprintf.h names.h
format.$O: p1defs.h format.h output.h niceprintf.h names.h iob.h
formatdata.$O: format.h output.h niceprintf.h names.h
gram.$O: p1defs.h
init.$O: output.h niceprintf.h iob.h
intr.$O: names.h
io.$O: names.h iob.h
lex.$O : tokdefs.h p1defs.h
main.$O: parse.h usignal.h
mem.$O: iob.h
names.$O: iob.h names.h output.h niceprintf.h
niceprintf.$O: defs.h names.h output.h niceprintf.h
output.$O: output.h niceprintf.h names.h
p1output.$O: p1defs.h output.h niceprintf.h names.h
parse_args.$O: parse.h
proc.$O: tokdefs.h names.h niceprintf.h output.h p1defs.h
put.$O: names.h pccdefs.h p1defs.h
putpcc.$O: names.h
vax.$O: defs.h output.h pccdefs.h
output.h: niceprintf.h

put.$O putpcc.$O: pccdefs.h

f2c.t: f2c.1t
	troff -man f2c.1t >f2c.t

#f2c.1: f2c.1t
#	nroff -man f2c.1t | col -b | uniq >f2c.1

clean:
	rm -f *.$O f2c tokdefs.h f2c.t

veryclean: clean
	rm -f xsum

b = Notice README cds.c data.c defines.h defs.h equiv.c error.c \
	exec.c expr.c f2c.1 f2c.1t f2c.h format.c format.h formatdata.c \
	ftypes.h gram.c gram.dcl gram.exec gram.expr gram.head gram.io \
	init.c intr.c io.c iob.h lex.c machdefs.h main.c \
	malloc.c mem.c memset.c misc.c names.c names.h niceprintf.c \
	niceprintf.h output.c output.h p1defs.h p1output.c \
	parse.h parse_args.c pccdefs.h pread.c proc.c put.c putpcc.c \
	sysdep.c sysdep.h tokens usignal.h vax.c version.c xsum.c

xsum: xsum.c
	$CC $CFLAGS -o xsum xsum.c

#Check validity of transmitted source...
xsum.out: xsum $b
	./xsum $b >xsum1.out
	cmp xsum0.out xsum1.out && mv xsum1.out xsum.out

#On non-Unix systems that end lines with carriage-return/newline pairs,
#use "make xsumr.out" rather than "make xsum.out".  The -r flag ignores
#carriage-return characters.
xsumr.out: xsum $b
	./xsum -r $b >xsum1.out
	cmp xsum0.out xsum1.out && mv xsum1.out xsumr.out