diff --git a/targets/build_helper.bash b/targets/build_helper.bash
index b7865319508a2279f4e9fa121ba0234dc16cde81..73201c15152659ba3b81f3ffddcd4e249a83af88 100755
--- a/targets/build_helper.bash
+++ b/targets/build_helper.bash
@@ -335,91 +335,166 @@ check_install_oai_software() {
 	test_install_package valgrind
 
 # TODO: install the USRP UHD packages 
+#	test_install_package libboost-all-dev
 	
+	if [ $OAI_INSTALLED = 1 ]; then 
+	    touch ./.lock_oaibuild
+	fi 
+    
+     else
+	echo_info "skip the package installations"
+    fi 
+    
+}
 
-	# uninstall some automatically installed packges
-	# we need a newer version
-#	test_uninstall_package libnettle4
-	
-#	check_install_freediamter
-#    else 
-#	if [ ! -d /usr/local/etc/freeDiameter ]; then
-#	    check_install_freediamter
-#	fi
+check_install_hss_software() {
+    if [ ! -f ./.lock_oaibuild ]; then 
+	$SUDO apt-get update
+	test_install_package autoconf 
+	test_install_package automake 
+	test_install_package bison 
+	test_install_package build-essential
+	test_install_package cmake
+	test_install_package cmake-curses-gui 
+	test_install_package dkms
+	test_install_package flex 
+	test_install_package gawk
+	test_install_package gcc
+	test_install_package gdb 
+	test_install_package guile-2.0-dev 
+	test_install_package g++
+	test_install_package libgmp-dev 
+	test_install_package libgcrypt11-dev 
+	test_install_package libidn11-dev 
+	test_install_package libidn2-0-dev 
+	test_install_package libmysqlclient-dev 
+	test_install_package libtasn1-3-dev 
+	test_install_package libsctp1 
+	test_install_package libsctp-dev 
+	test_install_package libxml2-dev 
+	test_install_package linux-headers-`uname -r` 
+	test_install_package make
+	test_install_package mysql-client-core-5.5 
+	test_install_package mysql-server-core-5.5 
+	test_install_package mysql-server-5.5 
+	test_install_package openssh-client
+	test_install_package openssh-server
+	test_install_package phpmyadmin
+	test_install_package python-dev 
+	test_install_package sshfs
+	test_install_package swig 
+	test_install_package unzip 
+	test_install_package nettle-bin
+	test_install_package nettle-dev
+	test_install_package valgrind 
+
+	if [ $OAI_INSTALLED = 1 ]; then 
+	    touch ./.lock_oaibuild
+	fi 
 	
+    else
+	echo_info "skip the package installations"
+    fi 
+
+}
+
+check_install_epc_software() {
+
+    if [ ! -f ./.lock_oaibuild ]; then 
+	$SUDO apt-get update
+	test_install_package autoconf
+	test_install_package automake
+	test_install_package bison
+	test_install_package build-essential
+	test_install_package check
+	test_install_package cmake
+	test_install_package cmake-curses-gui
+	test_install_package ethtool
+	test_install_package flex
+	test_install_package g++
+	test_install_package gawk
+	test_install_package gcc
+	test_install_package gccxml
+	test_install_package gdb 
+	test_install_package guile-2.0-dev
+	test_install_package gtkwave
+	test_install_package iperf
+	test_install_package iproute
+	test_install_package iptables
+	test_install_package libatlas-base-dev
+	test_install_package libatlas-dev
+	test_install_package libblas
+	test_install_package libblas-dev
+	if [ $MACHINE_ARCH = 64 ]; then
+            test_install_package libconfig8-dev
+	else
+            test_install_package libconfig-dev
+	fi
+	test_install_package libforms-bin
+	test_install_package libforms-dev
+	test_install_package libgcrypt11-dev
+	test_install_package libgmp-dev
+	test_install_package libgtk-3-dev
+	test_install_package libidn11-dev
+	test_install_package libidn2-0-dev
+	test_install_package libmysqlclient-dev
+	test_install_package libpgm-dev
+	test_install_package libpthread-stubs0-dev
+	test_install_package libsctp1
+	test_install_package libsctp-dev
+	test_install_package libtasn1-3-dev
+	test_install_package libxml2
+	test_install_package libxml2-dev
+	test_install_package linux-headers-`uname -r`
+	test_install_package make
+	test_install_package openssh-client
+	test_install_package openssh-server
+	test_install_package openssl
+	test_install_package openvpn
+	test_install_package pkg-config
+	test_install_package python-dev
+	test_install_package sshfs
+	test_install_package subversion
+	test_install_package swig
+	test_install_package tshark
+	test_install_package uml-utilities
+	test_install_package unzip
+	test_install_package valgrind
+	test_install_package vlan
 	
 	if [ $OAI_INSTALLED = 1 ]; then 
 	    touch ./.lock_oaibuild
 	fi 
     
-   # echo_success "freediameter is installed"
-   # check_s6a_certificate
-    
+    else
+	echo_info "skip the package installations"
+    fi 
 
-	test_command_install_script   "asn1c" "$OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $SUDO"
+}
+
+check_install_asn1c(){
+    
+    test_command_install_script   "asn1c" "$OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $SUDO"
     
     # One mor check about version of asn1c
-	ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE="ASN.1 Compiler, v0.9.24"
-	ASN1C_COMPILER_VERSION_MESSAGE=`asn1c -h 2>&1 | grep -i ASN\.1\ Compiler`
+    ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE="ASN.1 Compiler, v0.9.24"
+    ASN1C_COMPILER_VERSION_MESSAGE=`asn1c -h 2>&1 | grep -i ASN\.1\ Compiler`
     ##ASN1C_COMPILER_VERSION_MESSAGE=`trim $ASN1C_COMPILER_VERSION_MESSAGE`
-	if [ "$ASN1C_COMPILER_VERSION_MESSAGE" != "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE" ]; then
+    if [ "$ASN1C_COMPILER_VERSION_MESSAGE" != "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE" ]; then
       #  diff <(echo -n "$ASN1C_COMPILER_VERSION_MESSAGE") <(echo -n "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE")
-            echo_error "Version of asn1c is not the required one, do you want to install the required one (overwrite installation) ? (Y/n)"
-            echo_error "$ASN1C_COMPILER_VERSION_MESSAGE"
-            while read -r -n 1 -s answer; do
-		if [[ $answer = [YyNn] ]]; then
-                    [[ $answer = [Yy] ]] && $OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $SUDO
-                    [[ $answer = [Nn] ]] && echo_error "Version of asn1c is not the required one, exiting." && exit 1
-                    break
-		fi
-            done
-	fi
-    else
-	echo_info "skip the package installations"
-    fi 
+        echo_error "Version of asn1c is not the required one, do you want to install the required one (overwrite installation) ? (Y/n)"
+        echo_error "$ASN1C_COMPILER_VERSION_MESSAGE"
+        while read -r -n 1 -s answer; do
+	    if [[ $answer = [YyNn] ]]; then
+                [[ $answer = [Yy] ]] && $OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $SUDO
+                [[ $answer = [Nn] ]] && echo_error "Version of asn1c is not the required one, exiting." && exit 1
+                break
+	    fi
+        done
+    fi
     
 }
 
-check_install_hss_software() {
-    test_install_package autoconf 
-    test_install_package automake 
-    test_install_package bison 
-    test_install_package build-essential
-    test_install_package cmake
-    test_install_package cmake-curses-gui 
-    test_install_package dkms
-    test_install_package flex 
-    test_install_package gawk
-    test_install_package gcc
-    test_install_package gdb 
-    test_install_package guile-2.0-dev 
-    test_install_package g++
-    test_install_package libgmp-dev 
-    test_install_package libgcrypt11-dev 
-    test_install_package libidn11-dev 
-    test_install_package libidn2-0-dev 
-    test_install_package libmysqlclient-dev 
-    test_install_package libtasn1-3-dev 
-    test_install_package libsctp1 
-    test_install_package libsctp-dev 
-    test_install_package libxml2-dev 
-    test_install_package linux-headers-`uname -r` 
-    test_install_package make
-    test_install_package mysql-client-core-5.5 
-    test_install_package mysql-server-core-5.5 
-    test_install_package mysql-server-5.5 
-    test_install_package openssh-client
-    test_install_package openssh-server
-    test_install_package phpmyadmin
-    test_install_package python-dev 
-    test_install_package sshfs
-    test_install_package swig 
-    test_install_package unzip 
-    test_install_package nettle-bin
-    test_install_package nettle-dev
-    test_install_package valgrind 
-}
-
 #################################################
 # 2. compile 
 ################################################
@@ -702,6 +777,51 @@ install_oaisim() {
    
 }
 
+##################################
+# create HSS DB
+################################
+
+# arg 1 is mysql user      (root)
+# arg 2 is mysql password  (linux)
+create_hss_database(){
+    EXPECTED_ARGS=2
+    E_BADARGS=65
+    MYSQL=`which mysql`
+    
+    if [ $# -ne $EXPECTED_ARGS ]
+    then
+        echo_fatal "Usage: $0 dbuser dbpass"
+    fi
+
+    set_openair
+    
+    Q1="CREATE DATABASE IF NOT EXISTS ${BTICK}oai_db${BTICK};"
+    SQL="${Q1}"
+    $MYSQL -u $1 --password=$2 -e "$SQL"
+    if [ $? -ne 0 ]; then
+       echo_error "oai_db creation failed"
+    else
+       echo_success "oai_db creation succeeded"
+    fi
+    
+    $MYSQL -u $1 --password=$2 oai_db < $OPENAIRCN_DIR/OPENAIRHSS/db/oai_db.sql
+    if [ $? -ne 0 ]; then
+       echo_error "oai_db tables creation failed"
+    else
+       echo_success "oai_db tables creation succeeded"
+    fi
+    
+    Q1="GRANT ALL PRIVILEGES ON *.* TO 'hssadmin'@'%' IDENTIFIED BY 'admin' WITH GRANT OPTION;"
+    Q2="FLUSH PRIVILEGES;"
+    SQL="${Q1}${Q2}"
+    $MYSQL -u $1 --password=$2 -e "$SQL"
+    if [ $? -ne 0 ]; then
+       echo_error "hssadmin permissions failed"
+    else
+       echo_success "hssadmin permissions succeeded"
+    fi
+}
+
 ################################
 # set_openair
 ###############################
@@ -733,10 +853,11 @@ print_help(){
     echo_success "-c   : enables clean OAI build (default disabled)"
     echo_success "-d   : enables debug mode (default disabled)"
     echo_success "-e   : sets realtime mode: RTAI, NONE (default NONE)"
+    echo_success "-l   : sets the LTE build target: ENB,EPC,HSS (default ENB)"
     echo_success "-m   : enables build from the makefile (default disabled)"
     echo_success "-r   : sets the release: REL8, REL10 (default REL8)"
     echo_success "-s   : enables OAI sanity check (default disabled)"
-    echo_success "-t   : sets the build target: ALL, SOFTMODEM,OAISIM,UNISIM (default ALL)"
+    echo_success "-t   : sets the eNB build target: ALL, SOFTMODEM,OAISIM,UNISIM (default ALL)"
     echo_success "-w   : sets the hardware platform: EXMIMO, USRP, ETHERNET NONE, (default EXMIMO)"
     echo_success "-x   : enables xforms (default disabled)"
     echo_success "-z   : sets the default build options"
diff --git a/targets/build_oai.bash b/targets/build_oai.bash
index 515c751a96f2c4f8d2d330c44dc4963d46dd2d6b..48bd4b7aa4b5b0a4a6c83350f476da7d36c1664e 100755
--- a/targets/build_oai.bash
+++ b/targets/build_oai.bash
@@ -46,6 +46,9 @@ check_for_root_rights
 # Default PARAMETERS
 ######################################
 
+#only one could be set at the time
+BUILD_LTE="ENB" # ENB, EPC, HSS, NONE
+
 HW="EXMIMO" # EXMIMO, USRP, ETHERNET, NONE
 TARGET="ALL" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE
 ENB_S1=1
@@ -53,6 +56,7 @@ REL="REL8" # REL8, REL10
 RT="NONE" # RTAI, RT_PREMPT or RT_DISABLED, NONE
 DEBUG=0
 
+
 OAI_TEST=0
 XFORMS=0
 
@@ -82,7 +86,7 @@ fi
 #    echo "i is : $i"
 #    case $i in
 
-while getopts "bcdmsxzhe:w:r:t:" OPTION; do
+while getopts "bcdmsxzhe:l:w:r:t:" OPTION; do
    case "$OPTION" in
        b)
 	   ENB_S1=0
@@ -102,6 +106,10 @@ while getopts "bcdmsxzhe:w:r:t:" OPTION; do
 	   RT="$OPTARG"
 	   echo "setting realtime flag to: $RT"
 	   ;;
+       l) 
+	   BUILD_LTE="$OPTARG"
+	   echo "setting top-level build target to: $OPTARG"
+	   ;;
        h)
 	   print_help
 	   exit -1
@@ -171,88 +179,12 @@ touch bin/install_log.txt
 #$SUDO kill -9 `ps -ef | grep dlsim | awk '{print $2}'`  2>&1
 #$SUDO kill -9 `ps -ef | grep ulsim | awk '{print $2}'`  2>&1
 
-##########################################
-# process parameters
-#########################################
-
-echo_info "2. Process the parameters"
-
-echo_info "User-defined Parameters :  HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG XFORMS=$XFORMS"
-
-echo "User-defined Parameters :  HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG XFORMS=$XFORMS" >> bin/${oai_build_date}
-
- 
-############################################
-# compilation directives 
-############################################
-
-echo_info "3. building the compilation directives ..."
-
-SOFTMODEM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS "
-OAISIM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS "
-
-if [ $HW = "USRP" ]; then 
-    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES USRP=1 "
-fi
-
-if [ $HW = "EXMIMO" ]; then 
-    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES EXMIMO=1"
-fi
-
-if [ $HW = "ETHERNET" ]; then 
-    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES ETHERNET=1"
-fi 
-
-if [ $ENB_S1 -eq 0 ]; then 
-    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES NAS=1 "
-    OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES NAS=1 "
-fi 
-
-if [ $REL = "REL8" ]; then
-    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES Rel8=1 "
-    OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES Rel8=1 "
-else 
-    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES Rel10=1 "
-    OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES Rel10=1 "
-fi
-
-if [ $RT = "RTAI" ]; then 
-    if [ ! -f /usr/realtime/modules/rtai_hal.ko ];   then
-	echo_warning "RTAI doesn't seem to be installed"
-	RT="NONE"
-	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES RTAI=0 "
-    else 
-	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES HARD_RT=1 "
-    fi
-else 
-    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES RTAI=0 "
-    RT="NONE"
-fi
-
-if [ $TARGET != "ALL" ]; then 
-    if [ $TARGET  != "SOFTMODEM" ]; then 
-	HW="NONE"
-    fi
-fi
-
-output=$(check_for_machine_type 2>&1) 
-MACHINE_ARCH=$?
-if [ $MACHINE_ARCH -eq 64 ]; then
-    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES LIBCONFIG_LONG=1 "
-    OAISIM_DIRECTIVES="$OASIM_DIRECTIVES LIBCONFIG_LONG=1 "
-fi
-
-echo_success "SOFTMODEM Compilation directives: $SOFTMODEM_DIRECTIVES"
-echo_success "OAISIM Compilation directives:    $OAISIM_DIRECTIVES"
-
-echo "SOFTMODEM Compilation directives: $SOFTMODEM_DIRECTIVES" >>  bin/${oai_build_date}
-echo "OAISIM Compilation directive:    $OAISIM_DIRECTIVES" >>  bin/${oai_build_date}
 
 ############################################
 # setting and printing OAI envs, we should check here
 ############################################
-
-echo_info "3. Setting the OAI PATHS ..."
+    
+echo_info "2. Setting the OAI PATHS ..."
 
 set_openair_env 
 cecho "OPENAIR_HOME    = $OPENAIR_HOME" $green
@@ -270,71 +202,121 @@ echo "OPENAIR3_DIR    = $OPENAIR3_DIR"  >>  bin/${oai_build_date}
 echo "OPENAIRCN_DIR   = $OPENAIRCN_DIR"  >>  bin/${oai_build_date}
 echo "OPENAIR_TARGETS = $OPENAIR_TARGETS"  >>  bin/${oai_build_date}
 
+
+build_enb(){
+
+##########################################
+# process parameters
+#########################################
+
+    echo_info "4. Process the parameters"
+
+    echo_info "User-defined Parameters :  HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG XFORMS=$XFORMS"
+    
+    echo "User-defined Parameters :  HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG XFORMS=$XFORMS" >> bin/${oai_build_date}
+    
+ 
+############################################
+# compilation directives 
+############################################
+
+    echo_info "5. building the compilation directives ..."
+    
+    SOFTMODEM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS "
+    OAISIM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS "
+    
+    if [ $HW = "USRP" ]; then 
+	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES USRP=1 "
+    fi
+    
+    if [ $HW = "EXMIMO" ]; then 
+	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES EXMIMO=1"
+    fi
+    
+    if [ $HW = "ETHERNET" ]; then 
+	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES ETHERNET=1"
+    fi 
+    
+    if [ $ENB_S1 -eq 0 ]; then 
+	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES NAS=1 "
+	OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES NAS=1 "
+    fi 
+    
+    if [ $REL = "REL8" ]; then
+	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES Rel8=1 "
+	OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES Rel8=1 "
+    else 
+	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES Rel10=1 "
+	OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES Rel10=1 "
+    fi
+    
+    if [ $RT = "RTAI" ]; then 
+	if [ ! -f /usr/realtime/modules/rtai_hal.ko ];   then
+	    echo_warning "RTAI doesn't seem to be installed"
+	    RT="NONE"
+	    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES RTAI=0 "
+	else 
+	    SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES HARD_RT=1 "
+	fi
+    else 
+	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES RTAI=0 "
+	RT="NONE"
+    fi
+    
+    if [ $TARGET != "ALL" ]; then 
+	if [ $TARGET  != "SOFTMODEM" ]; then 
+	    HW="NONE"
+	fi
+    fi
+    
+    output=$(check_for_machine_type 2>&1) 
+    MACHINE_ARCH=$?
+    if [ $MACHINE_ARCH -eq 64 ]; then
+	SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES LIBCONFIG_LONG=1 "
+	OAISIM_DIRECTIVES="$OASIM_DIRECTIVES LIBCONFIG_LONG=1 "
+    fi
+    
+    echo_success "SOFTMODEM Compilation directives: $SOFTMODEM_DIRECTIVES"
+    echo_success "OAISIM Compilation directives:    $OAISIM_DIRECTIVES"
+    
+    echo "SOFTMODEM Compilation directives: $SOFTMODEM_DIRECTIVES" >>  bin/${oai_build_date}
+    echo "OAISIM Compilation directive:    $OAISIM_DIRECTIVES" >>  bin/${oai_build_date}
+    
+    
 ############################################
 # check the installation
 ############################################
 
-echo_info "6. Checking the installation ..."
+    echo_info "6. Checking the installation ..."
 
-check_install_oai_software  
+    check_install_oai_software  
+    check_install_asn1c
 
 ############################################
 # compile 
 ############################################
 
-echo_info "7. compiling and installing the OAI binaries ..."
+    echo_info "7. compiling and installing the OAI binaries ..."
 
-softmodem_compiled=1
-oaisim_compiled=1
-unisim_compiled=1
-
-if [ $TARGET = "ALL" ]; then
-    echo "############# compile_ltesoftmodem #############" >> bin/install_log.txt 
-    output=$(compile_ltesoftmodem  >> bin/install_log.txt  2>&1 )
-    softmodem_compiled=$?
-    check_for_ltesoftmodem_executable
-    echo_info "7.1 finished ltesoftmodem target : check the installation log file bin/install_log.txt" 
-
-    echo "################ compile_oaisim #################"  >> bin/install_log.txt 
-    output=$(compile_oaisim      >> bin/install_log.txt   2>&1 )
-    oaisim_compiled=$?
-    check_for_oaisim_executable
-    echo_info "7.2 finished oaisim target : check the installation log file bin/install_log.txt" 
- 
-    echo "################## compile_unisim ##################"  >> bin/install_log.txt 
-    output=$(compile_unisim      >> bin/install_log.txt  2>&1 )
-    unisim_compiled=$?
-    check_for_dlsim_executable
-    check_for_ulsim_executable
-    check_for_pucchsim_executable
-    check_for_prachsim_executable
-    check_for_pdcchsim_executable
-    check_for_pbchsim_executable
-    check_for_mbmssim_executable
-    echo_info "7.3 finished unisim target : check the installation log file bin/install_log.txt" 
-
-     
-else
+    softmodem_compiled=1
+    oaisim_compiled=1
+    unisim_compiled=1
     
-    if [ $TARGET = "SOFTMODEM" ]; then 
+    if [ $TARGET = "ALL" ]; then
 	echo "############# compile_ltesoftmodem #############" >> bin/install_log.txt 
-	output=$(compile_ltesoftmodem   >> bin/install_log.txt 2>&1 )
+	output=$(compile_ltesoftmodem  >> bin/install_log.txt  2>&1 )
 	softmodem_compiled=$?
 	check_for_ltesoftmodem_executable
-	echo_info "7.1 finished ltesoftmodem target: check the installation log file bin/install_log.txt" 
-
-    fi
-    if [ $TARGET = "OAISIM" ]; then 
+	echo_info "7.1 finished ltesoftmodem target : check the installation log file bin/install_log.txt" 
+	
 	echo "################ compile_oaisim #################"  >> bin/install_log.txt 
-	output=$(compile_oaisim   >> bin/install_log.txt 2>&1 )
-	oaisim_compiled=$?	
+	output=$(compile_oaisim      >> bin/install_log.txt   2>&1 )
+	oaisim_compiled=$?
 	check_for_oaisim_executable
-	echo_info "7.2 finished oaisim target: check the installation log file bin/install_log.txt" 
-		
-    fi
-    if [ $TARGET = "UNISIM" ]; then 
+	echo_info "7.2 finished oaisim target : check the installation log file bin/install_log.txt" 
+	
 	echo "################## compile_unisim ##################"  >> bin/install_log.txt 
-	output=$(compile_unisim   >> bin/install_log.txt 2>&1 )
+	output=$(compile_unisim      >> bin/install_log.txt  2>&1 )
 	unisim_compiled=$?
 	check_for_dlsim_executable
 	check_for_ulsim_executable
@@ -343,52 +325,170 @@ else
 	check_for_pdcchsim_executable
 	check_for_pbchsim_executable
 	check_for_mbmssim_executable
-	echo_info "7.3 finished unisim target: check the installation log file bin/install_log.txt" 
-		
+	echo_info "7.3 finished unisim target : check the installation log file bin/install_log.txt" 
+	
+	
+    else
+	
+	if [ $TARGET = "SOFTMODEM" ]; then 
+	    echo "############# compile_ltesoftmodem #############" >> bin/install_log.txt 
+	    output=$(compile_ltesoftmodem   >> bin/install_log.txt 2>&1 )
+	    softmodem_compiled=$?
+	    check_for_ltesoftmodem_executable
+	    echo_info "7.1 finished ltesoftmodem target: check the installation log file bin/install_log.txt" 
+	    
+	fi
+	if [ $TARGET = "OAISIM" ]; then 
+	    echo "################ compile_oaisim #################"  >> bin/install_log.txt 
+	    output=$(compile_oaisim   >> bin/install_log.txt 2>&1 )
+	    oaisim_compiled=$?	
+	    check_for_oaisim_executable
+	    echo_info "7.2 finished oaisim target: check the installation log file bin/install_log.txt" 
+	    
+	fi
+	if [ $TARGET = "UNISIM" ]; then 
+	    echo "################## compile_unisim ##################"  >> bin/install_log.txt 
+	    output=$(compile_unisim   >> bin/install_log.txt 2>&1 )
+	    unisim_compiled=$?
+	    check_for_dlsim_executable
+	    check_for_ulsim_executable
+	    check_for_pucchsim_executable
+	    check_for_prachsim_executable
+	    check_for_pdcchsim_executable
+	    check_for_pbchsim_executable
+	    check_for_mbmssim_executable
+	    echo_info "7.3 finished unisim target: check the installation log file bin/install_log.txt" 
+	    
+	fi
     fi
-fi
 
 
 ############################################
 # install 
 ############################################
 
-echo_info "8. Installing ..."
-
-if [ $softmodem_compiled = 0 ]; then 
-    echo_success "target lte-softmodem built and installed in the bin directory"
-    echo "target lte-softmodem built and installed in the bin directory"  >>  bin/${oai_build_date}
-    output=$(install_ltesoftmodem $RT $HW $ENB_S1 )
-fi
-if [ $oaisim_compiled = 0 ]; then 
-    echo_success "target oaisim built and installed in the bin directory"
-    echo "target oaisim built and installed in the bin directory"  >>  bin/${oai_build_date}
-    output=$(install_oaisim $ENB_S1 )
-fi 
-if [ $unisim_compiled =  0 ]; then 
-    echo_success "target unisim built and installed in the bin directory"
-    echo "target unisim built and installed in the bin directory"  >>  bin/${oai_build_date}
-fi 
-
-echo_info "build terminated, binaries are located in bin/"
-echo_info "build terminated, logs are located in bin/${oai_build_date} and bin/install_log.txt"
-
+    echo_info "8. Installing ..."
+    
+    if [ $softmodem_compiled = 0 ]; then 
+	echo_success "target lte-softmodem built and installed in the bin directory"
+	echo "target lte-softmodem built and installed in the bin directory"  >>  bin/${oai_build_date}
+	output=$(install_ltesoftmodem $RT $HW $ENB_S1 )
+    fi
+    if [ $oaisim_compiled = 0 ]; then 
+	echo_success "target oaisim built and installed in the bin directory"
+	echo "target oaisim built and installed in the bin directory"  >>  bin/${oai_build_date}
+	output=$(install_oaisim $ENB_S1 )
+    fi 
+    if [ $unisim_compiled =  0 ]; then 
+	echo_success "target unisim built and installed in the bin directory"
+	echo "target unisim built and installed in the bin directory"  >>  bin/${oai_build_date}
+    fi 
+    
+    echo_info "build terminated, binaries are located in bin/"
+    echo_info "build terminated, logs are located in bin/${oai_build_date} and bin/install_log.txt"
+    
 ############################################
 # testing
 ############################################
-
-if [ $OAI_TEST = 1 ]; then 
-    echo_info "10. Testing ..."
-    python $OPENAIR_TARGETS/TEST/OAI/test01.py
-else 
-    echo_info "9. Bypassing the Tests ..."
-fi 
-
+    
+    if [ $OAI_TEST = 1 ]; then 
+	echo_info "9. Testing ..."
+	python $OPENAIR_TARGETS/TEST/OAI/test01.py
+    else 
+	echo_info "9. Bypassing the Tests ..."
+    fi 
+    
 ############################################
 # run 
 ############################################
-echo_info "10. Running ... To be done"
+    echo_info "10. Running ... To be done"
 
 
+}
+build_epc(){
+    
+    echo_info "Note: this scripts works only for Ubuntu 12.04"
+
+######################################
+# CHECK MISC SOFTWARES AND LIBS      #
+######################################
+    echo_info "4.check the required packages for HSS"
+
+    check_install_epc_software
+   
+    check_install_asn1c
+    
+    if [ ! -d /usr/local/etc/freeDiameter ]; then
+	check_install_freediamter
+    fi
+    check_s6a_certificate
+
+###########################################
+# configure and compile
+##########################################
+
+    compile_epc
+    
+
+}
+
+build_hss(){
+
+echo_info "Note: this scripts works only for Ubuntu 12.04"
+
+######################################
+# CHECK MISC SOFTWARES AND LIBS      #
+######################################
+    echo_info "4.check the required packages for HSS"
+
+    check_install_hss_software
+    
+    if [ ! -d /usr/local/etc/freeDiameter ]; then
+	check_install_freediamter
+    fi
+    check_s6a_certificate
+######################################
+# compile HSS                        #
+######################################
+    echo_info "5.compile HSS"
+    
+    compile_hss
+
+
+######################################
+# fill the HSS DB
+######################################
+    echo_info "5.compile HSS"
+
+    create_hss_database
+
+######################################
+# LAUNCH HSS                         #
+######################################
+    $OPENAIRCN_DIR/OPENAIRHSS/objs/openair-hss -c $OPENAIRCN_DIR/OPENAIRHSS/conf/hss.conf
+}
+
 
  
+############################################
+# set the build 
+############################################
+
+echo_info "set the top-level build target"
+case "$BUILD_LTE" in
+    'ENB')           
+	echo_success "build LTE eNB"
+	build_enb
+	;;
+    'EPC')           
+	echo_warning "build EPC(MME and xGW): Experimental"
+	build_epc
+	;;
+    'HSS')           
+	echo_warning "build HSS: Experimental"
+	build_hss 
+	;;
+    *)
+	echo_error "Unknown option $BUILD_LTE: do not build"
+	;;
+esac
\ No newline at end of file