Opened 17 years ago

Closed 17 years ago

#32 closed upgrade (Fixed)

Control application cpp flags from make command line

Reported by: m.hadfield Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.1
Component: Nonlinear Version: 3.1
Keywords: Cc:

Description

Test cases CANYON and FLT_TEST have 2D and 3D variants. Currently the respective application header files start with

#undef SOLVE3D

and you have to override that somehow to get the 3D case. As far as I know, the only way to do that is to edit the file.

It would be nice to be able to choose between the 2D or 3D versions via the make command line. At the moment there are 2 obstacles:

  • The #undef statement above will take precedence over any arguments passed to cpp. (At least I think so; I haven't checked.)
  • If you just do

make ROMS_APPLICATION=CANYON CPPFLAGS=-DSOLVE3D

then you will override all the CPPFLAGS values constructed in the make file.

So I have made two changes:

  • Remove "#undef SOLVE3D" statements from canyon.h and flt_test.h.
  • In makefile add an additional variable that is passed to cpp. It is called CPP_APP_FLAGS (alternative suggestions welcome).

So to compile the 3D canyon

make ROMS_APPLICATION=CANYON CPP_APP_FLAGS=-DSOLVE3D

I imagine this will be useful in other contexts.

Files attached.

Attachments (3)

makefile (15.2 KB ) - added by m.hadfield 17 years ago.
canyon.h (1.2 KB ) - added by m.hadfield 17 years ago.
flt_test.h (1.0 KB ) - added by m.hadfield 17 years ago.

Download all attachments as: .zip

Change History (5)

by m.hadfield, 17 years ago

Attachment: makefile added

by m.hadfield, 17 years ago

Attachment: canyon.h added

by m.hadfield, 17 years ago

Attachment: flt_test.h added

comment:1 by m.hadfield, 17 years ago

I mis-spoke: flt_test.h has "#define SOLVE3D".

Anyway, removing this line allows it to be controlled externally.

comment:2 by arango, 17 years ago

Resolution: fixed
Status: newclosed

Yes, good suggestion. I used macro MY_CPP_FLAGS instead and appended to CPPFLAGS instead of modifying the compile rules.

Note: See TracTickets for help on using tickets.