BSD 4_4_Lite2 development
[unix-history] / usr / src / contrib / mprof / Makefile.sun3
CommitLineData
990634fb
C
1# %M% %I% %G% %U%
2# Copyright (c) 1987, Benjamin G. Zorn
3#
4# Makefile for MPROF data generation
5#
6
7CC = /bin/cc
8
9# mips CFLAGS = -I. -g -DDEBUG
10# sun4 CFLAGS = -I. -g -Dsun4
11# sun3,vax CFLAGS = -I. -g
12
13# sun4 ASFLAGS = -P -Dsun4
14# sun3,vax,mips ASFLAGS =
15
16CFLAGS = -I. -g
17ASFLAGS =
18BIN = .
19MPLIB = $(BIN)/libc_mp.a
20LINTFLAGS = -bhx
21
22# sun4,mips ASM_SRC = md.s
23# sun4,mips ASM_OBJ = md.o
24# vax,sun3 ASM_SRC =
25# vax,sun3 ASM_SRC =
26
27ASM_SRC =
28ASM_OBJ =
29
30MPROF_MON_SRCS = leak.c malloc.c mpattach.c mprof_mon.c mpstruct.c $(ASM_SRC)
31MPROF_MON_OBJS = leak.o malloc.o mpattach.o mprof_mon.o mpstruct.o $(ASM_OBJ)
32
33MPROF_SRCS = mprof.c mpstruct.c mpgraph.c
34MPROF_OBJS = mprof.o mpstruct.o mpgraph.o
35
36DOC_SRC = mprof.1
37DOC_OBJS = mprof.man
38
39DISTNAME = mprof30
40
41TEST_SRCS = test1.c test2.c
42TEST_OBJS = test1.o test2.o
43
44all: mprof $(MPROF_MON_OBJS) $(DOC_OBJS) $(MPLIB)
45
46# mips $(MPLIB): $(MPROF_MON_OBJS)
47# ar cr libc_mp.a $(MPROF_MON_OBJS)
48# ranlib libc_mp.a
49
50# sun3, sun4 LIB_REPLACE = memalign.o
51# vax LIB_REPLACE = exit.o
52# mips LIB_REPLACE =
53
54LIB_REPLACE = memalign.o
55
56$(MPLIB): $(MPROF_MON_OBJS)
57 cp /lib/libc.a libc_mp.a
58 ar d libc_mp.a malloc.o valloc.o $(LIB_REPLACE)
59 ar r libc_mp.a $(MPROF_MON_OBJS)
60 ranlib libc_mp.a
61
62test: $(TEST_OBJS) test1-demo test2-demo
63
64mprof-mon-lint:
65 lint $(LINTFLAGS) $(MPROF_MON_SRCS) > mprof.lint
66
67mprof-lint:
68 lint $(LINTFLAGS) $(MPROF_SRCS) > mprof.lint
69
70clean:
71 rm -f *.o mprof.lint mprof-mon.lint \
72 $(DOC_OBJS) \
73 $(TEST_OBJS) \
74 test1 test1.data test1.mprof \
75 test2 test2.data test2.mprof \
76 libc_mp.a mprof mprof.data
77
78leak.o: leak.c
79mprof_mon.o: mprof_mon.c
80mpstruct.o: mpstruct.c
81mpgraph.o: mpgraph.c
82mprof.o: mprof.c
83md.o: md.s
84 $(AS) $(ASFLAGS) -o md.o md.s
85
86malloc.o: malloc.c
87 $(CC) $(CFLAGS) -Dmalloc=__malloc__ -Dfree=__free__ -Drealloc=__realloc__ malloc.c -c
88
89mprof: $(MPROF_OBJS)
90 $(CC) $(CFLAGS) -o mprof $(MPROF_OBJS)
91
92mprof.man: mprof.1
93 nroff -man mprof.1 > mprof.man
94
95dist: MANIFEST
96 tar cvf $(DISTNAME).tar `cat MANIFEST`
97 compress $(DISTNAME).tar
98
99#
100# Examples to test if MPROF is installed correctly
101#
102
103# A very simple test (tests calloc and valloc)
104
105test1-demo: test1.data
106 $(BIN)/mprof -normal test1 test1.data > test1.mprof
107
108test1.mprof: test1.data
109 $(BIN)/mprof -normal test1 test1.data > test1.mprof
110
111test1.data: test1
112 test1
113 cp mprof.data test1.data
114
115test1: test1.o $(MPLIB)
116 $(CC) $(CFLAGS) -o test1 test1.o $(MPLIB)
117
118test1.o: test1.c
119
120
121# test2 program (example from paper)
122
123test2-demo: test2.data
124 $(BIN)/mprof -normal test2 test2.data > test2.mprof
125
126test2.mprof: test2.data
127 $(BIN)/mprof -normal test2 test2.data > test2.mprof
128
129test2.data: test2
130 test2
131 cp mprof.data test2.data
132
133test2: test2.o $(MPLIB)
134 $(CC) $(CFLAGS) -o test2 test2.o $(MPLIB)
135
136test2.o: test2.c
137
138
139###
140leak.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \
141 /usr/include/frame.h
142malloc.o: /usr/include/sys/types.h /usr/include/stdio.h
143mprof.o: /usr/include/stdio.h /usr/include/sys/file.h /usr/include/ctype.h \
144 /usr/include/a.out.h /usr/include/sys/exec.h /usr/include/stab.h \
145 mprof.h /usr/include/sys/types.h /usr/include/frame.h
146mprof_mon.o: /usr/include/stdio.h /usr/include/sys/file.h mprof.h \
147 /usr/include/sys/types.h /usr/include/frame.h
148mpstruct.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \
149 /usr/include/frame.h
150mpgraph.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \
151 /usr/include/frame.h