Re: Nice ways to compile [message #43408] |
Mon, 11 April 2005 18:18  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Mon, 11 Apr 2005 13:42:43 -0500, Michael A. Miller wrote:
> I make save files by creating an idl script that compiles all the
> codes that my application uses (or at least those that I can
> remember!). I include resolve_all and resolve_all, /class for
> all the classes that I need. Then I do a save and exit. So
> making a save set is just a command like "idl make_save_file.pro"
> (see below). This has all the elegance of makefile that is
> maintained by hand, which is to say, very little. I've
> considered trying to make a preprocessor that creates header
> files so I can use makedepend. If incremental compilation were
> possible (that is, loading compiled code, instead of having to
> compile in order to make code available), that would be useful,
> but with IDL, it doesn't seem neccessary.
>
> Usually I create my make_save_file.pro's from listings of all the
> *.pro files in the directories where I know I've got code
> components for a given application. That makes save files with
> cruft that is never used, but it hasn't (yet) left me with
> anything missing.
When creating a SAV file, I go through and compile all my code one
procedure at a time, as below. First I regularize the path, then I go
through all ".pro" files, pruning any rejects, and compile them. Only
then do I call RESOLVE_ALL, and write out the binary. Since path
caching tends to mess up dynamic path changes, I tend to do this in a
new IDL session.
Does anyone else get TRNLOG and SETLOG errors when
RESOLVE_ALL runs? As near as I can tell, these are some obsolete VMS
routines that seem to sneak in somehow (through NasaLIB, I believe).
JD
pro compile_cubism
FORWARD_FUNCTION TRNLOG
@cubism_dir
ps=path_sep()
bindir=filepath(ROOT=cubism_dir,'bin')
if file_test(filepath(ROOT=bindir,'cubism_vm.sav')) then $
file_delete,filepath(ROOT=bindir,'cubism_vm.sav')
;; Go one level up and compile everything
sourcepath=cubism_dir
sourcepath=strmid(sourcepath,0,strpos(sourcepath,ps,/REVERSE _SEARCH))
;; Normalize path
path=strsplit(!PATH,':',/EXTRACT)
wh=where((sp=strpos(path,ps+'nasa',/REVERSE_SEARCH)) ne -1)
nasa=strmid(path[wh[0]],0,sp[wh[0]]+5)
!PATH=expand_path('<IDL_DEFAULT>'+":+"+sourcepath+':+'+nasa)
files=file_search(sourcepath,'*.pro')
skip_files=['cubism_dir','cubism_version','compile_cubism', $
ps+'scraps'+ps,'CVS'+ps]
resolve_routine,'XManager',/COMPILE_FULL_FILE
skip=0
for i=0,n_elements(files)-1 do begin
for j=0,n_elements(skip_files)-1 do begin
if strpos(files[i],skip_files[j]) ne -1 then begin
print,'Skipping '+files[i]
skip=1
break
endif
endfor
if skip then begin
skip=0
continue
endif
print,'Compiling '+files[i]
routine=strmid(files[i],0,strpos(files[i],".pro",/REVERSE_SEARCH))
routine=strmid(routine,strpos(files[i],ps,/REVERSE_SEARCH)+1 )
resolve_routine,routine,/EITHER,/NO_RECOMPILE,/COMPILE_FULL_ FILE
endfor
resolve_all,/CONTINUE_ON_ERROR
save,/ROUTINES,FILENAME=filepath(ROOT=bindir,'cubism_vm.sav' )
end
|
|
|