www.digitalmars.com         C & C++   DMDScript  

D - small contribution

reply "Carlos Santander B." <carlos8294 msn.com> writes:
Well, I tried to do this on Wiki4D, but I didn't know how, so I'm doing it
here.
Basically, I don't want to compile every single .d file on a project just
because I modified one of them. And I didn't want to create a makefile, or a
.sh file, worse yet type a very long line every time I want to compile them.
So I said: "what if DMD knew wether (sp?) a .d file needs to be compiled or
not?". So I did it. This file (that I've called "compile" since I couldn't
think of anything better) receives a number of arguments (files or flags)
and checks if the .d file is older or not than the .obj file (if exists).
Warning: it doesn't handle .lib files.
So you can do: "compile -O -release file1 file2 file3". And it will call dmd
with the respective flags to compile every file. Then you can change file1
and type the exact same line, and it won't compile file2 nor file3, and
still link them. You can always pass the "-c" flag, of course. Let me know
what you guys think.

-------------------------
Carlos Santander


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25


begin 666 compile.zip


MAS3-N=_G7)NN-UQ(]$19P9_JZ/B(&B /:UE0O =J*2B[A^_C(_);$L&0-_ 1

MEM,"X>>FP)YQ<3903):>.^#K
M;GD8AFB^PJP `L/_A78+=-EY=Z&Z<EY49\Y5?SP<)0BO!!6FZ8[.82L+(AL8

M_7Z;)3-_?#L
M++U. #K") GXZE$3;; 3)&\V,+C(* &Y:J]1`E [DA$&Y660*T$!*&/)9UK0
M/YYFB"Y>W;!P?6/F'YJAI&O4=5H2R\ D+&--IY>7)L,ED8JZC*Z)5P:(-575
M_GXQ`QB_0<5K< 6B5>!G(-ZFXN]3\3>IH*/W>7C+FEXTRMXL&^"T1'JLL"+L
M7CZ<?_7;Y5.1I*J)X6U%)8+-S6$'48P8>4(:.0A=1*T?>21Y7&*(M0R5L+)6
MAK 7T?.#J
M'SF.L:GB>2EC=8BP(#L:K03!GC^EN:D"$LI/\6FOQ55_UN:;(?=]*([M>FH_

M?M"W2O(:[U<9V47?-:$N$O>.!>!H+;M+;8?8B^&T%]FQ]6/1+H O_P!02P$"
M% `4````" "1 W<NRP>'N:4"``!,!0``"0`````````!`" `MH$`````8V]M
<<&EL92YD4$L%! `````!``$`-P```,P"````````
`
end
Apr 01 2003
next sibling parent reply Helmut Leitner <helmut.leitner chello.at> writes:
"Carlos Santander B." wrote:
 Well, I tried to do this on Wiki4D, but I didn't know how, so I'm doing it
 here.
I added the pages to the Wiki, so you can continue by just editing them. <http://www.prowiki.org/wiki4d/wiki.cgi?CarlosSantander> <http://www.prowiki.org/wiki4d/wiki.cgi?compile>
 Basically, I don't want to compile every single .d file on a project just
 because I modified one of them. And I didn't want to create a makefile, or a
 .sh file, worse yet type a very long line every time I want to compile them.
 So I said: "what if DMD knew wether (sp?) a .d file needs to be compiled or
 not?". So I did it. This file (that I've called "compile" since I couldn't
 think of anything better) receives a number of arguments (files or flags)
 and checks if the .d file is older or not than the .obj file (if exists).
 Warning: it doesn't handle .lib files.
 So you can do: "compile -O -release file1 file2 file3". And it will call dmd
 with the respective flags to compile every file. Then you can change file1
 and type the exact same line, and it won't compile file2 nor file3, and
 still link them. You can always pass the "-c" flag, of course. Let me know
 what you guys think.
I would like to use it. Something in between simple batch files and a full-blown make file. It would also make an additional example. To upload a zip (I'll write an HowToUpload as soon as possible): (1) follow this link: <http://www.prowiki.org/wiki4d/wiki.cgi?action=upload> (2) login username: duser password: duser (3) upload Browse to select your file (e.g. compile.zip) press button "Do the Upload" (4) make the link available write on some page <http://www.prowiki.org/upload/duser/compile.zip) -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 01 2003
parent Jonathan Andrew <Jonathan_member pathlink.com> writes:
Helmut, 
I just checked out the Wiki4D for the first time, looks very nice! Thanks
for the work you put into it. And Carlos, still haven't had time to try it out,
but the compile script looks very cool, I've been wanting something like that.

-Jon

"Carlos Santander B." wrote:
 Well, I tried to do this on Wiki4D, but I didn't know how, so I'm doing it
 here.
I added the pages to the Wiki, so you can continue by just editing them. <http://www.prowiki.org/wiki4d/wiki.cgi?CarlosSantander> <http://www.prowiki.org/wiki4d/wiki.cgi?compile>
 Basically, I don't want to compile every single .d file on a project just
 because I modified one of them. And I didn't want to create a makefile, or a
 .sh file, worse yet type a very long line every time I want to compile them.
 So I said: "what if DMD knew wether (sp?) a .d file needs to be compiled or
 not?". So I did it. This file (that I've called "compile" since I couldn't
 think of anything better) receives a number of arguments (files or flags)
 and checks if the .d file is older or not than the .obj file (if exists).
 Warning: it doesn't handle .lib files.
 So you can do: "compile -O -release file1 file2 file3". And it will call dmd
 with the respective flags to compile every file. Then you can change file1
 and type the exact same line, and it won't compile file2 nor file3, and
 still link them. You can always pass the "-c" flag, of course. Let me know
 what you guys think.
I would like to use it. Something in between simple batch files and a full-blown make file. It would also make an additional example. To upload a zip (I'll write an HowToUpload as soon as possible): (1) follow this link: <http://www.prowiki.org/wiki4d/wiki.cgi?action=upload> (2) login username: duser password: duser (3) upload Browse to select your file (e.g. compile.zip) press button "Do the Upload" (4) make the link available write on some page <http://www.prowiki.org/upload/duser/compile.zip) -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 01 2003
prev sibling parent reply Ilya Minkov <midiclub 8ung.at> writes:
What that reminds me of, an advanced utility to avoid recompilation:

http://ccache.samba.org/


-i.

Carlos Santander B. wrote:
 Well, I tried to do this on Wiki4D, but I didn't know how, so I'm doing it
 here.
 Basically, I don't want to compile every single .d file on a project just
 because I modified one of them. And I didn't want to create a makefile, or a
 .sh file, worse yet type a very long line every time I want to compile them.
 So I said: "what if DMD knew wether (sp?) a .d file needs to be compiled or
 not?". So I did it. This file (that I've called "compile" since I couldn't
 think of anything better) receives a number of arguments (files or flags)
 and checks if the .d file is older or not than the .obj file (if exists).
 Warning: it doesn't handle .lib files.
 So you can do: "compile -O -release file1 file2 file3". And it will call dmd
 with the respective flags to compile every file. Then you can change file1
 and type the exact same line, and it won't compile file2 nor file3, and
 still link them. You can always pass the "-c" flag, of course. Let me know
 what you guys think.
 
 -------------------------
 Carlos Santander
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25
 
 
Apr 07 2003
parent reply Dan Liebgold <Dan_member pathlink.com> writes:
'ccache' looks like it just caches header compiles (kind of like VC++'s
precompiled headers).  D could also benefit from this, but the dmd compiler
would need an option (like gcc's -E) to output the "import" preprocessed version
of a .d file, if such a version ever exists.

This would definately serve a purpose on large projects, where header/import
file compilation would begin to become very inefficient, as many files will
include/import the same source files over and over again, requiring repeated
processing of that file.  VC++'s precompiled headers are a real lifesaver in
that case, and apparently so is ccache.

Dan

In article <b6t3mq$p1q$1 digitaldaemon.com>, Ilya Minkov says...
What that reminds me of, an advanced utility to avoid recompilation:

http://ccache.samba.org/


-i.

Carlos Santander B. wrote:
 Well, I tried to do this on Wiki4D, but I didn't know how, so I'm doing it
 here.
 Basically, I don't want to compile every single .d file on a project just
 because I modified one of them. And I didn't want to create a makefile, or a
 .sh file, worse yet type a very long line every time I want to compile them.
 So I said: "what if DMD knew wether (sp?) a .d file needs to be compiled or
 not?". So I did it. This file (that I've called "compile" since I couldn't
 think of anything better) receives a number of arguments (files or flags)
 and checks if the .d file is older or not than the .obj file (if exists).
 Warning: it doesn't handle .lib files.
 So you can do: "compile -O -release file1 file2 file3". And it will call dmd
 with the respective flags to compile every file. Then you can change file1
 and type the exact same line, and it won't compile file2 nor file3, and
 still link them. You can always pass the "-c" flag, of course. Let me know
 what you guys think.
 
 -------------------------
 Carlos Santander
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25
 
 
Apr 07 2003
parent Ilya Minkov <midiclub 8ung.at> writes:
Dan Liebgold wrote:
 'ccache' looks like it just caches header compiles (kind of like VC++'s
 precompiled headers).  D could also benefit from this, but the dmd compiler
 would need an option (like gcc's -E) to output the "import" preprocessed
version
 of a .d file, if such a version ever exists.
Not at all headers. Whole object code. CCache is a C rewrite of Compilercache, which was a shell script. That's what is said about it: --- 8< --- Compilercache is a wrapperscript around your C and C++ compilers. Each time you compile something, the wrapperscript puts the result of the compilation into a cache. And once you compile the same thing again, the result will be picked from the cache instead of being recompiled. You might wonder why you need this, since there seems to be another tool for this purpose, "make". But to get "make" working you need to create a Makefile. You need to take care of your dependencies manually. If you make a mistake, wrong code will be generated. Another drawback with "make" is that if you normally compile your project with -O2 (optimizations) and now want to debug it, you will have to recompile the whole stuff with -g (debugging). now with "make" you have to do a "make clean", then change the options, and then recompile everything. With compilercache you basically do the same, but if your project has already been compiled with -g in the past, and now currently you run it with -O2 and want to switch back to -g, the old compilation results will be picked from the cache. i.e. switching compiler options goes fast! not like "make" which forces you into a complete recompilation. Since compilercache is just a wrapper around your compiler, you can still use "make" if you want. compilercache does no harm. All it does is sometimes speed up the compilation run by getting the result out of the cache. --- >8 --- BTW, Burton already wrote an utility to strip modules of definition bodies, turning them into headers. And someday the compiler should just generate annotations is binary alongside with object code. That is, unit.obj gets unit.exp containing exports in an easy-to-load form, or both might land inside a lib. This .exp should contain not only the parsed declarations, but also information which can not necessarily be gained from them. Like, calling convention chosen, purity of a function, possibly some other things which may only be evaluated after full-source parsing or in the course of compilation. -i.
Apr 09 2003