Commit | Line | Data |
---|---|---|
53f05f1f C |
1 | # %M% %I% %G% %U% |
2 | # Copyright (c) 1987, Benjamin G. Zorn | |
3 | # | |
4 | # Makefile for MPROF data generation | |
5 | # | |
6 | ||
7 | CC = /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 | ||
16 | CFLAGS = -I. -g | |
17 | ASFLAGS = | |
18 | BIN = . | |
19 | MPLIB = $(BIN)/libc_mp.a | |
20 | LINTFLAGS = -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 | ||
27 | ASM_SRC = | |
28 | ASM_OBJ = | |
29 | ||
30 | MPROF_MON_SRCS = leak.c malloc.c mpattach.c mprof_mon.c mpstruct.c $(ASM_SRC) | |
31 | MPROF_MON_OBJS = leak.o malloc.o mpattach.o mprof_mon.o mpstruct.o $(ASM_OBJ) | |
32 | ||
33 | MPROF_SRCS = mprof.c mpstruct.c mpgraph.c | |
34 | MPROF_OBJS = mprof.o mpstruct.o mpgraph.o | |
35 | ||
36 | DOC_SRC = mprof.1 | |
37 | DOC_OBJS = mprof.man | |
38 | ||
39 | DISTNAME = mprof30 | |
40 | ||
41 | TEST_SRCS = test1.c test2.c | |
42 | TEST_OBJS = test1.o test2.o | |
43 | ||
44 | all: 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 | ||
54 | LIB_REPLACE = exit.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 | ||
62 | test: $(TEST_OBJS) test1-demo test2-demo | |
63 | ||
64 | mprof-mon-lint: | |
65 | lint $(LINTFLAGS) $(MPROF_MON_SRCS) > mprof.lint | |
66 | ||
67 | mprof-lint: | |
68 | lint $(LINTFLAGS) $(MPROF_SRCS) > mprof.lint | |
69 | ||
70 | clean: | |
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 | ||
78 | leak.o: leak.c | |
79 | mprof_mon.o: mprof_mon.c | |
80 | mpstruct.o: mpstruct.c | |
81 | mpgraph.o: mpgraph.c | |
82 | mprof.o: mprof.c | |
83 | md.o: md.s | |
84 | $(AS) $(ASFLAGS) -o md.o md.s | |
85 | ||
86 | malloc.o: malloc.c | |
87 | $(CC) $(CFLAGS) -Dmalloc=__malloc__ -Dfree=__free__ -Drealloc=__realloc__ malloc.c -c | |
88 | ||
89 | mprof: $(MPROF_OBJS) | |
90 | $(CC) $(CFLAGS) -o mprof $(MPROF_OBJS) | |
91 | ||
92 | mprof.man: mprof.1 | |
93 | nroff -man mprof.1 > mprof.man | |
94 | ||
95 | dist: 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 | ||
105 | test1-demo: test1.data | |
106 | $(BIN)/mprof -normal test1 test1.data > test1.mprof | |
107 | ||
108 | test1.mprof: test1.data | |
109 | $(BIN)/mprof -normal test1 test1.data > test1.mprof | |
110 | ||
111 | test1.data: test1 | |
112 | test1 | |
113 | cp mprof.data test1.data | |
114 | ||
115 | test1: test1.o $(MPLIB) | |
116 | $(CC) $(CFLAGS) -o test1 test1.o $(MPLIB) | |
117 | ||
118 | test1.o: test1.c | |
119 | ||
120 | ||
121 | # test2 program (example from paper) | |
122 | ||
123 | test2-demo: test2.data | |
124 | $(BIN)/mprof -normal test2 test2.data > test2.mprof | |
125 | ||
126 | test2.mprof: test2.data | |
127 | $(BIN)/mprof -normal test2 test2.data > test2.mprof | |
128 | ||
129 | test2.data: test2 | |
130 | test2 | |
131 | cp mprof.data test2.data | |
132 | ||
133 | test2: test2.o $(MPLIB) | |
134 | $(CC) $(CFLAGS) -o test2 test2.o $(MPLIB) | |
135 | ||
136 | test2.o: test2.c | |
137 | ||
138 | ||
139 | ### | |
140 | leak.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \ | |
141 | /usr/include/frame.h | |
142 | malloc.o: /usr/include/sys/types.h /usr/include/stdio.h | |
143 | mprof.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 | |
146 | mprof_mon.o: /usr/include/stdio.h /usr/include/sys/file.h mprof.h \ | |
147 | /usr/include/sys/types.h /usr/include/frame.h | |
148 | mpstruct.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \ | |
149 | /usr/include/frame.h | |
150 | mpgraph.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \ | |
151 | /usr/include/frame.h |