#
# Copyright (c) 1997-1998 The University of Utah and the Flux Group.
# 
# This file is part of the OSKit Linux Glue Libraries, which are free
# software, also known as "open source;" you can redistribute them and/or
# modify them under the terms of the GNU General Public License (GPL),
# version 2, as published by the Free Software Foundation (FSF).
# 
# The OSKit 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 GPL for more details.  You should have
# received a copy of the GPL along with the OSKit; see the file COPYING.  If
# not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
#

#
# This make cruft is shared between the Linux fs and dev stuff.
# The respective fs and dev makefiles include this file,
# which should be done after setting $(OBJFILES).
#

ifndef _oskit_linux_shared_makerules_
_oskit_linux_shared_makerules_ = yes

SRCDIRS +=	$(OSKIT_SRCDIR)/linux/shared			\
		$(OSKIT_SRCDIR)/linux/shared/libc		\
		$(OSKIT_SRCDIR)/linux/src/lib			\
		$(OSKIT_SRCDIR)/linux/src/arch/i386/lib		\
#		$(OSKIT_SRCDIR)/linux/src/arch/i386/kernel

INCDIRS +=	$(OSKIT_SRCDIR)/linux/src/include		\
		$(OSKIT_SRCDIR)/linux/shared/libc		\
		objinclude

DEFINES += -DOSKIT -D__KERNEL__

# If debugging is enabled,
# define the symbol OSKIT_DEBUG instead of the usual DEBUG,
# because the Linux drivers have their own meaning for DEBUG.
ifneq "$(filter -DDEBUG, $(DEFINES))" ""
DEFINES := $(subst -DDEBUG, -DOSKIT_DEBUG, $(DEFINES))
endif

#
# We need to do this here since it adds stuff to $(OBJFILES).
#
### Include other appropriate make rules files ###
include $(OSKIT_SRCDIR)/GNUmakerules-lib

# Implicitly include the shared global.h header file at the top of all sources.
# This header #defines a bunch of global Linux symbols
# to ensure linker namespace cleanliness and avoid conflicts.
OSKIT_CPPFLAGS += -include $(OSKIT_SRCDIR)/linux/shared/global.h
$(OBJFILES): $(OSKIT_SRCDIR)/linux/shared/global.h

# Create the objinclude/asm include symlink.
# We have to kludge a little to get it to work right,
# because OSKIT_SRCDIR might be either an absolute or a relative path
# and it will only work reliably if interpreted from _this_ directory.
$(OBJFILES): objinclude/asm
CLEAN_FILES += objinclude objinclude_asm
objinclude/asm:
	  -mkdir -p objinclude
	  ln -s ../objinclude_asm objinclude/asm
	  ln -s $(OSKIT_SRCDIR)/linux/src/include/asm-i386 objinclude_asm

endif
