C编译出错,正在尝试编译注释行

时间:2018-07-20 15:22:37

标签: makefile

我对C不太熟悉,但这很奇怪。我正在制作的makefile上运行make命令,以在HP-UX(噩梦!)计算机上编译我的C模块。一切都在正确编译,但最后我得到了这个错误:

Make: Don't know how to make #----------------. Stop.

似乎正在尝试make在makefile中包含注释行的开头。这是makefile(很丑陋,不是我最初写的东西):

#--------------------------------------------------------------
#  Name : Makefile
#--------------------------------------------------------------

CCOPTS    = -c +DD64 -Ae -I/path/to/include
DEFINES   = -DUNIX
INCLUDE  = /path/to/include
BIN       = /path/to/bin


FIRSTOBJS = asvc.o getname.o err.o 
SECONDOBJS  = CCARD.o getname.o err.o
THIRDOBJS  = CREQ.o getname.o err.o
FOURTHOBJS = CPORG.o implin.o getname.o cchcomm.o err.o
FIFTHOBJS = UNFOR.o getname.o err.o

DBINCDIR = /path/to/mysql-connector-c-6.0.2-hpux11.11-hppa2.0-64bit/include
LIBS      = -lmysqlclient
DBLIB    = +DD64 -L/path/to/lib

#---------------- All Executables -------------------
default : $(BIN)/asvc \
    $(BIN)/UNFOR \
    $(BIN)/ontop \
    $(BIN)/CCARD \
    $(BIN)/CREQ \
    $(BIN)/xltscri \

#---------------- Common object Modules -------------                   
asvc.o : asvc.c $(INCLUDE)/err.h $(INCLUDE)/xcerr.h
    cc $(CCOPTS) $(DEFINES) -I$(DBINCDIR) asvc.c

err.o : err.c $(INCLUDE)/err.h
    cc $(CCOPTS) -g err.c -I$(DBINCDIR)

UNFOR.o : UNFOR.c $(INCLUDE)/err.h $(INCLUDE)/xcerr.h
    cc $(CCOPTS) $(DEFINES) -I$(DBINCDIR) UNFOR.c

xltscri.o : xltscri.c $(INCLUDE)/ontop.h $(INCLUDE)/err.h \
     $(INCLUDE)/xcerr.h
    cc $(CCOPTS) $(DEFINES) -I$(DBINCDIR) xltscri.c

ontop.o : ontop.c $(INCLUDE)/ontop.h $(INCLUDE)/err.h \
    $(INCLUDE)/xcerr.h
    cc $(CCOPTS) $(DEFINES) -I$(DBINCDIR) ontop.c

getname.o : getname.c  $(INCLUDE)/ontop.h
    cc $(CCOPTS) $(DEFINES) -I$(DBINCDIR)  getname.c

CCARD.o : CCARD.c  $(INCLUDE)/err.h $(INCLUDE)/xcerr.h
    cc $(CCOPTS) $(DEFINES) -I$(DBINCDIR) CCARD.c

implin.o : implin.c $(INCLUDE)/err.h $(INCLUDE)/xcerr.h
    cc $(CCOPTS) implin.c -I$(DBINCDIR)

CREQ.o : CREQ.c  $(INCLUDE)/err.h $(INCLUDE)/xcerr.h
    cc $(CCOPTS) $(DEFINES) -I$(DBINCDIR) CREQ.c

#------------ Make asvc (Get SubService ) ---------                   
$(BIN)/asvc: $(FIRSTOBJS)
    cc -o $@         \
    $(FIRSTOBJS)  \
    $(DBLIB)     \
    $(LIBS)

#------------ Make CCARD (Update Completed TimeStamp ) ---------   
$(BIN)/CCARD: $(SECONDOBJS)
    cc -o $@      \
    $(SECONDOBJS)  \
    $(DBLIB)     \
    $(LIBS)

#------------ Make UNFOR ( Match Partitioning Abend Checker ) ---------    
$(BIN)/UNFOR: $(FIFTHOBJS)
    cc -o $@         \
    $(FIFTHOBJS)  \
    $(DBLIB)     \
    $(LIBS)

#------------ Make ontop (Add script)---------                   
$(BIN)/ontop: ontop.o getname.o err.o
    cc -o $@         \
    ontop.o   \
    getname.o    \
    err.o      \
    $(DBLIB)     \
    $(LIBS)

#------------ Make CREQ (FPC Requests ) ---------            
$(BIN)/CREQ: $(THIRDOBJS)
    cc -o $@         \
    $(THIRDOBJS)  \
    $(DBLIB)     \
    $(LIBS)

#------------ Make xltscri (Select script)---------                   
$(BIN)/xltscri: xltscri.o getname.o err.o
    cc -o $@         \
    xltscri.o   \
    getname.o    \
    err.o    \
    $(DBLIB)         \
    $(LIBS)

#---------------End of Makefile ---------------------

1 个答案:

答案 0 :(得分:2)

@Eugene SH。以及@Ingo Leonhardt也将其钉牢。在“所有可执行文件”部分的最后一行中,多余的反斜杠导致程序认为下一行(直到空白)是命令的一部分。谢谢。作为makefile的新手,在注意到这一点之前,我不知道要浪费多少时间。