{"id":5552,"date":"2014-10-03T09:01:45","date_gmt":"2014-10-03T13:01:45","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=5552"},"modified":"2017-05-23T14:45:05","modified_gmt":"2017-05-23T18:45:05","slug":"make-install","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2014\/10\/03\/make-install\/","title":{"rendered":"Make Install"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/contributors\/3208495\">Sean<\/a>'s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/1529-makeinstall\">makeinstall<\/a> and <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/3698-makeinstall-technology\">Make Install Technology<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/200897\">Norbert Marwan<\/a>.\r\n      <\/p>\r\n   <\/introduction>\r\n   <h3>Contents<\/h3>\r\n   <div>\r\n      <ul>\r\n         <li><a href=\"#1\">Then and Now<\/a><\/li>\r\n         <li><a href=\"#2\">Make Install<\/a><\/li>\r\n         <li><a href=\"#5\">MATLAB Toolbox<\/a><\/li>\r\n         <li><a href=\"#7\">Comments<\/a><\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <h3>Then and Now<a name=\"1\"><\/a><\/h3>\r\n   <p>My pick this week is a tool that makes it easy to package your own toolboxes into a single installer file to distribute. \r\n      For 12.5 years this file has served a great purpose.\r\n   <\/p>\r\n   <p>Starting with MATLAB R2012b, we introduced <a href=\"https:\/\/www.mathworks.com\/discovery\/matlab-apps.html\">Apps<\/a>.  Apps packaging allow you to take your user interface and package it into a single file. A dependency analysis is done and\r\n      you can include any auxiliary files that might be necessary such as data.  The generated app has version control and can be\r\n      installed into another user's Apps tab.  Apps, however, only have one entry point and are thus not good for toolbox packaging.\r\n   <\/p>\r\n   <p>Now, beginning with R2014b, you can package your own toolbox from the MATLAB toolstrip and it will build a single install\r\n      file like Norbert's makeinstall.\r\n   <\/p>\r\n   <p>Let's look at the two approaches: here is a directory of a few of my utilities I'd like to package up.<\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmakeinstall\/utildir.PNG\"> <\/p>\r\n   <h3>Make Install<a name=\"2\"><\/a><\/h3><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">currentdir = cd(<span style=\"color: #A020F0\">'myutils'<\/span>); <span style=\"color: #228B22\">% navigate<\/span>\r\n\r\nmakeinstall <span style=\"color: #228B22\">% Build install<\/span>\r\n\r\ncd(currentdir) <span style=\"color: #228B22\">% restore<\/span><\/pre><p>Three files are generate in my directory:<\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmakeinstall\/installim.PNG\"> <\/p>\r\n   <p>I copied these to a new directory and ran <tt>install<\/tt>.  It took me through some steps, including how to add it to path at startup, a few tips on what it does and how to use it.\r\n       At the end it recommends running the following to see the contents:\r\n   <\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">helpwin <span style=\"color: #A020F0\">myutils<\/span><\/pre><p>Which reveals the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/add-help-for-your-program.html\">H1 lines<\/a> for my functions!\r\n   <\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmakeinstall\/helpwin.PNG\"> <\/p>\r\n   <p>I'm impressed.  In addition to this, there's also the <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/3698-makeinstall-technology\">Make Install Technology<\/a> white paper that explains how this all works in great detail.\r\n   <\/p>\r\n   <h3>MATLAB Toolbox<a name=\"5\"><\/a><\/h3>\r\n   <p>Now let's use the R2014b functionality.<\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmakeinstall\/packageatbx.PNG\"> <\/p>\r\n   <p>I'll select the folder and it will grab all of the files and their dependencies.  Then I can put in any other meta information,\r\n      documentation example etc. that I might have:\r\n   <\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmakeinstall\/packageatbx2.PNG\"> <\/p>\r\n   <p>This builds a single install file which I can give to anyone:<\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmakeinstall\/installerfile.PNG\"> <\/p>\r\n   <p>This can be installed into the custom toolboxes.<\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmakeinstall\/installedw.PNG\"> <\/p>\r\n   <p>It's automatically added to the path so those utilities can be used anywhere.  I do hazard a word of caution that this may\r\n      make it easier to have shadowed files.  For example: I now have three versions of those functions, which one is actually going\r\n      to be called?  If I make an update to one, how do I ensure it's the right one? <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/which.html\"><tt>which -all<\/tt><\/a> will be your friend here.\r\n   <\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">which <span style=\"color: #A020F0\">-all<\/span> <span style=\"color: #A020F0\">FEX<\/span><\/pre><pre>C\\Documents\\MATLAB\\FEX.m\r\nC\\Documents\\MATLAB\\myutils\\FEX.m            % Shadowed\r\nC\\Documents\\MATLAB\\Toolboxes\\myutils\\FEX.m  % Shadowed<\/pre><h3>Comments<a name=\"7\"><\/a><\/h3>\r\n   <p>So thank you Norbert for being ahead of the curve and providing us with the make install technology as well as for maintaining\r\n      it over the last decade.\r\n   <\/p>\r\n   <p>Give both approaches a try and let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=5552#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/1529-makeinstall#comments\">comment<\/a> for Norbert.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_c86b72ac8f8a448488f51718bd4637f3() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='c86b72ac8f8a448488f51718bd4637f3 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' c86b72ac8f8a448488f51718bd4637f3';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Sean de Wolski';\r\n        copyright = 'Copyright 2014 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_c86b72ac8f8a448488f51718bd4637f3()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2014b<br><\/p>\r\n<\/div>\r\n<!--\r\nc86b72ac8f8a448488f51718bd4637f3 ##### SOURCE BEGIN #####\r\n%% Make Install\r\n%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/answers\/contributors\/3208495\r\n% Sean>'s pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/1529-makeinstall makeinstall>\r\n% and <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/3698-makeinstall-technology\r\n% Make Install Technology> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/200897\r\n% Norbert Marwan>.\r\n% \r\n\r\n%% Then and Now\r\n%\r\n% My pick this week is a tool that makes it easy to package your own\r\n% toolboxes into a single installer file to distribute.  For 12.5 years\r\n% this file has served a great purpose.\r\n%\r\n% Starting with MATLAB R2012b, we introduced\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/apps.html Apps>.  Apps packaging\r\n% allow you to take your user interface and package it into a single file.\r\n% A dependency analysis is done and you can include any auxiliary files\r\n% that might be necessary such as data.  The generated app has version\r\n% control and can be installed into another user's Apps tab.  Apps,\r\n% however, only have one entry point and are thus not good for toolbox\r\n% packaging.\r\n%\r\n% Now, beginning with R2014b, you can package your own toolbox from the\r\n% MATLAB toolstrip and it will build a single install file like Norbert's\r\n% makeinstall.\r\n%\r\n% Let's look at the two approaches: here is a directory of a few of my\r\n% utilities I'd like to package up.\r\n%\r\n% <<utildir.PNG>>\r\n%\r\n\r\n%% Make Install\r\n\r\ncurrentdir = cd('myutils'); % navigate\r\n\r\nmakeinstall % Build install\r\n\r\ncd(currentdir) % restore\r\n\r\n%%\r\n% Three files are generate in my directory:\r\n% \r\n% <<installim.PNG>>\r\n%\r\n% I copied these to a new directory and ran |install|.  It took me through\r\n% some steps, including how to add it to path at startup, a few tips on\r\n% what it does and how to use it.  At the end it recommends running the\r\n% following to see the contents:\r\n\r\nhelpwin myutils\r\n\r\n%% \r\n% Which reveals the\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/add-help-for-your-program.html\r\n% H1 lines> for my functions!\r\n%\r\n% <<helpwin.PNG>>\r\n%\r\n% I'm impressed.  In addition to this, there's also the\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/3698-makeinstall-technology Make Install\r\n% Technology> white paper that explains how this all works in great detail.\r\n\r\n\r\n%% MATLAB Toolbox\r\n%\r\n% Now let's use the R2014b functionality.  \r\n%\r\n% <<packageatbx.PNG>>\r\n% \r\n% I'll select the folder and it will grab all of the files and their\r\n% dependencies.  Then I can put in any other meta information,\r\n% documentation example etc. that I might have:\r\n%\r\n% <<packageatbx2.PNG>>\r\n%\r\n% This builds a single install file which I can give to anyone:\r\n%\r\n% <<installerfile.PNG>>\r\n%\r\n% This can be installed into the custom toolboxes.\r\n%\r\n% <<installedw.PNG>>\r\n%\r\n% It's automatically added to the path so those utilities can be used\r\n% anywhere.  I do hazard a word of caution that this may make it easier to\r\n% have shadowed files.  For example: I now have three versions of those\r\n% functions, which one is actually going to be called?  If I make an update\r\n% to one, how do I ensure it's the right one?\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/ref\/which.html?searchHighlight=which#btmmoj0-8\r\n% |which -all|> will be your friend here.\r\n%\r\nwhich -all FEX\r\n%%\r\n%\r\n%  C\\Documents\\MATLAB\\FEX.m\r\n%  C\\Documents\\MATLAB\\myutils\\FEX.m            % Shadowed\r\n%  C\\Documents\\MATLAB\\Toolboxes\\myutils\\FEX.m  % Shadowed\r\n\r\n%% Comments\r\n% \r\n% So thank you Norbert for being ahead of the curve and providing us with\r\n% the make install technology as well as for maintaining it over the last\r\n% decade.\r\n%\r\n% Give both approaches a try and let us know what you think\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=5552#respond here> or leave a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/1529-makeinstall#comments\r\n% comment> for Norbert.\r\n%\r\n \r\n\r\n##### SOURCE END ##### c86b72ac8f8a448488f51718bd4637f3\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmakeinstall\/utildir.PNG\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\n   \r\n      Sean's pick this week is makeinstall and Make Install Technology by Norbert Marwan.\r\n      \r\n   \r\n   Contents\r\n   \r\n      \r\n      ... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2014\/10\/03\/make-install\/\">read more >><\/a><\/p>","protected":false},"author":87,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,28],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5552"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=5552"}],"version-history":[{"count":11,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5552\/revisions"}],"predecessor-version":[{"id":8623,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5552\/revisions\/8623"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=5552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=5552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=5552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}