shelman
shelman

Reputation:

Why doesn't changing a macro (#define) in a header file require a new build?

I'm somewhat new to C and just discovered something interesting. I changed the value of a simple macro that was #defined in a header file

#define MRB 1000

to

#define MRB 100

and when I ran make again, it said there were no changes ("nothing to be done for 'all'"). How exactly do macros work such that they don't need to be part of a build?

Upvotes: 0

Views: 427

Answers (2)

rlibby
rlibby

Reputation: 6021

This has a lot more to do with how make works than how macros work. If it doesn't require a rebuild, then you have specified your dependencies incorrectly. Read up on makedepend.

Upvotes: 4

wallyk
wallyk

Reputation: 57784

If the include file is actually used, then it should trigger a build. If it doesn't, the dependency rules are incomplete.

Upvotes: 1

Related Questions