###############################################################################
#file   Makefile
# -- Intel Copyright Notice --
# 
# Copyright (c) 2002-2008 Intel Corporation All Rights Reserved.
# 
# The source code contained or described herein and all documents
# related to the source code ("Material") are owned by Intel Corporation
# or its suppliers or licensors.  Title to the Material remains with
# Intel Corporation or its suppliers and licensors. The software is licensed under 
# IXA SDK license.
# 
# The Material is protected by worldwide copyright and trade secret laws
# and treaty provisions. No part of the Material may be used, copied,
# reproduced, modified, published, uploaded, posted, transmitted,
# distributed, or disclosed in any way except in accordance with the
# applicable license agreement .
# 
# No license under any patent, copyright, trade secret or other
# intellectual property right is granted to or conferred upon you by
# disclosure or delivery of the Materials, either expressly, by
# implication, inducement, estoppel, except in accordance with the
# applicable license agreement.
# 
# Unless otherwise agreed by Intel in writing, you may not remove or
# alter this notice or any other notice embedded in Materials by Intel
# or Intel's suppliers or licensors in any way.
# 
# For further details, please see the file README.TXT distributed with
# this software.
# 
# -- End Intel Copyright Notice --
# 
###############################################################################


############################################################################
# tools
############################################################################

ifeq ($(TOOLENV),linux)
 ifeq ($(IX_DEVICE),ia)
#   LINUX_INC = /usr/include
#   LINUX_CROSS_COMPILE := /usr/bin/
#   LINUX_KERNEL_INC := 
   CC := $(LINUX_CROSS_COMPILE)gcc
   LD := $(LINUX_CROSS_COMPILE)ld
   AR := $(LINUX_CROSS_COMPILE)ar
   AS := $(LINUX_CROSS_COMPILE)as
   GPLUS := $(LINUX_CROSS_COMPILE)g++
 endif #IA
endif 

############################################################################
# compiler/linker flags
############################################################################
# linux generic compiler flags
ifeq ($(TOOLENV),linux)
  CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \
	-Wno-format -Wno-strict-prototypes \
	-fsigned-char -fno-strict-aliasing -fno-common \
	-pipe \
	-msoft-float -D__linux\

# linux platform specific compiler flags
 ifeq ($(IX_DEVICE),ia)
  CFLAGS += -I$(ADS_BASE_DIR)/include -I$(LINUX_INC) -O3
 endif #IA
endif #end of linux


############################################################################
# list of files
############################################################################

# list of C files
C_FILES = PlugInConfig.c 

# list of object files
O_FILES := $(C_FILES:.c=.o)

############################################################################
# default 
############################################################################

default: lib 

############################################################################
# Rules for building files/dependencies
############################################################################

# Rule for compiling (always first)
%.o: C/%.c
	$(CC) $(CFLAGS) $< -c -o $@

# Rule for building dependencies from source (always second)
%.d: %.c
	$(CC) -M $(CFLAGS) -DIX_GENERATING_DEPENDENCIES $< > $@ 

############################################################################
# Automatic source file dependencies
############################################################################

# include the dependencies (always third)
D_FILES := $(O_FILES:.o=.d)
include $(D_FILES)

############################################################################
# targets 
############################################################################

.PHONY: lib 
lib: $(O_FILES)
	$(AR) rvs libplug_rhel50.a $(O_FILES) 

clean: 

	rm -f $(O_FILES) $(D_FILES) libplug_rhel50.a 
