[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Different compilation based on filename
From: |
Christian Rogsch |
Subject: |
Different compilation based on filename |
Date: |
Thu, 10 Sep 2009 14:50:47 +0200 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
Dear gnu-make mailinglist,
I have the following problem with a makefile: I want to compile files
with different compiler flags, based on the name of the file.
Example1:
filename is (I call it type1 file): func.f90
make should do: $(FCOMPL) -c $(FFLAGS) $(FOPENMPFLAGS) $<
Example2:
filename is (I call it type2 file): smvv.f90
make should do: $(FCOMPL) -c $(FFLAGS) $<
Based on the makefile I have it should be (pseudocode):
.f90.o:
if filename = func.f90
or filename = part.f90
or filename = divg.f90
$(FCOMPL) -c $(FFLAGS) $(FOPENMPFLAGS) $<
else
$(FCOMPL) -c $(FFLAGS) $<
thus I want to create a list with different filenames (or if-then-else)
where make should check if this file is a type1 file and then it should
compile like example1, if it is not a typ1 file, it should compile like
example2, like shown above.
I tried different settings, but I had no success.
Is this possible?
Thanks for help.
Christian
##################### -------------------- ######################
Here is my current makefile:
obj_serial = isob.o prec.o smvv.o cons.o devc.o type.o mesh.o func.o
irad.o \
ieva.o pois.o radi.o evac.o part.o vege.o ctrl.o dump.o
read.o turb.o mass.o \
wall.o fire.o pres.o divg.o init.o velo.o main.o
# General Purpose Rules
no_target:
@echo \******** You did not specify a make target \********
@echo Please read the comments at the top of the makefile
setup:
%.o : %.mod
.SUFFIXES: .c .f90 .o .obj
.f90.o:
$(FCOMPL) -c $(FFLAGS) $<
.c.o:
$(CCOMPL) -c $(CFLAGS) $<
#*** Compiler Specific Rules ***
openmp_intel_linux_32 : FFLAGS = -m32 -O3 -static -vec_report0
openmp_intel_linux_32 : CFLAGS = -m32 -O -Dpp_noappend -vec_report0
openmp_intel_linux_32 : FOPENMPFLAGS = -openmp -openmp-link static
openmp_intel_linux_32 : FCOMPL = ifort
openmp_intel_linux_32 : CCOMPL = icc
openmp_intel_linux_32 : obj = fds5_openmp_intel_linux_32_new
openmp_intel_linux_32 : setup $(obj_serial)
$(FCOMPL) $(FFLAGS) -o $(obj) $(obj_serial)
#*** End Compiler Specific Rules ***
# *** Object Dependencies ***
isob.o : isob.c
smvv.o : smvv.f90 isob.c
prec.o : prec.f90
cons.o : cons.f90 prec.f90
type.o : type.f90 prec.f90 cons.f90
devc.o : devc.f90 prec.f90
pois.o : pois.f90 prec.f90
mesh.o : mesh.f90 prec.f90 type.f90
func.o : func.f90 prec.f90 cons.f90 type.f90 mesh.f90
turb.o : turb.f90 func.f90 prec.f90 cons.f90 mesh.f90
ctrl.o : ctrl.f90 prec.f90 cons.f90 type.f90 mesh.f90 func.f90
irad.o : irad.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90
ieva.o : ieva.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90
fire.o : fire.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90
wall.o : wall.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90
velo.o : velo.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 turb.f90
divg.o : divg.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90
mass.o : mass.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 turb.f90
radi.o : radi.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 irad.f90
evac.o : evac.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 ieva.f90
pres.o : pres.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 pois.f90
part.o : part.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 devc.f90
vege.o : vege.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 devc.f90
read.o : read.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 devc.f90
irad.f90 evac.f90
init.o : init.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 devc.f90
irad.f90 pois.f90
dump.o : dump.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 devc.f90
evac.f90 smvv.f90 isob.c
main.o : main.f90 func.f90 prec.f90 cons.f90 type.f90 mesh.f90 devc.f90
smvv.f90 isob.c mass.f90 divg.f90 velo.f90 wall.f90 fire.f90 irad.f90
ieva.f90 radi.f90 evac.f90 part.f90 vege.f90 dump.f90 read.f90 init.f90
pres.f90 pois.f90 ctrl.f90 turb.f90
#*** Clean Target to remove Object and Module files ***
.PHONY : clean
clean:
-rm -f *.o *.mod *.obj
--
Dipl.-Ing. Christian Rogsch
Bergische Universität Wuppertal
Fachbereich D, Abteilung Bauingenieurwesen
Lehr- und Forschungsgebiet Baustofftechnologie und Brandschutz
Pauluskirchstraße 7
Gebäude HF
Raum HF 24
42285 Wuppertal
Tel: +49 (0) 202 439 4241
Fax: +49 (0) 202 8 25 60
www.btbs.uni-wuppertal.de
- Different compilation based on filename,
Christian Rogsch <=