# Copyright (c) 1987, Benjamin G. Zorn
# Makefile for MPROF data generation
# mips CFLAGS = -I. -g -DDEBUG
# sun4 CFLAGS = -I. -g -Dsun4
# sun3,vax CFLAGS = -I. -g
# sun4 ASFLAGS = -P -Dsun4
# sun3,vax,mips ASFLAGS =
# sun4,mips ASM_SRC = md.s
# sun4,mips ASM_OBJ = md.o
MPROF_MON_SRCS = leak.c malloc.c mpattach.c mprof_mon.c mpstruct.c $(ASM_SRC)
MPROF_MON_OBJS = leak.o malloc.o mpattach.o mprof_mon.o mpstruct.o $(ASM_OBJ)
MPROF_SRCS = mprof.c mpstruct.c mpgraph.c
MPROF_OBJS = mprof.o mpstruct.o mpgraph.o
TEST_SRCS = test1.c test2.c
TEST_OBJS = test1.o test2.o
all: mprof $(MPROF_MON_OBJS) $(DOC_OBJS) $(MPLIB)
# mips $(MPLIB): $(MPROF_MON_OBJS)
# ar cr libc_mp.a $(MPROF_MON_OBJS)
# sun3, sun4 LIB_REPLACE = memalign.o
# vax LIB_REPLACE = exit.o
$(MPLIB): $(MPROF_MON_OBJS)
ar d libc_mp.a malloc.o valloc.o $(LIB_REPLACE)
ar r libc_mp.a $(MPROF_MON_OBJS)
test: $(TEST_OBJS) test1-demo test2-demo
lint $(LINTFLAGS) $(MPROF_MON_SRCS) > mprof.lint
lint $(LINTFLAGS) $(MPROF_SRCS) > mprof.lint
rm -f *.o mprof.lint mprof-mon.lint \
test1 test1.data test1.mprof \
test2 test2.data test2.mprof \
libc_mp.a mprof mprof.data
$(AS) $(ASFLAGS) -o md.o md.s
$(CC) $(CFLAGS) -Dmalloc=__malloc__ -Dfree=__free__ -Drealloc=__realloc__ malloc.c -c
$(CC) $(CFLAGS) -o mprof $(MPROF_OBJS)
nroff -man mprof.1 > mprof.man
tar cvf $(DISTNAME).tar `cat MANIFEST`
# Examples to test if MPROF is installed correctly
# A very simple test (tests calloc and valloc)
$(BIN)/mprof -normal test1 test1.data > test1.mprof
$(BIN)/mprof -normal test1 test1.data > test1.mprof
$(CC) $(CFLAGS) -o test1 test1.o $(MPLIB)
# test2 program (example from paper)
$(BIN)/mprof -normal test2 test2.data > test2.mprof
$(BIN)/mprof -normal test2 test2.data > test2.mprof
$(CC) $(CFLAGS) -o test2 test2.o $(MPLIB)
leak.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \
malloc.o: /usr/include/sys/types.h /usr/include/stdio.h
mprof.o: /usr/include/stdio.h /usr/include/sys/file.h /usr/include/ctype.h \
/usr/include/a.out.h /usr/include/sys/exec.h /usr/include/stab.h \
mprof.h /usr/include/sys/types.h /usr/include/frame.h
mprof_mon.o: /usr/include/stdio.h /usr/include/sys/file.h mprof.h \
/usr/include/sys/types.h /usr/include/frame.h
mpstruct.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \
mpgraph.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h \