###############################################################################
# Copyright (c) 2012-2012 Integrated Device Technology, Inc.
# All Rights Reserved
#
# This file is provided for use with IDT products only, and does not
# convey any license, whether express or implied, to any intellectual
# property rights of Integrated Device Technology, Inc.  Distribution,
# copying or modification of the contents of this file and/or any
# derivatives thereto is not permitted, except as specifically
# authorized in writing. This notice shall be included in its entirety
# on all copies made from this file.
#
# The contents herein are the proprietary and confidential information
# of Integrated Device Technology Inc. and shall not be distributed or
# furnished to third parties or made public without prior written
# permission by Integrated Device Technology Inc.  Disclosures of this
# file in any form to the United States Government may not be made
# without a written predetermination that it will be protected by
# limited or restricted rights as set forth in the applicable Federal
# Acquisition Regulations or other equivalent governmental rule or
# regulation.
#
# The contents herein are provided "as is" and without any express or
# implied warranties, including, without limitation, the implied
# warranties of merchantability and fitness for a particular purpose.
#
# Last modified: <lastCommitDate>
# Release: <releaseName>
# Id: <gitCommitHash>
#
###############################################################################

##############################################################################
# B U I L D    E N V I R O N M E N T
##############################################################################
HOST_PLATFORM := $(shell uname | cut -d _ -f 1 | tr [:upper:] [:lower:])

# If HARDWARE_TARGET is defined then we'll append it to the host platform 
# that we are running on.
ifdef HARDWARE_TARGET
TARGET := $(HOST_PLATFORM).$(HARDWARE_TARGET)
else
TARGET := $(HOST_PLATFORM)
endif

# Include host/target specific options
OSADAPT_PLATFORMDIR := ../../osAdaptation/$(TARGET)
include ../../osAdaptation/$(TARGET)/osConfig.mk

##############################################################################
# Include directories 
INCL_DIRS += \
             /usr/include/libxml2

# Compiler Options
CFLAGS += \
          $(foreach i,$(INCL_DIRS),-I$(i)) \
          -g \
          -Werror \
          -Wall \
          -ansi \
          -pedantic

##############################################################################
# Static Libraries
STATIC_LIBS = \

# Shared Libraries
SHARED_LIBS = \
              xml2\
              z \
              m

# Library make targets 
LIB_MKTGTS := \
              $(foreach i,$(STATIC_LIBS), lib$(i)) \
              $(foreach i,$(SHARED_LIBS), lib$(i))

# Library search paths
LD_DIRS = \
          /usr/lib

# Linker Options
LDFLAGS := \
           $(foreach i,$(LD_DIRS),-L$(i))

##############################################################################
# O U T P U T    A R T I F A C T S
##############################################################################
PROGNAME := generator$(PROG_EXT)

##############################################################################
# M A K E F I L E    T A R G E T S
##############################################################################

all:
	$(CPP) $(CFLAGS) $(LDFLAGS)  $(foreach i,$(SHARED_LIBS),-l$(i)) -o $(PROGNAME) generator.cc

clean:
	$(RM) -f $(PROGNAME) *~

all2:
	$(CPP) `xml2-config --cflags --libs` -g  -o $(PROGNAME) generator.cc
	g++ -I/usr/include/libxml2 -L/usr/lib -lxml2 -lz -liconv -lm -g  -o generator generator.cc


