# 
# Copyright (C) 1999, 2000, 2001  Network Associates, Incorporated (NAI)
# All rights reserved.
#
# This file is part of the NAI Generic Software Wrappers Toolkit
# (GSWTK).  See ftp://ftp.tislabs.com/pub/wrappers/ for the latest
# distribution.
#
# The GSWTK is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# The GSWTK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#

TOPDIR = ../..

include ${TOPDIR}/mak/config.mak

KERNEL_SOURCE	= yes

CFLAGS	+= -I ${TOPDIR}/toolkits/eventfs/src
CFLAGS	+= -D_WSS -O2 -Wall -Wpointer-arith
CFLAGS	+= -Wstrict-prototypes
CFLAGS	+= -g

# CFLAGS	+= -DWSI_MALLOC_FENCE

LIBBASE	= wsi

CPUSRCS	= wsi_${CPU}_hook.c wsi_${CPU}_custom.S wsi_${CPU}_dispatch.S

OBJS	= loader${OBJ} \
	  wsi_custom${OBJ} wsi_db${OBJ} wsi_dispatch${OBJ} wsi_exported${OBJ} \
	  wsi_file${OBJ} wsi_fileutil${OBJ} wsi_init${OBJ} wsi_intercept${OBJ} \
	  wsi_malloc${OBJ} wsi_module${OBJ} wsi_os${OBJ} wsi_path${OBJ} \
	  wsi_process${OBJ} wsi_syscall${OBJ} wsi_syscallnames${OBJ} \
	  wsi_sysevents${OBJ} wsi_time${OBJ} wsi_utilities${OBJ} \
          wsi_wrctl${OBJ} wsi_wrv${OBJ}

# architecture-dependent files
OBJS	+= wsi_${CPU}_custom${OBJ} wsi_${CPU}_dispatch${OBJ} \
	   wsi_${CPU}_hook${OBJ}

COPYTARGET	= ${TOPDIR}/${WSSTARGETDIR}
CLEANFILES	= core wsi_syscallnames.c ${CPUSRCS}

SUBDIR	= include

include ${TOPDIR}/mak/library.mak

wsi_syscallnames.c wsi_intercept.h: parsesyscall.pl
	./parsesyscall.pl

wsi_offsets.inc:
	${TOPDIR}/config/linux/task_struct/task_struct > $@

${CPUSRCS}: wsi_offsets.inc
	@${LN} ${CPU}/$@ $@

