#
# $RCSfile: Makefile.irix,v $
#
# x-kernel v3.3
#
# Copyright (c) 1996,1993,1991,1990  Arizona Board of Regents
# Modifications Copyright (c) 1993  Massachusetts Board of Regents
#
# $Log: Makefile.irix,v $
# Revision 1.4  1996/06/03 23:16:39  slm
# Updated version & copyright.
#
# Revision 1.3  1996/01/30  20:32:15  slm
# Cosmetic changes.
#
# Revision 1.2  1995/10/17  22:24:00  slm
# Create .o files in OBJS directories, Makedep files in
# DEPS directories, and ComposeFiles in COMS directories.
#
# Revision 1.1  1995/07/29  02:27:17  slm
# Initial revision
#
# Revision 1.6.1.1.1.2  1994/11/22  21:51:17  hkaram
# Added IRIX user_level changes
#
# Revision 1.6.1.1.1.1  1994/11/12  19:22:14  hkaram
# New branch
#
# Revision 1.6.1.1  1994/04/14  00:14:01  menze
# Fixed usage of LDFLAGS
#
# Revision 1.6  1994/02/05  00:07:23  menze
#   [ 1994/01/24          menze ]
#   Added RANLIB and AR definitions
#
#   [ 1994/01/06          menze ]
#   Defining XK_BIN_TYPE variable
#   Modified LIBPATH for external libraries
#
#   [ 1994/01/03          menze ]
#   Removed the -woff 314 cc flag
#
# Revision 1.5  1993/12/15  23:00:16  menze
# Now includes Makefile.nolibs
# Added X_IRIX CPP flag
#
# Revision 1.4  1993/12/14  00:07:58  menze
# Now looks textually similar to other platform build files
#
# Revision 1.3  1993/11/13  01:08:04  menze
# Original version from UMass
#
# Build-directory Makefile for the irix/mips platform.
#
# There are many variables defined here that may vary from site to site.  If
# you are the first person at your site to build an x-kernel, look over the
# definitions carefully and determine what the appropriate values should be
# for your site.

XPLATFORM = irix
MACHINE = mips
XK_TYPE = UL
XK_TYPE_DIR = user_level
XK_BIN_TYPE := $(XPLATFORM)-$(MACHINE)

# HOWTOCOMPILE controls optimization flags and tracing routines.
# It should be set to either DEBUG or OPTIMIZE

HOWTOCOMPILE = DEBUG
#HOWTOCOMPILE = OPTIMIZE

HOW := $(XK_TYPE)-$(HOWTOCOMPILE)-$(XK_BIN_TYPE)
HOWUTIL := $(HOWTOCOMPILE)-$(XK_BIN_TYPE)

# If XK_BYPASS_RCS is defined (to anything), RCS consistency checks will be
# disabled.  This can make a build run significantly faster.

XK_BYPASS_RCS = blurp

# Compiler-related flags.  If you decide to change compilers, some of these
# flags may also have to change.

CC = gcc

ifeq ($(CC),gcc)

DEBUGWARNINGS = -Wunused
OPTIMIZEWARNINGS = -Wuninitialized
WARNINGS = -Wreturn-type -Wimplicit -Wswitch -Wchar-subscripts    \
           -Wshadow -Wmissing-prototypes -Winline -Wpointer-arith \
           $($(HOWTOCOMPILE)WARNINGS)
CC_SPECIFIC_FLAGS = -fwritable-strings
DEBUGCFLAGS = -g
OPTIMIZECFLAGS = -O
# For PC sampling profile support, add -p to LDFLAGS
LDFLAGS = $(LIBPATH) -v

else	# native cc

DEBUGWARNINGS =
OPTIMIZEWARNINGS =
WARNINGS = $($(HOWTOCOMPILE)WARNINGS)
CC_SPECIFIC_FLAGS = -ansi
OPTIMIZECFLAGS = -O
DEBUGCFLAGS = -g
# For PC sampling profile support, add -p to LDFLAGS
LDFLAGS = $(LIBPATH) -v

endif

# Libraries.  Some of these libraries are labeled 'optional', indicating that
# they are only used by some protocols.  Names and locations of libraries may
# be site-specific.

LIBPATH = -L$(XRT)/lib -L$(XRT)/lib/$(XK_BIN_TYPE)
irix_LIBS = -lmpc	# required
LIB_GNUMP = -lgmp	# GNU multi-precision library, optional

SED = sed
MAKE = make
REALCC = /bin/cc
RANLIB = echo RANLIB is disabled:	# no ranlib in Irix
AR = ar

# XRT names a path to the top of the x-kernel source tree

XRT = ../../..

# TMP_CPPFLAGS and TMP_CFLAGS apply to the build directory only, and won't be
# propagated to compilation in other x-kernel directories.

# TMP_CPPFLAGS =
# TMP_CFLAGS =

# When compiling private versions of x-kernel utilities in your build area,
# you may need to add include paths.  Add these to the TMP_INCLUDES variable.

TMP_INCLUDES = $(COMPOSE_INCLUDES)

MAKEFILE = Makefile
MAKEFLAGS += --no-print-directory

OPTIMIZECPPFLAGS =
DEBUGCPPFLAGS = -DXK_DEBUG
BUILD_CPPFLAGS := $($(HOWTOCOMPILE)CPPFLAGS) -Dsgi -DX_IRIX
BUILD_CFLAGS = $($(HOWTOCOMPILE)CFLAGS)

all: xkernel

# The COMPOSE_MAKEFILE is generated from graph.comp when 'make compose' is run.

COMPOSE_MAKEFILE = Makefile.local
COMPOSEFLAGS = -f -m $(COMPOSE_MAKEFILE)
include $(COMPOSE_MAKEFILE)

$(COMPOSE_MAKEFILE):
	@touch $(COMPOSE_MAKEFILE)

# If you compile source code in your build area which isn't associated with a
# particular protocol, add the source names to PRIVSRC and the object names
# (e.g., ./OBJS/$(HOW)/foo.o) to PRIVOBJ.

#PRIVSRC = \
#
#PRIVOBJ = \

include $(XRT)/$(XK_TYPE_DIR)/build/Template/Makefile.common

# Include Makefile.nolibs to compile without libraries

include $(XRT)/$(XK_TYPE_DIR)/build/Template/Makefile.nolibs

xkernel: $(OBJ) $(XLIBS)
	@echo linking xkernel ...
	@$(CC) $(LDFLAGS) -o xkernel $(OBJ) $(XLIBS) $(COMPOSE_LIBS) \
	    $($(XPLATFORM)_LIBS)

include DEPS/Makedep.$(HOW)
