Re: Script to compile all files with a given extension?
- From: The Natural Philosopher <a@xxx>
- Date: Sat, 30 Jun 2007 17:12:32 +0100
Dan Espen wrote:
Dances With Crows <danSPANceswithTRAPcrows@xxxxxxxxx> writes:
sk8terg1rl staggered into the Black Sun and said:On Jun 29, 11:39 pm, The Natural Philosopher <a...@xxx> wrote:Makefiles can have multiple dependencies and action lines. Like so:sk8terg1rl wrote:Found out what make does with man make just now ;-) Unfortunately IQuite often I move source code between CPU architectures and need toWrite a Makefile and use make?
recompile it. Since discovering the joys of bootstrapping my
programs, I no longer have one big program but many smaller
interconnected ones.
Identify all the files with .for and .f90 extensions
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.
OBJS=crud.o barf.o junk.o
SRCS=crud.c barf.c junk.c
See my other post.
The last 2 lines above come from trying to
create a lowest common denominator makefile.
Since we're talking GNUMAKE here,
Once you have $(SRC)
$(OBJS) is simply:
OBJS:=$(subst .c,.o,$(SRC))
HDRS=thing.h
all: $(OBJS) $(HDRS)
$(CC) $(CFLAGS) -o program $(OBJS)
OBJS: $(SRCS) $(HDRS)
$(CC) $(CFLAGS) -c $*.c
"all" seems to be missing the target "program".
This assumes 1 program and many subs.
I prefer something like:
SRCS:=$(wildcard *.c)
MAINS:=program.c program2.c
SUBS:=$(filter-out $(MAINS),$(SRCS))
Then you need specific rules for the mains
and generic rules for the subs.
Separating the list of subs into a list for
each main can mean that you have to revert to
specific lists.
Writing the makefile is one of the main jobs to do in any compilation project.
It doesn't just happen naturally ;-)
.
- Follow-Ups:
- Re: Script to compile all files with a given extension?
- From: Dances With Crows
- 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?
- From: Dances With Crows
- Re: Script to compile all files with a given extension?
- From: Dan Espen
- Re: Script to compile all files with a given extension?
- Prev by Date: www.nikejordangoogle.com sell nike jordan
- Next by Date: www.nikejordangoogle.com sell nike jordan
- 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
|