Conditionals in Makefile: missing separator error?

后端 未结 1 1103
忘掉有多难
忘掉有多难 2020-12-19 07:25

I want to write some conditionals in a Makefile, following the guide at http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/make_7.html#SEC72. However, I get

相关标签:
1条回答
  • 2020-12-19 08:10

    There should be a [space] after ifeq

    mod: $(MODBIN)
    $(MODBIN): $(MODSRC)
    ifeq ($(FC),gfortran)
        -$(FC) $(MODFLAGS) -J$(INCPATH) $(INCLUDE) -c -o $@ $(subst
        $(BUILDPATH),$(MODPATH),$*).f90 $(NETCDFLDFLAGS)
    else ifeq ($(FC),ifort)
        -$(FC) $(MODFLAGS) -module $(INCPATH) $(INCLUDE) -c -o $@ $(subst
        $(BUILDPATH),$(MODPATH),$*).f90 $(NETCDFLDFLAGS)
    else ifeq ($(FC),xlf2003_r)
         -$(FC) $(MODFLAGS) -qmoddir=$(INCPATH) $(INCLUDE) -c -o $@ $(subst 
         $(BUILDPATH),$(MODPATH),$*).f90 $(NETCDFLDFLAGS)
    endif
    

    General Makefile would be

    target:dependencies
    ifeq ( parm1, parm2)
     [TAB]   operation
    else
     [TAB]   operation
    endif
    
    0 讨论(0)
提交回复
热议问题