Re: Script to compile all files with a given extension?
- From: Dances With Crows <danSPANceswithTRAPcrows@xxxxxxxxx>
- Date: Sat, 30 Jun 2007 09:12:21 -0500
sk8terg1rl staggered into the Black Sun and said:
On Jun 29, 11:39 pm, The Natural Philosopher <a...@xxx> wrote:
sk8terg1rl wrote:
Quite often I move source code between CPU architectures and need to
recompile it. Since discovering the joys of bootstrapping my
programs, I no longer have one big program but many smaller
interconnected ones.
Found out what make does with man make just now ;-) Unfortunately IIdentify all the files with .for and .f90 extensionsWrite a Makefile and use make?
Execute the commands:
'ifort program.for -o program'
'ifort program2.f90 -o program2'
don't think this would help much. Depending on the purpose of the
programs, they have different names. This would mean I would need a
makefile for each subset of programs.
Makefiles can have multiple dependencies and action lines. Like so:
OBJS=crud.o barf.o junk.o
SRCS=crud.c barf.c junk.c
HDRS=thing.h
all: $(OBJS) $(HDRS)
$(CC) $(CFLAGS) -o program $(OBJS)
OBJS: $(SRCS) $(HDRS)
$(CC) $(CFLAGS) -c $*.c
....multiple rules, multiple dependencies, etcetera. There's probably a
decent guide if you Google "makefile tutorial".
But dealing with makefiles can get complex fairly quickly. If all you
need is something that'll do what you said above, a simple bash script
will do it:
for file in *.for *.f90 ; do
prog=`echo $file | sed -e 's/\.for//' -e 's/\.f90//' `
ifort $file -o $prog
done
Currently I 'ls *.for; ls *.f90' and pipe the output into a script
file. Then with some vi magic I edit it to effectively get my own
makefile. This is less than convenient
Aye, which is why I wondered why you hadn't written something already.
FORTRAN sucks at text processing, but that's why they invented awk, sed,
and Perl (-:
--
"I was court-martialled in my absence, and sentenced to death in my
absence, so I said they could shoot me in my absence."
--Brendan F. Behan
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
.
- Follow-Ups:
- Re: Script to compile all files with a given extension?
- From: Dan Espen
- Re: Script to compile all files with a given extension?
- References:
- Re: Script to compile all files with a given extension?
- From: The Natural Philosopher
- Re: Script to compile all files with a given extension?
- Prev by Date: Re: rec does not record
- Next by Date: Re: how can a bit be off in memory?
- Previous by thread: Re: Script to compile all files with a given extension?
- Next by thread: Re: Script to compile all files with a given extension?
- Index(es):
Relevant Pages
|