# Makefile for kernprof

# LINUX_INC_ROOT is the root of the include directory of the Linux tree
# for which you want to compile.  If you want to compile for a Linux version
# other than the one currently installed on your machine, define it in
# your environment or on the make command line.
ifndef LINUX_INC_ROOT
LINUX_INC_ROOT = /usr/include
endif
ifndef INSTALLROOT
INSTALLROOT = /usr
endif
ifndef MANINSTALLROOT
MANINSTALLROOT = /usr/share
endif

PROGS = kernprof

CC = gcc
CFLAGS = -g -O2 -fomit-frame-pointer
INCLUDES = -I./ -I$(LINUX_INC_ROOT)

all: $(PROGS)

kernprof: kernprof.o Makefile gmon_out.h \
		$(LINUX_INC_ROOT)/linux/profile.h
	$(CC) kernprof.o -o $@

install: kernprof
	install -s -m 0755 kernprof $(INSTALLROOT)/sbin
	install -m 0644 kernprof.1 $(MANINSTALLROOT)/man/man1

kernprof.o:	kernprof.c gmon_out.h $(LINUX_INC_ROOT)/linux/profile.h
	$(CC) -c ${CFLAGS} ${INCLUDES} $<

clean:
	$(RM) $(PROGS) *.o *~

#%.o:%.c
#	$(CC) -c $(CFLAGS) -I$(LINUX_INC_ROOT) $<
