Unable to exclude header file from git submodule

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Aashikms
Level 1
Level 1
First reply posted First question asked Welcome!

Hi,

We have a git project created on modust toolbox.we have a header file named common.h in source folder and also one more header file with name common.h is available in git submodule. I am not ableto exclude this .h file from building. i am using CY_IGNORE in makefile and it doesn't seems to be working.

CY_IGNORE+=$(wildcard ./<folder path>/common.h)

Please suggest how i can exclude this from referencing in build.

Thanks

Aashik MS

PS: CY_IGNORE working well to ignore folder and .c file.

0 Likes
1 Solution
Charles_Lai
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 sign-ins
There are a number of command-line options you can use to add additional directories to the search path. The most commonly-used option is -Idir, which causes dir to be searched after the current directory (for the quote form of the directive) and ahead of the standard system directories. You can specify multiple -I options on the command line, in which case the directories are searched in left-to-right order.
If you specify other options on the command line, such as -I, that affect where the preprocessor searches for header files, the directory list printed by the -v option reflects the actual search path used by the preprocessor.

Also, you could append the relevant mid-path before common.h to restrict the search pattern, i.e., #include "some_path_pattern_that_distinguishes/common.h".

View solution in original post

0 Likes
3 Replies
Charles_Lai
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 sign-ins

Hi,

The solutions vary a bit based on your files' structure. You could start by trying #include "common.h"  or #include <common.h> with luck.

See: Search Path (The C Preprocessor) (gnu.org)

Best regards

0 Likes

Thanks for reply, but i cannot modify the submodue source file. I need a way to exclude this common.h file from outside like in makefile or CLI command.

0 Likes
Charles_Lai
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 sign-ins
There are a number of command-line options you can use to add additional directories to the search path. The most commonly-used option is -Idir, which causes dir to be searched after the current directory (for the quote form of the directive) and ahead of the standard system directories. You can specify multiple -I options on the command line, in which case the directories are searched in left-to-right order.
If you specify other options on the command line, such as -I, that affect where the preprocessor searches for header files, the directory list printed by the -v option reflects the actual search path used by the preprocessor.

Also, you could append the relevant mid-path before common.h to restrict the search pattern, i.e., #include "some_path_pattern_that_distinguishes/common.h".

0 Likes