Preserve environment variables in the makefile

Bug #973595 reported by Luiz Felippe Santiago Rodrigues
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Galacticus
Fix Released
Wishlist
Andrew Benson

Bug Description

I think it would be useful a small change in the Makefile, so that it preserves some previously set environment variables (e.g. CFLAGS, F03FLAGS).

This minor change would allow the use of galacticus in a different build environments without touching its Makefile.

Tags: build

Related branches

Revision history for this message
Luiz Felippe Santiago Rodrigues (luizfelippesr) wrote :
Revision history for this message
Andrew Benson (abenson) wrote :

I think this is an excellent idea. I wonder if this should be taken a step further though. For example, the Makefile currently overrides things like F03COMPILER. Changing:

F03COMPILER = gfortran

to

F03COMPILER ?= gfortran

might be good - this will only set F03COMPILER to gfortran if it isn't already set to something else in the environment.

Also, I've been thinking for a while that the "GALACTICUS_FLAGS" option is too blunt - it gets applied to F03FLAGS, CFLAGS AND CPPFLAGS, which can be problematic (or, at least, can cause warnings to be issued) if you put a Fortran specific comppiler option in GALACTICUS_FLAGS for example. So, perhaps it would be useful to have "GALACTICUS_F03FLAGS", "GALACTICUS_CFLAGS" and "GALACTICUS_CPPFLAGS"

Changed in galacticus:
assignee: nobody → Andrew Benson (abenson)
Revision history for this message
Andrew Benson (abenson) wrote :

Here's a further patch which implements the suggestions from my previous comment. I also replaced F03FLAGS etc. with FCFLAGS which seems more conventional.

Any further changes needed? If not, I'll go ahead and merge this into the main branch.

Revision history for this message
Luiz Felippe Santiago Rodrigues (luizfelippesr) wrote :

I think this is great! It should be merged.

Revision history for this message
Andrew Benson (abenson) wrote :

OK - it's merged now. Thanks for the patch!

Changed in galacticus:
status: Opinion → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.