 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
dheller
Joined: 12 May 2011 Posts: 13 Location: Germany
|
Posted: Thu Jun 13, 2013 9:58 am Post subject: Pre-Processing source files via Makefile |
|
|
Hello,
in a current project, I have two groups of source files:
- Group A files must be pre-processed with an external preprocessor before being compiled and linked.
- Group B files will be compiled and linked just like normal.
It is important, however, to save the pre-processed files under new filenames, as the original files must be kept.
So, for a single Group A file arclen.for, I would do:
Code: | fcomp = c:\Program Files (x86)\FTN95\ftn95
fpp = c:\Program Files (x86)\Intel\Compiler\11.1\065\bin\intel64\fpp
arclen__PP.for : arclen.for
$(fpp) $(fppargs) /P arclen.for arclen__PP.for
arclen__PP.obj : arclen__PP.for
$(fcomp) arclen__PP.for $(fd)
|
with fppargs, fd being some fixed parameters for compiler/preprocessor.
But since I need many Group A files to be pre-processed, I would need an automated way to specify input and output filenames for the preprocessor and hand them on to the compiler.
I tried doing things such as
Code: | ppedfiles : $(ppfiles)
$(foreach file,$(ppfiles),$(fpp) $(fppargs) /P $(file) $(file)__PP) |
but it didn't work.
I'm new to makefiles so I'd gladly appreciate some help.
*** Note: I know that ftn95 can pre-process, too (/CFPP), but it doesn't support all the options I need.
To be more specific, I need to handle
Code: | #ifdef __INTEL_
#define dot(a,b,n) ddot(n,a,1,b,1)
#endif |
in a number of source files, but the Ftn95 pre-processor doesn't like the second line of this, even if the whole block should be omitted anyway, as it is only relevant when using the Intel compiler. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Jun 13, 2013 1:20 pm Post subject: |
|
|
I doubt if I can help but which MAKE utility are you using, Silverfrost MK32 or something else? |
|
Back to top |
|
 |
dheller
Joined: 12 May 2011 Posts: 13 Location: Germany
|
Posted: Thu Jun 13, 2013 5:04 pm Post subject: |
|
|
Yes, I'm using Mk32. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Jun 13, 2013 5:26 pm Post subject: |
|
|
OK. What MK32 instruction did you try, what did it aim to do and what was the failure message? |
|
Back to top |
|
 |
dheller
Joined: 12 May 2011 Posts: 13 Location: Germany
|
Posted: Fri Jun 14, 2013 9:29 am Post subject: |
|
|
Okay, so the first thing I need to do is specify filenames for in- and output for the preprocessor.
Code: | ppfiles = arclen.for dynamics.for ext.for [...] |
Now for each file in ppfiles, the preprocessor fpp must generate an output file $(name)__PP.for.
Code: | ppedfiles = $(ppfiles:.for=__PP.for) |
However, this doesn't seem to work:
Code: | all : $(ppfiles)
@echo $(ppedfiles) |
yields the following output ... $(ppedfiles) seems to be empty.
Quote: | [Salford MK/Win32 Version 3.89, Copyright (c) Silverfrost Ltd. 1996-2006]
ECHO ist eingeschaltet (ON). |
I tried it in a different way, $(fpp) and $(fppargs) being path and parameters for the preprocessor, so my full makefile would be this:
Code: | fpp = c:\Program Files (x86)\Intel\Compiler\11.1\065\bin\intel64\fpp
fppargs= /D__SALFORD_
ppfiles = arclen.for
all : $(ppfiles)
$(foreach file,$(ppfiles),$(fpp) $(fppargs) /P $(file) $(file)__PP) |
In this case, Mk32 displays its startup message and then just freezes. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Fri Jun 14, 2013 3:18 pm Post subject: |
|
|
It is a long time since I did much with MAKEFILEs but I offer the following comments
1) "all" and "foreach" will not be recognised by MK32 unless you define them.
2) The "ECHO" in the failure report will be generated by a batch file. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|