Skip to content

problem with gnu Make in Makefile.manual #589

Closed
@fiolj

Description

@fiolj

When using a recent version of make: GNU Make 4.3 in linux.

Using the instructions:

make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4

compilation fails because the variable FYPPFLAGS may not be modified after being set in the command line.
Details are given in override directive

A possible solution is to use a different variable name. I've solved it by making the following changes:

Makefile.manual     | 6 ++++--
src/Makefile.manual | 2 +-

modified   Makefile.manual
@@ -5,14 +5,16 @@ FFLAGS ?= -Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all
 FYPPFLAGS ?=
 
 VERSION := $(subst ., ,$(file < VERSION))
-FYPPFLAGS += \
+VERS_FYPPFLAGS = \
              -DPROJECT_VERSION_MAJOR=$(word 1,$(VERSION)) \
              -DPROJECT_VERSION_MINOR=$(word 2,$(VERSION)) \
              -DPROJECT_VERSION_PATCH=$(word 3,$(VERSION))
 
+ALL_FYPPFLAGS := $(FYPPFLAGS) $(VERS_FYPPFLAGS)
+
 export FC
 export FFLAGS
-export FYPPFLAGS
+export ALL_FYPPFLAGS
 
 .PHONY: all clean test
 
modified   src/Makefile.manual
@@ -72,7 +72,7 @@ clean:
 	$(FC) $(FFLAGS) -c $<
 
 $(SRCGEN): %.f90: %.fypp common.fypp
-	fypp $(FYPPFLAGS) $< $@
+	fypp $(ALL_FYPPFLAGS) $< $@
 
 # Fortran module dependencies
 f18estop.o: stdlib_error.o

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbuild: makeIssue with stdlib's manual makefile build

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions