www.digitalmars.com         C & C++   DMDScript  

c++ - Verbose compile

reply "Gisle Vanem" <giva users.sourceforge.net> writes:
I just discovered the dmc '-v2' switch and it's very
handy some times to see all the headers involved in a
compile. E.g.

dmc -mn -DWINDOWS -I. -v2 -oDMC_obj/utils.obj -c utils.c
scppn -mn -DWINDOWS -I. -v2 utils.c -oDMC_obj/utils.obj
Digital Mars C/C++ Compiler Version 8.35.10n
Copyright (C) Digital Mars 2000-2003.  All Rights Reserved.
Written by Walter Bright
www.digitalmars.com
 'utils.c'
  '.\config.h'
  'd:\prog\dmc\bin\..\include\stdio.h'
  'd:\prog\dmc\bin\..\include\stdlib.h'
   'd:\prog\dmc\bin\..\include\heapstat.h'
  'd:\prog\dmc\bin\..\include\string.h'
  'd:\prog\dmc\bin\..\include\sys/types.h'
  'd:\prog\dmc\bin\..\include\limits.h'
  'd:\prog\dmc\bin\..\include\sys/utime.h'
   'd:\prog\dmc\bin\..\include\utime.h'
    'd:\prog\dmc\bin\..\include\sys\types.h'
  'd:\prog\dmc\bin\..\include\errno.h'
  'd:\prog\dmc\bin\..\include\fcntl.h'
  'd:\prog\dmc\bin\..\include\assert.h'
  'd:\prog\dmc\bin\..\include\signal.h'
  'wget.h'
   'sysdep.h'
    'd:\prog\dmc\bin\..\include\time.h'
    'd:\prog\dmc\bin\..\include\sys/stat.h'
    '.\mswindows.h'
     'd:\prog\dmc\bin\..\include\windows.h'
      'd:\prog\dmc\bin\..\include\win32\scdefs.h'
      'd:\prog\dmc\bin\..\include\win32\WINDOWS.H'
       'd:\prog\dmc\bin\..\include\excpt.h'
       'd:\prog\dmc\bin\..\include\stdarg.h'
       'd:\prog\dmc\bin\..\include\windef.h'
        'd:\prog\dmc\bin\..\include\win32\WINDEF.H'
         'd:\prog\dmc\bin\..\include\winnt.h'
          'd:\prog\dmc\bin\..\include\win32\WINNT.H'
           'd:\prog\dmc\bin\..\include\ctype.h'

Way to go Walter!

Only wish the paths where all canonical.

-- 
Gisle V.


/bin/laden: Not found
Oct 14 2003
parent reply "grammer" <pgrammer_81 hotmail.com> writes:
"Gisle Vanem" <giva users.sourceforge.net> wrote in message
news:bmgrr5$2a6g$1 digitaldaemon.com...
 I just discovered the dmc '-v2' switch and it's very
 handy some times to see all the headers involved in a
 compile. E.g.

 dmc -mn -DWINDOWS -I. -v2 -oDMC_obj/utils.obj -c utils.c
 scppn -mn -DWINDOWS -I. -v2 utils.c -oDMC_obj/utils.obj
 Digital Mars C/C++ Compiler Version 8.35.10n
 Copyright (C) Digital Mars 2000-2003.  All Rights Reserved.
 Written by Walter Bright
 www.digitalmars.com
  'utils.c'
   '.\config.h'
   'd:\prog\dmc\bin\..\include\stdio.h'
   'd:\prog\dmc\bin\..\include\stdlib.h'
    'd:\prog\dmc\bin\..\include\heapstat.h'
   'd:\prog\dmc\bin\..\include\string.h'
   'd:\prog\dmc\bin\..\include\sys/types.h'
   'd:\prog\dmc\bin\..\include\limits.h'
   'd:\prog\dmc\bin\..\include\sys/utime.h'
    'd:\prog\dmc\bin\..\include\utime.h'
     'd:\prog\dmc\bin\..\include\sys\types.h'
   'd:\prog\dmc\bin\..\include\errno.h'
   'd:\prog\dmc\bin\..\include\fcntl.h'
   'd:\prog\dmc\bin\..\include\assert.h'
   'd:\prog\dmc\bin\..\include\signal.h'
   'wget.h'
    'sysdep.h'
     'd:\prog\dmc\bin\..\include\time.h'
     'd:\prog\dmc\bin\..\include\sys/stat.h'
     '.\mswindows.h'
      'd:\prog\dmc\bin\..\include\windows.h'
       'd:\prog\dmc\bin\..\include\win32\scdefs.h'
       'd:\prog\dmc\bin\..\include\win32\WINDOWS.H'
        'd:\prog\dmc\bin\..\include\excpt.h'
        'd:\prog\dmc\bin\..\include\stdarg.h'
        'd:\prog\dmc\bin\..\include\windef.h'
         'd:\prog\dmc\bin\..\include\win32\WINDEF.H'
          'd:\prog\dmc\bin\..\include\winnt.h'
           'd:\prog\dmc\bin\..\include\win32\WINNT.H'
            'd:\prog\dmc\bin\..\include\ctype.h'

 Way to go Walter!

 Only wish the paths where all canonical.

 -- 
 Gisle V.


 /bin/laden: Not found
I just realized that the dmc -d option produces a .dep file that lists all the dependencies of a compiled file. The real boon is that the digital mars make program expands $(filename) to the contents of the file. I don't know if this is a common feature of make programs because it was only mentioned breifly in the compiler's documentation. Anyway, the end result is that the makefiles almost write themselves. file.obj: ($file.dep) file.cpp dmc file.cpp -d -c The above will rebuild the target when the cpp file changes or when any .h file listed in the .dep file changes. And of course, the .dep file gets regenerated whenever the .cpp file or any .h file is modified. Perfect :)
Dec 16 2003
parent "Lars M." <special.agent gmx.net> writes:
You are right, it is an extremely useful feature. I have just downloaded
DM - it is my first command line environment (I use the free version), and
so I took a look in the "bin" folder, discovered "make.exe" and read several
make tutorials - all just outline the structure of a make file, not how to
use them effectively!

None mentioned any shortcut like this! You don have to write

file.obj: $(file.dep) file.cpp

but

file.obj: ($file.dep)

seems to be enough. I don't know what happens when file.dep does not exist,
maybe no dependencies will be "filled in", and that causes make to rebuild
the target - and when make is invoked the next time, it fills in the
required dependencies.

I have no idea how to effectively program in a command-line environment
(although DM does not come with too many .exes, there is MinGW for example,
which does), can you recommend any step-by-step tutorials for newbies like
me?

-Lars
"grammer" <pgrammer_81 hotmail.com> schrieb im Newsbeitrag
news:brndmo$1dj2$1 digitaldaemon.com...
 "Gisle Vanem" <giva users.sourceforge.net> wrote in message
 news:bmgrr5$2a6g$1 digitaldaemon.com...
 I just discovered the dmc '-v2' switch and it's very
 handy some times to see all the headers involved in a
 compile. E.g.

 dmc -mn -DWINDOWS -I. -v2 -oDMC_obj/utils.obj -c utils.c
 scppn -mn -DWINDOWS -I. -v2 utils.c -oDMC_obj/utils.obj
 Digital Mars C/C++ Compiler Version 8.35.10n
 Copyright (C) Digital Mars 2000-2003.  All Rights Reserved.
 Written by Walter Bright
 www.digitalmars.com
  'utils.c'
   '.\config.h'
   'd:\prog\dmc\bin\..\include\stdio.h'
   'd:\prog\dmc\bin\..\include\stdlib.h'
    'd:\prog\dmc\bin\..\include\heapstat.h'
   'd:\prog\dmc\bin\..\include\string.h'
   'd:\prog\dmc\bin\..\include\sys/types.h'
   'd:\prog\dmc\bin\..\include\limits.h'
   'd:\prog\dmc\bin\..\include\sys/utime.h'
    'd:\prog\dmc\bin\..\include\utime.h'
     'd:\prog\dmc\bin\..\include\sys\types.h'
   'd:\prog\dmc\bin\..\include\errno.h'
   'd:\prog\dmc\bin\..\include\fcntl.h'
   'd:\prog\dmc\bin\..\include\assert.h'
   'd:\prog\dmc\bin\..\include\signal.h'
   'wget.h'
    'sysdep.h'
     'd:\prog\dmc\bin\..\include\time.h'
     'd:\prog\dmc\bin\..\include\sys/stat.h'
     '.\mswindows.h'
      'd:\prog\dmc\bin\..\include\windows.h'
       'd:\prog\dmc\bin\..\include\win32\scdefs.h'
       'd:\prog\dmc\bin\..\include\win32\WINDOWS.H'
        'd:\prog\dmc\bin\..\include\excpt.h'
        'd:\prog\dmc\bin\..\include\stdarg.h'
        'd:\prog\dmc\bin\..\include\windef.h'
         'd:\prog\dmc\bin\..\include\win32\WINDEF.H'
          'd:\prog\dmc\bin\..\include\winnt.h'
           'd:\prog\dmc\bin\..\include\win32\WINNT.H'
            'd:\prog\dmc\bin\..\include\ctype.h'

 Way to go Walter!

 Only wish the paths where all canonical.

 -- 
 Gisle V.


 /bin/laden: Not found
I just realized that the dmc -d option produces a .dep file that lists all the dependencies of a compiled file. The real boon is that the digital
mars
 make program expands $(filename) to the contents of the file. I don't know
 if this is a common feature of make programs because it was only mentioned
 breifly in the compiler's documentation. Anyway, the end result is that
the
 makefiles almost write themselves.

 file.obj: ($file.dep) file.cpp
     dmc file.cpp -d -c

 The above will rebuild the target when the cpp file changes or when any .h
 file listed in the .dep file changes. And of course, the .dep file gets
 regenerated whenever the .cpp file or any .h file is modified. Perfect :)
Jun 08 2004