变量替换错误

Mar*_*ark -6 makefile

有谁知道我的Makefile有什么问题?

CXX = g++               # compiler
CXXFLAGS = -g -Wall -MMD        # compiler flags
MAKEFILE_NAME = ${firstword ${MAKEFILE_LIST}} # makefile name

OBJECTS1 = utf.o            # object files forming executable
EXEC1 = utf             # executable name

OBJECTS2 = driver.o rational.o # object files forming executable
EXEC2 = rational            # executable name

OBJECTS3 = da.o qa.o pa.o ua.o # object files forming executable
EXEC3 = ho          # executable name

OBJECTS = ${OBJECTS1} ${OBJECTS2} ${OBJECTS3}
EXECS = ${EXEC1} ${EXEC2} ${EXEC3}
DEPENDS = ${OBJECTS:.o=.d}      # substitute ".o" with ".d"

.PHONY : all clean

all : ${EXECS}

${EXEC1} : ${OBJECTS1}          # link step
    ${CXX} $^ -o $@

${EXEC2} : ${OBJECTS2}          # link step
    ${CXX} $^ -o $@

${EXEC3} : ${OBJECTS3}          # link step
    ${CXX} $^ -o $@

${OBJECTS} : ${MAKEFILE_NAME}       # OPTIONAL : changes to this file => recompile

-include ${DEPENDS}         # include *.d files containing program dependences

clean :                 # remove files that can be regenerated
    rm -f ${DEPENDS} ${OBJECTS} ${EXECS}
Run Code Online (Sandbox Code Playgroud)

错误:

./Makefile: 1: CXX: not found
./Makefile: 2: CXXFLAGS: not found
./Makefile: 3: Bad substitution
Run Code Online (Sandbox Code Playgroud)

Kar*_*ath 7

使用该make命令运行Makefile.你可以指定make的目标,比如make all.