function code_machine_header_file_custom(fileNameInfo)
% CODE_MACHINE_HEADER_FILE(FILENAMEINFO)

% Copyright 1995-2017 The MathWorks, Inc.
% $Revision: 1.1.6.9 $ $Date: 2013/11/11 14:29:14 $

global gMachineInfo %#ok<GVMIS>

fileName = fullfile(fileNameInfo.targetDirName,fileNameInfo.machineHeaderFile);
sf_echo_generating('Coder',fileName);
machine = gMachineInfo.machineId;

file = fopen(fileName,'Wt');
if file<3
construct_coder_error([],sprintf('Failed to create file: %s.',fileName),1);
return;
end

fprintf(file,'%s \n',get_boiler_plate_comment('machine',machine));

fprintf(file,'#ifndef __%s_%s_h__\n',gMachineInfo.machineName,gMachineInfo.targetName);
fprintf(file,'#define __%s_%s_h__\n',gMachineInfo.machineName,gMachineInfo.targetName);
fprintf(file,'\n');
fprintf(file,'%s\n',sfprivate('target_methods','MachineHeaderTop',gMachineInfo.target));
fprintf(file,'#include "tmwtypes.h"\n');
fprintf(file,'\n');
customCodeSettings = get_custom_code_settings(gMachineInfo.target,gMachineInfo.parentTarget);
customCodeString = customCodeSettings.customCode;
if(~isempty(customCodeString))
fprintf(file,'/* Custom Code from Simulation Target dialog*/\n');
fprintf(file,'%s\n',customCodeString);
fprintf(file,'\n');
end

file = dump_module(fileName,file,machine,'header');
if file < 3
return;
end
fprintf(file,'\n');
fprintf(file,'#endif\n');
fprintf(file,'\n');

fprintf(file,'\n');

fclose(file);
try_indenting_file(fileName);