How do I include the makefile in the ZIP file generated using packNgo?

5 views (last 30 days)
I generate C/C++ code from my model with the options 'Generate code only' and 'Package code and artifacts' enabled. So after code generation the result is a ZIP file where I would expect all the files required to compile the executable.
However, there are some required files missing in the ZIP file, for example the makefile.
I would like to have everything in the ZIP file after the code generation process, so I don't have to scramble all the files together afterwards. Are there any settings for this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Nov 2020
Edited: MathWorks Support Team on 4 Nov 2020
It is a documented limitation that the packNgo feature does not include all files from code generation folder, including makefiles:
packNgo was mainly designed for users who would like to relocate the generated code to another environment or software project. For this use case, packaging the makefile is not necessary.
To work around the issue, disable the 'Package code and artifacts' option and run below script after the code generation has finished:
model = gcs;
bDirInfo = RTW.getBuildDir(model);
makefile = [model '.mk'];
cd(bDirInfo.BuildDirectory);
load('buildInfo.mat');
addNonBuildFiles(buildInfo, makefile, bDirInfo.BuildDirectory);
% once the makefile is "in" buildInfo, you can run PACKNGO and
% it will automatically include the makefile
% (and any other nonBuildFile you wish to add)
packNGo(buildInfo,{'packType', 'hierarchical','nestedZipFiles',false});

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Tags

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!