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