# Makefile - Top-level comp_ip_net2 Makefile
#
# modification history
# --------------------
# 01s,15sep10,xhs  support IPLITE
# 01t,12jun10,fao  add be8 support.
# 01r,02jul09,pee  adding empty rules for unknown targets.
# 01q,02jun09,mze  Have the warp check the VSB configuration first.
# 01p,24mar09,pee  passing OPT from VSB conf
# 01o,27oct08,mze  changes to ADDEDCFLAGS
# 01n,06oct08,mze  CFLAG changes
# 01m,22aug08,pee  using APP_TOOL to compile.
# 01l,16jul08,pee  adding precomp rule stub.
# 01k,03jun08,pee  passing VSB_DIR.
# 01j,07sep07,kkz  Adding synopsis target
# 01i,19jun07,tpw  Use WRVX_COMPBASE vs. WIND_COMPONENTS correctly.
# 01h,26apr07,tpw  Use WIND_COMPONENTS, not WIND_HOME/components.
# 01g,12feb07,tkf  Use env variable COMP_IPNET2 instead of gard-coded
#                  directory name for IPNET.
# 01f,04jan06,kkz  Added 'man' target
# 01g,15sep06,tkf  Replace 'all' target with 'kernel'.
# 01f,12sep06,dlk  Replace 'make' with MAKE variable.
# 01e,18jul06,tkf  Test the existence of the ipnet tree before trying to
#                  build it.
# 01d,12jul06,tkf  Add rclean target
# 01c,08jun06,tkf  Add WIND_IPNET=true to the make command.
# 01b,19may06,tkf  Changed make target.
# 01a,13may06,tkf  written.
#
# DESCRIPTION
# This is the top level Makefile for building the IPNET component during
# GPP builds.
#
# Note that this file is a temporary work-waround and will be obsoleted when
# GPP build infratstructure is fixed to build components outside $TGT_DIR,
# for example components in $WIND_HOME/components.
#

TGT_DIR = $(WIND_BASE)/target

include $(TGT_DIR)/h/make/defs.library


ifeq  ($(_WRS_CONFIG_ENDIAN),be8)
$(_WRS_CONFIG_ENDIAN) = big
endif

ifdef _WRS_CONFIG_COMPONENT_IPNET
# do not do anything if IPNET is not set

ifneq ($(strip $(_WRS_CONFIG_ADDEDCFLAGS_APP)),)
__VSB_ADDEDCFLAGSAPP="$(_WRS_CONFIG_ADDEDCFLAGS_APP)"
endif

ifndef OPT
ifdef _WRS_CONFIG_FEATURE_IPNET_INET6
OPT=-inet6
endif
ifdef _WRS_CONFIG_FEATURE_IPNET_INET6_ONLY
OPT=-inet6only
endif
endif

ifneq ($(wildcard $(WRVX_COMPBASE)/$(COMP_IPNET2)/Makefile),)
default:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_IPNET2) TOOL=$(_WRS_CONFIG_APP_TOOL) _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP) CPU=$(CPU) WIND_IPNET=true kernel VSB_DIR=$(VSB_DIR) OPT=$(OPT)

rclean:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_IPNET2) TOOL=$(_WRS_CONFIG_APP_TOOL)  _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP)  CPU=$(CPU) WIND_IPNET=true rclean OPT=$(OPT)

man:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_IPNET2) -f Makefile.mfg TOOL=$(_WRS_CONFIG_APP_TOOL)  _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP)  CPU=$(CPU) WIND_IPNET=true man

synopsis:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_IPNET2) -f Makefile.mfg TOOL=$(_WRS_CONFIG_APP_TOOL)  _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP)  CPU=$(CPU) WIND_IPNET=true synopsis


release: default
else
# the IPNET directory was not present
default:

release:

rclean:
endif

else

ifdef _WRS_CONFIG_COMPONENT_IPLITE

# do not do anything if IPLITE is not set

ifneq ($(strip $(_WRS_CONFIG_ADDEDCFLAGS_APP)),)
__VSB_ADDEDCFLAGSAPP="$(_WRS_CONFIG_ADDEDCFLAGS_APP)"
endif

ifndef OPT
ifdef _WRS_CONFIG_FEATURE_IPLITE_INET6
OPT=-inet6
endif
endif

ifneq ($(wildcard $(WRVX_COMPBASE)/$(COMP_IPNET2)/Makefile),)
default:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_IPNET2) TOOL=$(_WRS_CONFIG_APP_TOOL) _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP) CPU=$(CPU) WIND_IPLITE=true kernel VSB_DIR=$(VSB_DIR) OPT=$(OPT)

rclean:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_IPNET2) TOOL=$(_WRS_CONFIG_APP_TOOL)  _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP)  CPU=$(CPU) WIND_IPLITE=true rclean OPT=$(OPT)

man:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_IPNET2) -f Makefile.mfg TOOL=$(_WRS_CONFIG_APP_TOOL)  _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP)  CPU=$(CPU) WIND_IPLITE=true man

synopsis:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_IPNET2) -f Makefile.mfg TOOL=$(_WRS_CONFIG_APP_TOOL)  _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP)  CPU=$(CPU) WIND_IPLITE=true synopsis


release: default
else

# the IPNET and IPLITE directory was not present
default:

release:

rclean:
endif
else

# IPNET was not defined in the VSB

default:

release:

rclean:

man:

synopsis:

endif

endif
# rules that do nothing for ipnet
precomp:

% :
	@echo nothing to be done for target $@

