#  $Id: makefile_public 12202 2009-01-19 11:15:12Z Bill Ellis $
#-------------------------------------------------------------------------------
#  (C) Praxis High Integrity Systems Limited
#-------------------------------------------------------------------------------
# 
#  The SPARK toolset is free software; you can redistribute it and/or modify it
#  under terms of the GNU General Public License as published by the Free
#  Software Foundation; either version 3, or (at your option) any later
#  version. The SPARK toolset 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 distributed with the SPARK toolset; see file
#  COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy of
#  the license.
# 
#===============================================================================


################################################################################
# PURPOSE
#-------------------------------------------------------------------------------
# Makefile for the Simplifier Utilities
# Build the Simplifier Utilities on NT, Solaris, Linux or MacOS X
################################################################################


################################################################################
# BUILD CONFIGURATION
################################################################################

# Name of the output program.
OUTPUTNAME:=wrap_utility


################################################################################
# DETERMINE HOST INFORMATION
################################################################################

# Determine which platform this makefile is being run on.
TARGET:= $(shell uname -s)

# Canonicalize the target string.
ifeq ($(findstring CYGWIN_NT,${TARGET}),CYGWIN_NT)
    TARGET:=Windows
endif


################################################################################
# PLATFORM INDEPENDENT CONFIGURATION
################################################################################

ROOT:=..
COMMON:=${ROOT}/common
commonopts:= -g -gnatwaeY -gnat95 -gnaty3abefhiklnprt -I${ROOT}/examiner
gnatmakeopts:= ${commonopts} -O1
gccopts:=
bindopts:= -E
link_args:=


################################################################################
# PLATFORM SPECIFIC CONFIGURATION
################################################################################

# Windows.
ifeq (${TARGET},Windows)
    EXEEXTN:=.exe
endif

# Solaris.
ifeq (${TARGET},SunOS)
    EXEEXTN:=
endif

# Linux.
ifeq (${TARGET},Linux)
    EXEEXTN:=
endif

# Darwin (Mac OS X).
ifeq (${TARGET},Darwin)
    EXEEXTN:=
endif


################################################################################
# TARGETS
################################################################################

all: ${OUTPUTNAME}${EXEEXTN}

examine: preamble prep
	spark @wrap_utility.smf

examineplain: preamble prep
	spark -plain @wrap_utility.smf

${OUTPUTNAME}${EXEEXTN}: preamble prep
	gnatmake ${gnatmakeopts} wrap_utility -o ${OUTPUTNAME}${EXEEXTN} -cargs ${gccopts} -bargs ${bindopts} -largs ${link_args}

preamble:
	make -C ${ROOT}/examiner clean

prep:
	make -C ${ROOT}/examiner prep

clean:
	rm -f *.o *.ali

reallyclean: clean
	rm -f ${OUTPUTNAME}${EXEEXTN}
	rm -f *.lsb *.lss spark.rep
	rm -f b~*.ad?


################################################################################
# END-OF-FILE
