Help needed for writing a rule

2022-11-25 Thread Patrick Begou
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".

Re: Help needed for writing a rule

2022-11-25 Thread Paul Smith
On Fri, 2022-11-25 at 15:26 +0100, Patrick Begou wrote: > How can I write a generic rule for building TOTO_M.mod from > toto_m.f90 source and put it in the LIB folder ? There is no way to do this using "straightforward" pattern rules. Pattern rules always rely on the stem (the "%" part) being an

Re: Help needed for writing a rule

2022-11-25 Thread Patrick Begou
Hi Paul many thanks for your quick answer. Indeed, I've found a solution. Since my email: as nothing was working for a while, I dive again and again in the documentation and then decide to remove all my complex and not working syntax to try to build a functional Makefile. And I think I have a

Re: Help needed for writing a rule

2022-11-25 Thread Kaz Kylheku
On 2022-11-25 06:26, Patrick Begou wrote: > 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 calle

Re: Help needed for writing a rule

2022-11-25 Thread David Boyce
Possibly this would be helpful? # Usage: $(call toupper,) # $1: string to be uppercased toupper = $(strip \ $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E, \ $(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K, \ $(subst l,L,$(subst m,M,$(subst n,N,$(subst

Re: Help needed for writing a rule

2022-11-25 Thread Patrick Begou
Hi all, Thanks for your suggestions. @Paul: solution tested. Yes it works fine and is very near the initial syntax used in the original Makefile. .SECONDEXPANSION: # building only the mod file LIB/%_M.mod: $$(she

Re: Help needed for writing a rule

2022-11-25 Thread Paul Smith
On Fri, 2022-11-25 at 17:12 +0100, Patrick Begou wrote: > Of course this works because I am building a ".depends" file with all > dependencies dynamically too for my application. In the provided > Makefile example, dependencies are added at the end of the makefile. Oh, you didn't say this. This

Re: Help needed for writing a rule

2022-11-25 Thread Kaz Kylheku
On 2022-11-25 09:06, Patrick Begou wrote: > @David I think I'll have the same pitfall than with Kaz strategy. No ? The strategy with regard to dependencies is to isolate the compiler that is fussy about upper case, but deal with lower case everywhere else. Imagine we had a C compiler that needed