Skip to content

Commit

Permalink
Makefile: remove uneeded (and faulty) logic around CFLAGS_HOST
Browse files Browse the repository at this point in the history
The CFLAG_HOST variable was added in CICE-Consortium#257, and
some Makefile logic was added to define the variable to be blank if
the included Macros file does not define it.

However, the Make syntax is wrong, as 'ifndef' takes a variable name and
not
a reference to a variable [1], so

    ifndef $(CFLAGS_HOST)

should have been written

    ifndef CFLAGS_HOST

The effect of this error is to invert the logic of the check (!) since
if CFLAGS_HOST is defined, Make will check if a variable with name equal
to whatever CFLAGS_HOST is defined to be exists, which will most probably
be false, and the conditional will then evaluate to true and CFLAG_HOSTS
will be redefined to be blank, defeating the whole purpose of the flag.

Since there's no harm in Make referencing and empty variable, fix this
by just removing the conditional check.

[1] https://www.gnu.org/software/make/manual/html_node/Conditional-Syntax.html
  • Loading branch information
phil-blain committed Feb 5, 2020
1 parent cd0a6b6 commit c20687f
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions configuration/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ db_flags:
# the needed macros
#-------------------------------------------------------------------------------

ifndef $(CFLAGS_HOST)
CFLAGS_HOST :=
endif

$(DEPGEN): $(ICE_CASEDIR)/makdep.c
$(SCC) -o $@ $(CFLAGS_HOST) $<

Expand Down

0 comments on commit c20687f

Please sign in to comment.