function addUndefines(h, options, groups, params)
% ADDUNDEFINES - The addUndefines function adds specified preprocessor 
% macro definitions to the model's build information. "RTW.BuildInfo" 
% stores the definitions to remove in a vector. The function adds 
% definitions to the end of the vector based on the order in which you 
% specify them. Any directives in the makefile that match the definitions
% in this list are then removed from the build process.
% 
% Argument    Description
% buildinfo   Build information handle returned by RTW.Buildinfo.
% 
% undefs      A character array or cell array of character arrays that
%             specifies the preprocessor macro definitions to be added to
%             the object. The function adds each definition to the end of a
%             compiler option vector. To specify multiple definitions
%             within a single character array, for example {'RT', 'DEBUG'},
%             use a cell array. 
% 
% groups      (optional) A character array or cell array of character
%             arrays that groups specified definitions
%

% Copyright 2023 The MathWorks, Inc.
arguments
    h (1,1) RTW.BuildInfoBuildObj
    options
    groups = string.empty;
    params.SharedLibraryMerge = true;
    params.SourceFile string = string.empty; 
end

h.Options.addOptions('Undefines', options, groups, ...
    SharedLibraryMerge=params.SharedLibraryMerge, ...
    SourceFileHandles=getSourceFileHandles(h, params.SourceFile));
