compiling without changing main.c

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
dcTom
DCEmu Junior
DCEmu Junior
Posts: 43
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Mon Feb 20, 2017 7:49 pm
Has thanked: 0
Been thanked: 0

compiling without changing main.c

Post by dcTom »

if the main.c is not changed but the file controller.c has some changing, the makefile is doing nothing,
i always have to change the main.c and save it.
is there a way that the makefile is compiling everything again, although nothing has been changed at main.c?
User avatar
T_chan
DC Developer
DC Developer
Posts: 32
Joined: Mon Aug 22, 2011 12:45 pm
Has thanked: 12 times
Been thanked: 22 times

Re: compiling without changing main.c

Post by T_chan »

Maybe try:

make clean
make

(1st command deletes intermediate objects normally)
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: compiling without changing main.c

Post by BlueCrab »

If you really want it to recompile main.c even though it hasn't changed, then you probably should be running "make clean" as was said. That said, unless you're doing something like '#include "controller.c"' in main.c, then you shouldn't need to recompile main.c if it hasn't changed...

If you only want it recompiling the file that changed and redoing the linking step, then if you set up dependencies correctly in your Makefile, that should happen already. If you're actually #include'ing the controller.c in main.c, then you can also use dependencies to deal with that in your Makefile (but you really shouldn't be doing that with #include -- that's what the linker is for).
Post Reply