How to create main links like home ,services programatically?
// You can use the following code to create a menu.

// Path.
$path = 'admin/structure/menu/manage/';
// Title of your menu.
$menu['title'] = 'My Another Menu';
// Description.
$menu['description'] = 'My Another Menu';

// Manu name like navigation, management which we have in drupal.
$menu_name = 'custommenu';
$menu['menu_name'] = $menu_name;

// Link title.
$link['link_title'] = 'My Another Menu';
// Link path.
$link['link_path'] = $path . $menu_name;
// Router path.
$link['router_path'] = $path;
// Module name.
$link['module'] = 'menu';
$link['plid'] = 0;

// Saves a menu link.
menu_link_save($link);
// Saves a custom menu.
menu_save($menu);

// After creating main menu. You can create links under it.
// Use the below code to create custom links.

$item_link = array(
  'link_path' =&gt; '&lt;front&gt;',
  'link_title' =&gt; 'Test link',
  'menu_name' =&gt; 'custommenu',
  'weight' =&gt; 0,
  'expanded' =&gt; 1,
);
// Creates custom link under main menu.
menu_link_save($item_link);