Correction week 2: Makefile alu.o

Correction week 2: Makefile alu.o

by Jan David Linder -
Number of replies: 2

Hello,

In the correction of the Makefile of myprj there is the following:

#correcteur : alu.h inutile.
alu.o: alu.c alu.h bit.h
bit.o: bit.c bit.h

I don't understand why alu.h is unnecessary in the rule for alu.o if bit. h is on the other hand needed for the rule of bit.o.

Thanks in advance for your answer!

Cheers, Jan

In reply to Jan David Linder

Re: Correction week 2: Makefile alu.o

by Sylvain Nicolas Willy -

Hi,

The idea of a .h file is to "publicly expose" constants, functions, etc. related to a module (here, alu).

In you current file alu.c non of your function depend on another resource from the module : alu_add8 does not depend on alu_sub8 and vice-versa.

Therefore, it is not necessary to include alu.h in your alu.c file, nor in your compilation process.

Is it clear now ?

Sylvain