On Wed, 14 Oct 2009, Lorenzo Fiorini wrote:
> >  * harbour/bin/hb-func.sh
> >    ! do not look for .c files as result of hbcmp script executed
> >      with -s or -sm switch and without -g[oh] * switches.
> I've locally added a -MD switch to hb-func.sh:
> ...
>         -MD=*)       HB_MD="\${v#*=}" ;;
> ...
> hb_cmp()
> {
>     ${hb_cmpname} "\$@" \${HB_OPT} \${HB_PATHS} && \\
>     ( [ "\${HB_GEN//c/}" != "" ] || [ "\${HB_NOC}" = "yes" ] || \\
>     ( [ -f "\${FOUTC}" ] && \\
>     hb_cc -c "\${FOUTC}" -o "\${FOUTO}" && \\
>     ( [ "\${HB_GEN}" = "c" ] || rm -f "\${FOUTC}" ) ) )
>     if [ -n "\${HB_MD}" ]; then
>        MDOUT=\`${hb_cmpname} "\$@" -q0 -m -sm \${HB_OPT} \${HB_PATHS}\`
>        echo \${FILEOUT}: \${MDOUT} > \${HB_MD}
>     fi
> }
> ...
> The rules.mk so looks like:
> ...
> -include $(DFILES)
> %.hrb: $(ROOT)%.prg
>       hbcmp $(PRGFLAGS) -MD=$(@:.hrb=.d) $< -o$@
> ...
> The requirements are to define -o file and use -MD=file.d.
> Do you see any better way to do it or any problem with it?

I intentionally haven't implemented such switch at hb* scripts
level because it has to execute Harbour compiler twice so it
causes additional speed overhead.
Now Harbour supports -gd option which enable such functionality
directly in compiler so .d files can be generated without any
additional time cost caused by second .prg files preprocessing.
It means that your final rules can look like:

%.hrb: $(ROOT)%.prg
        hbcmp $(PRGFLAGS) -gh -gd $< -o$@

%.o: $(ROOT)%.prg
        hbcmp $(PRGFLAGS) -gc0 -gd.o $< -o$@

best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to