Hi,

On 05/20/2014 09:05 PM, chru...@suse.cz wrote:
> Well that is the problem with implicit rule that pulls in all the 
> dependencies.
>
> The problem is that Make is confused because we don't go the *.c + *.h
> -> *.o -> binary route but take shortcut *.c -> binary instead.
>
> If you look at the list of implicit rules (make --print-data-base) there is:
>
> LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
>
> %: %.c
>         $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
>
>
> So the final command used to link the testcase is:
>
> $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LOADLIBES) 
> $(LDLIBS) -o $@
>
> If you get choose to use the .c -> .o rule instead it uses:
>
> %.o: %.c:
>         $(COMPILE.c) $(OUTPUT_OPTION) $<
>
> Note the $< instead of $^. In this case only first dependency is passed to the
> compiler.
>
>
> One solution would be to override the build-in rule with our own:
>
> % %.c:
>       $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LOADLIBES) 
> $(LDLIBS) -o $@
>
> However there may be places that will break by this change.
>
> Or we may do a big step forward and stop using the implicit rules complety and
> write our own rules (which is what quite a lot of projects does). We can even
> utilize the gcc -MM and generate all testcase dependencies automatically...

Thanks very much for your help.
I will try to make a better version.

Regards,
Xiaoguang Wang
>


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to