[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help needed for writing a rule

From: Patrick Begou
Subject: Help needed for writing a rule
Date: Fri, 25 Nov 2022 15:26:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

Hi all,

I'm stuck for several hours in trying to write a rule for managing fortran modules. My difficulty is that the Cray compiler requires a  module name written in upper case.

example: if file is "toto_m.f90", it contains a module called "toto_m" and the module file will be "TOTO_M.mod".

How can I write a generic rule for building TOTO_M.mod from toto_m.f90 source and put it in the LIB folder ?

Of course,the following lines will not work as the "%" token will be in uppercase on the right hand side.

# building only the mod file
LIB/%_M.mod: %_m.f90
        @echo "building $*_M.mod"
        touch $@

I have experimented this syntax, trying to convert to lowercase the "%" token but it doesn't work too.

# building only the mod file
LIB/%_M.mod: $(shell echo %|tr [A-Z] [a-z])_m.f90
        @echo "building $*_M.mod"
        touch $@

I need to distinguish *_m.f90 patterns from others as only these files are fortran modules

toto_m.f90 is a fortran file containing a module whilst toto.f90 is a simple fortran file without module

Thanks for your advices


reply via email to

[Prev in Thread] Current Thread [Next in Thread]