It has to be fully integrated with compiler because included files
may depend on conditional compilation so you have to activate compiler
with all compiler switches which are used for normal compilation (plus
switch(es) which enable autodependent checking) to preproces .prg files
otherwise it will not work for situations like:

  #xcommand INCLUDEFILE <file> => #include <file>
  #xcommand INCLUDEAGAIN => #ifndef _AGAIN; #define _AGAIN;;
INCLUDEFILE __FILE__ ; #endif
  #define SHOW_DATA #pragma __streaminclude "data.inc"|? %s
  #ifdef _AGAIN
     ? "SECOND PASS"
     SHOW_DATA
     ? "===="
  #else
     proc main()
        ? "main()"
        #if __HARBOUR__ + 0 >= 0x20000 .and. !defined( MYDEF )
           INCLUDEAGAIN
        #endif
     return
  #endif

when you compile this code with and without -DMYDEF parameter.
I think that you can easy imagine much more complicated situations.
In poractice you have to activate the compiler with all it's setting
and macros to fully replicate conditional compilation.
Please also remember that Harbour supports also #pragma __[c] streaminclude
which should also be detected and in the future may support some other
extensions like using compiler switches in #if expressions, i.e.:

  #if enabled( -kh )
     #include "hbext_rules.ch"
  #endif

I didn't know we have such feature :) In this case full
compilation is indeed unavoidable.

in summary it means that the only one method to generate correct
dependencies list which will always work is compiler (or code
which fully replicates compiler and PP behavior).
I'll add to compiler support for such functionality.
It will work like -M in GCC.
For hbmk2 which uses embedded Harbour compiler I also add support
for function which will return list of dependencies instead of
sending them to stdout.

Thanks Przemek, that would be great.

Brgds,
Viktor

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

Reply via email to