GNUmakefile
2.53 KB
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
#
# Makefile for RSP assembler
#
# This Makefile is a little unusual because the assembler uses
# yacc, lex, awk scripts, other-people's C files, etc.
#
include $(ROOT)/usr/include/make/commondefs
CVERSION = -ansi
OPTIMIZER = -g
# local defs
LCDEFS =
# local includes
LCINCS = -I. -I./Include -I$(ROOT)/PR/include
GCINCS=-D_LANGUAGE_C -I$(ROOT)/host_include
GLDOPTS=
YFLAGS = -v -d -t
#
# This list is so clobber can really clean up...
#
GENERATED_FILES = y.tab.h y.tab.c y.output codetablesetup.h lex.yy.c \
Include/y.tab.h
#
# The assembler uses the disassembly module from the simulator.
# This is ugly, but assures they are both in synch.
#
DISASM_OBJS = disasm.o
CFILES = rspasm.c codetable.c
PARSER_OBJS = parser.lx.o parser.g.o
OBJECTS =$(CFILES:.c=.o) $(PARSER_OBJS) $(DISASM_OBJS)
LDLIBS = -ll -lm
TARGETS = rspasm buildtask
default: ${TARGETS}
install: ${TARGETS}
# $(INSTALL) -m 555 -F /usr/sbin $(TARGETS)
$(INSTALL) -m 555 -F /usr/sbin -src rspasm rspasm1201
exports install: default
clean:
/bin/rm -rf ${OBJECTS}
clobber:
/bin/rm -rf ${OBJECTS} ${TARGETS} ${MKDEPFILE} ${GENERATED_FILES}
buildtask: buildtask.o
$(CC) -o $@ buildtask.o ${LDFLAGS}
rspasm: ${OBJECTS}
$(CC) -o $@ ${OBJECTS} ${LDFLAGS}
parser.g.o: parser.g.y y.tab.h y.tab.c ./Include/types.h ./Include/macros.h
$(NAWK) -f ./AwkScripts/hackyacc.awk < y.tab.c > /usr/tmp/y.tab.c
mv /usr/tmp/y.tab.c y.tab.c
$(CC) -c ${INCLUDES} $(CFLAGS) y.tab.c -o parser.g.o
parser.lx.o: parser.lx.l y.tab.h
lex -l parser.lx.l
$(CC) -c ${INCLUDES} $(CFLAGS) lex.yy.c -o parser.lx.o
y.tab.h : parser.g.y ./Include/types.h ./Include/macros.h
rm -f y.tab.h
yacc $(YFLAGS) parser.g.y
$(NAWK) -v FILENAME=y.tab.h -f ./AwkScripts/wrapfile.awk y.tab.h > /tmp/y.tab.h
mv /tmp/y.tab.h y.tab.h
cp y.tab.h ./Include
y.tab.c: y.tab.h
#
# Tricky, since we are using the original .c, the compile will leave the
# .o in this directory. So enforce the dependencies to make sure we get
# an up-to-date copy.
#
disasm.o: ../rspsim/disasm.c ../rspsim/disasm.h
$(CC) -c ${INCLUDES} $(CFLAGS) ../rspsim/disasm.c -o ./disasm.o
codetablesetup.h: ./Include/vopcodetable.t ./Include/opcodetable.t ./AwkScripts/buildopcode.awk
cat ./Include/opcodetable.t ./Include/vopcodetable.t | $(NAWK) -f ./AwkScripts/buildopcode.awk > codetablesetup.h
#
# Apparently we need these explicit rules because makedepend isn't
# smart enough to figure out the machine-generated .h files and
# do the right thing...
#
rspasm.c: y.tab.h
codetable.c: y.tab.h codetablesetup.h
# DO NOT DELETE THIS LINE -- make depend depends on it.