Re: Script to compile all files with a given extension?
- From: Dan Espen <daneNO@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 30 Jun 2007 10:20:12 -0400
sk8terg1rl <sk8terg1rl_2006@xxxxxxxxxxx> writes:
On Jun 29, 11:39 pm, The Natural Philosopher <a...@xxx> wrote:
sk8terg1rl wrote:
Hi everyone,
Quite often I move source codes between CPU architectures and need to
recompile it, otherwise I get the error:
-bash: ./program_binary: cannot execute binary file
Since discovering the joys of bootstrapping my programs, I no longer
have one big program but many smaller interconnected ones (easier
debugging, allows you to edit/recompile one even while your doing a
run, greater flexibility, etc.)
How can I write a script that would:
Identify all the files with .for and .f90 extensions
Execute the commands:
'ifort program.for -o program'
'ifort program2.f90 -o program2'
Thanks :-)
skate
Wtite a Makefile and use make?
Hi NP,
Found out what make does with man make just now ;-)
Unfortunately I 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.
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 as it doesn't automatically
detect any new files to be compiled and isn't very flexible. Each
collection of programs for a single purpose must have its own
compilation script or pseudo-makefile.
Sorry about not being clear before but what I was really asking for
was to have a program that would automatically detect and compile all
files with some given extensions.
A Makefile is still the right answer.
This should get you started, put this in the Makefile:
FOR:=$(wildcard *.for)
F90:=$(wildcard *.f90)
TARGFOR:=$(subst .for,,$(FOR))
TARGF90:=$(subst .f90,,$(F90))
TARGETS:=$(TARGFOR) $(TARGF90)
all: $(TARGETS)
(Sorry, not tested but should be close enough.)
.
- 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: how can a bit be off in memory?
- 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: Send funny sms
- Index(es):
Relevant Pages
|