# Makefile template

# Defines MSR, KERNELSRCROOT and RPROOT.  Note that MSR could be
# defined in the shell environment if you do not want to use the
# standard files.  For example
#   setenv MSR /users/kenw/arl/repository/msr
#  OR
#   export MSR=/users/kenw/arl/repository/msr
### OLD ### MSR ?= /users/onl/wu_arl/msr
MSR ?= /export/NetBSD
KERNELSRCROOT = ${MSR}/usr/src/sys
RPROOT        = /users/onl/wu_arl/msr/rp

MODOBJ=combined.o

# name of kernel plugin
KMOD=<TEMPLATE>

CC=/usr/local/xcomp/bin/i386--netbsdelf-gcc
LD=/usr/local/xcomp/bin/i386--netbsdelf-ld

INCLUDES =-I${KERNELSRCROOT} -I${RPROOT} -I.

#	MSR			used in <msr/xxx>
#	MSR_PLUGIN		req'd for plugins
#	_KERNEL and _LKM	req'd in apic
CFLAGS = -DMSR -D_KERNEL -DMSR_PLUGIN -D_LKM ${INCLUDES} -fno-builtin
DEBUG = -DMSRDEBUG $(CFLAGS)

SRCS=$(KMOD).c

# ---------------------------------------------------------------------
# In most cases, you should not have to change anything below this line
# ---------------------------------------------------------------------

OBJS=$(SRCS:.c=.o)

all:	$(MODOBJ) check

check:
	nm -u combined.o | sed -e '/U M_MSR/	d'

touch:
	touch *
	touch *.o
	touch $(MODOBJ)

.PHONY:	clean
clean:
	rm -f $(OBJS) $(MODOBJ)

.PHONY:	debug
debug:
	make CFLAGS="$(DEBUG)"

$(OBJS):	stdinc.h $(KMOD).h

$(MODOBJ): $(OBJS)
	$(LD) -r -o $(MODOBJ) $(OBJS)

