role=$(echo $1 | tr '[A-Z]' '[a-z]') app=$2 if [ "$role" == "" ] || [ "$app" == "" ] ; then echo invalid input, will not change macros. else inc_cfg=../export/inc/config inc_ver=../inc ####################################### common clean macros start ######################################### sed -i "s/\([ ]*#define[ ]*IOT_PRINTF_DEBUG[ ]*\) .*$/\1 1/g" $inc_cfg/plc_config_api.h sed -i "s/\([ ]*#define[ ]*AP_FIRMWARE_VERSION_TYPE[ ]*\) .*$/\1 (1)/g" $inc_ver/iot_version.h sed -i "s/\([ ]*#define[ ]*PHY_PRIVATE_OFFSET_PHASE[ ]*\) .*$/\1 (IOT_SMART_CONFIG)/g" $inc_ver/config/plc_config.h ####################################### common clean macros end ######################################### ####################################### APP 7 build clean macros start ######################################### if [ "$app" == "7" ]; then src_ledc=../app/led_ctrl_app/controller org_adc=[0-9]* org_em=[0-9]* org_hardware=[0-9]* tmp_org_em=0 tmp_org_hardware=0 tmp_org_adc=0 sed -i "s/\([ ]*#define[ ]*IOT_ENERGE_METER_ENABLE[ ]*\) $org_em/\1 $tmp_org_em/g" $inc_cfg/plc_config_api.h sed -i "s/\([ ]*#define[ ]*ENABLE_LED_CTRL_HARDWARE[ ]*\) ($org_hardware)/\1 ($tmp_org_hardware)/g" $src_ledc/iot_light_ctrl_drv.c sed -i "s/\([ ]*#define[ ]*IOT_LIGHT_CTRL_ADC_MODULE_ENABLE[ ]\) *($org_adc)/\1 ($tmp_org_adc)/g" $src_ledc/iot_light_ctrl_drv.c fi #[ "$app" == "7" ] ####################################### APP 7 build end ######################################### ####################################### APP 8 build clean macros start ######################################### if [ "$app" == "8" ]; then inc_lwip_opt=../import/lwip/ports/include org_dbg="LWIP_DBG_[A-Z]*" tmp_org_dbg="LWIP_DBG_OFF" sed -i "s/\([ ]*#define[ ]*TCPIP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*NETIF_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*SOCKETS_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*IP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*UDP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*TCP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*ICMP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_PLC_SUPPORT[ ]*\) $org_val/\1 1/g" $inc_cfg/plc_config_api.h sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_ETH_SUPPORT[ ]*\) $org_val/\1 0/g" $inc_cfg/plc_config_api.h sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_UART_SUPPORT[ ]*\) $org_val/\1 1/g" $inc_cfg/plc_config_api.h sed -i "s/\([ ]*#define[ ]*IOT_CUS_PORT_ETH_ENABLE[ ]*\) $org_val/\1 0/g" $inc_cfg/plc_config_api.h fi #[ "$app" == "8" ] ####################################### APP 8 end ######################################### ####################################### APP 12 demo_lwip build clean macros start ######################################### if [ "$app" == "12" ]; then inc_lwip_opt=../import/lwip/ports/include org_dbg="LWIP_DBG_[A-Z]*" tmp_org_dbg="LWIP_DBG_OFF" sed -i "s/\([ ]*#define[ ]*TCPIP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*NETIF_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*SOCKETS_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*IP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*UDP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*TCP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*ICMP_DEBUG[ ]*\) $org_dbg/\1 $tmp_org_dbg/g" $inc_lwip_opt/plc_lwipopts.h sed -i "s/\([ ]*#define[ ]*LWIP_IPV6[ ]*\) 1/\1 0/g" $inc_lwip_opt/plc_lwipopts.h fi #[ "$app" == "12" ] ####################################### APP 12 end ######################################### fi