Makefile:在-o之后添加标志

时间:2015-10-29 03:07:26

标签: c++ ubuntu compilation makefile indri

我正在尝试使用VirtualBox在Ubuntu 14.04 LTS上编译Indri 5.9(从http://sourceforge.net/projects/lemur/下载),但在" env CPP = / usr / bin / cpp CXX = / usr / bin / g ++之后。 /配置"当我" make"时,我遇到了一个问题:ator.cpp:216:未定义引用' gzopen'。我已经安装了zlib1g0dev" sudo apt-get install zlib1g-dev",根据Compilation problems with ZLIB,似乎我必须添加" -lz"在" -o"结束时。但是,这是我的Makefile:

-include MakeDefns

INSTALLDIRS = $(bindir) $(includedir) $(pkgincludedir) $(includedir)/lemur $(libdir) $(pkgdatadir) $(pkgdatadir)/doc

.PHONY: all dist clean install $(INSTALLDIRS) site-search

all: 
    $(MAKE) -C contrib
    $(MAKE) -C obj -f ../src/Makefile
ifeq ($(WITH_SWIG), 1)
    $(MAKE) -C swig/src
endif
    $(MAKE) -C buildindex
    $(MAKE) -C runquery
    $(MAKE) -C indrid
    $(MAKE) -C dumpindex
    $(MAKE) -C harvestlinks
    $(MAKE) -C pagerank
    $(MAKE) -C rmodel
    $(MAKE) -C makeprior
    $(MAKE) -C site-search
    $(MAKE) -C modifyfields
    $(MAKE) -C clarity
    $(MAKE) -C reformulate

$(INSTALLDIRS):
    $(INSTALL_DIR) $@

clean:
    $(MAKE) clean -C contrib
    $(MAKE) clean -C obj -f ../src/Makefile
ifeq ($(WITH_SWIG), 1)
    $(MAKE) clean -C swig/src
endif
    $(MAKE) clean -C buildindex
    $(MAKE) clean -C runquery
    $(MAKE) clean -C indrid
    $(MAKE) clean -C dumpindex
    $(MAKE) clean -C harvestlinks
    $(MAKE) clean -C pagerank
    $(MAKE) clean -C rmodel
    $(MAKE) clean -C makeprior
    $(MAKE) -C site-search clean
    $(MAKE) -C modifyfields clean
    $(MAKE) -C clarity clean
    $(MAKE) -C reformulate clean
    rm -f depend/*

distclean: clean
    rm -rf autom4te.cache MakeDefns Makefile.app config.log config.status indri.ncb indri.suo
dist: distclean
    $(MAKE) stamp -C obj -f ../src/Makefile
    cd ..; tar zcvf indri-`date +%Y%m%d-%H%M`.tar.gz indri

install: $(INSTALLDIRS)
    rm -f $(libdir)/$(INDRILIB)
    $(MAKE) install -C contrib
    $(MAKE) install -C obj -f ../src/Makefile
ifeq ($(WITH_SWIG), 1)
    $(MAKE) install -C swig/src
endif
    $(MAKE) install -C buildindex
    $(MAKE) install -C runquery
    $(MAKE) install -C indrid
    $(MAKE) install -C dumpindex
    $(MAKE) install -C harvestlinks
    $(MAKE) install -C pagerank
    $(MAKE) install -C rmodel
    $(MAKE) install -C makeprior
    $(MAKE) install -C modifyfields
    $(MAKE) install -C clarity
    $(MAKE) install -C reformulate
    $(MAKE) install -C doc
    $(MAKE) -C site-search install
    $(INSTALL_DATA) Makefile.app $(pkgdatadir)

test:

这是MakeDefns:

SHELL = /bin/bash
host_os = linux-gnu
srcdir = .
top_srcdir = .

prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
datadir = ${datarootdir}
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
libdir = ${exec_prefix}/lib
infodir = ${datarootdir}/info
mandir = ${datarootdir}/man
includedir = ${prefix}/include
datarootdir = ${prefix}/share
oldincludedir = /usr/include
pkgdatadir = $(datadir)/indri
pkglibdir = $(libdir)/indri
pkgincludedir = $(includedir)/indri
top_builddir = .

AR = /usr/bin/ar
CC = gcc
GCC_33 = 0
CXX = /usr/bin/g++
LEX = :
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DIR = ${INSTALL} -m 755 -d
JAVAC = 
JAR = 
JAVAINC = 
JAVADOC = 
JAVAHOME = 
NEED_ANTLR = 1
SWIG = 
PHP_SHARED = -shared
JAVA_SHARED = -shared
CSHARP_SHARED = -shared
PHP_SO = .so
JAVA_SO = .so
CSHARP_SO = .so
PHPINCLUDE = 
MCS=

DEPENDENCIES = lemur xpdf
ifeq ($(NEED_ANTLR), 1)
  DEPENDENCIES += antlr
endif

PACKAGE = indri
VERSION = 5.8
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)

INDRI_STANDALONE = 1
INDRILIB = lib$(PACKAGE).a

WITH_SWIG = 0
WITH_JAVA = 0
WITH_PHP = 0
WITH_CSHARP = 0

# C++ source files
CPPSRC1 = $(notdir $(wildcard ../src/*.cpp))
CPPSRC2 = $(notdir $(wildcard ../src/*.cc))
CPPSRC3 = $(notdir $(wildcard ../src/*.C))
# C source files
CSRC =  $(notdir $(wildcard ../src/*.c))
# flex source files
FSRC =  $(notdir $(wildcard ../src/*.l))
# Flex objects
FCPP = $(filter-out $(CPPSRC1), $(FSRC:.l=.cpp))
CPPSRC = $(CPPSRC1) $(CPPSRC3) $(CPPSRC3) $(FCPP)
.SECONDARY: $($(wildcard ../src/*.l).l=.cpp)
# All header files
ALLHEADER = $(wildcard ../include/indri/*.h*)
# Include path
INCPATH = -I../include $(patsubst %, -I../contrib/%/include, $(DEPENDENCIES))
ALLINCPATH = $(INCPATH)

# C++ objects
CPPOBJ = $(CPPSRC:.cpp=.o) $(CPPSRC2:.cc=.o) $(CPPSRC3:.C=.o)

# C objects
COBJ = $(CSRC:.c=.o)
# all objects
OBJ = $(CPPOBJ) $(COBJ)

# application makefiles should set SHARED=
# (see buildindex/Makefile
SHARED = -shared -fPIC

# C compiler and compiling options
# C++ compiler and compiling/linking options
CFLAGS = -DPACKAGE_NAME=\"Indri\" -DPACKAGE_TARNAME=\"indri\" -DPACKAGE_VERSION=\"5.8\" -DPACKAGE_STRING=\"Indri\ 5.8\" -DPACKAGE_BUGREPORT=\"project@lemurproject.org\" -DINDRI_STANDALONE=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_NAMESPACES=/\*\*/ -DISNAN_IN_NAMESPACE_STD=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FSEEKO=1 -DHAVE_EXT_ATOMICITY_H=1 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -DHAVE_MKSTEMP=1 -DHAVE_MKSTEMPS=1 -DNDEBUG=1  -g -O3 $(INCPATH) $(SHARED)
CXXFLAGS    = -DPACKAGE_NAME=\"Indri\" -DPACKAGE_TARNAME=\"indri\" -DPACKAGE_VERSION=\"5.8\" -DPACKAGE_STRING=\"Indri\ 5.8\" -DPACKAGE_BUGREPORT=\"project@lemurproject.org\" -DINDRI_STANDALONE=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_NAMESPACES=/\*\*/ -DISNAN_IN_NAMESPACE_STD=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FSEEKO=1 -DHAVE_EXT_ATOMICITY_H=1 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -DHAVE_MKSTEMP=1 -DHAVE_MKSTEMPS=1 -DNDEBUG=1  -g -O3 $(INCPATH) $(SHARED)
CXXFLAGS_NOOPT    = -DPACKAGE_NAME=\"Indri\" -DPACKAGE_TARNAME=\"indri\" -DPACKAGE_VERSION=\"5.8\" -DPACKAGE_STRING=\"Indri\ 5.8\" -DPACKAGE_BUGREPORT=\"project@lemurproject.org\" -DINDRI_STANDALONE=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_NAMESPACES=/\*\*/ -DISNAN_IN_NAMESPACE_STD=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FSEEKO=1 -DHAVE_EXT_ATOMICITY_H=1 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -DHAVE_MKSTEMP=1 -DHAVE_MKSTEMPS=1 -DNDEBUG=1  -g $(INCPATH) $(SHARED)
CPPLDFLAGS  =  -lpthread -lm 

ifeq ($(STYLE),release)
     CFLAGS = -DPACKAGE_NAME=\"Indri\" -DPACKAGE_TARNAME=\"indri\" -DPACKAGE_VERSION=\"5.8\" -DPACKAGE_STRING=\"Indri\ 5.8\" -DPACKAGE_BUGREPORT=\"project@lemurproject.org\" -DINDRI_STANDALONE=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_NAMESPACES=/\*\*/ -DISNAN_IN_NAMESPACE_STD=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FSEEKO=1 -DHAVE_EXT_ATOMICITY_H=1 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -DHAVE_MKSTEMP=1 -DHAVE_MKSTEMPS=1 -DNDEBUG=1 -DNDEBUG  -g -O3 $(INCPATH) $(SHARED)
     CXXFLAGS    = -DPACKAGE_NAME=\"Indri\" -DPACKAGE_TARNAME=\"indri\" -DPACKAGE_VERSION=\"5.8\" -DPACKAGE_STRING=\"Indri\ 5.8\" -DPACKAGE_BUGREPORT=\"project@lemurproject.org\" -DINDRI_STANDALONE=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_NAMESPACES=/\*\*/ -DISNAN_IN_NAMESPACE_STD=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FSEEKO=1 -DHAVE_EXT_ATOMICITY_H=1 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -DHAVE_MKSTEMP=1 -DHAVE_MKSTEMPS=1 -DNDEBUG=1 -DNDEBUG  -g -O3 $(INCPATH) $(SHARED)
     CPPLDFLAGS  =  -lpthread -lm 
endif

ifeq ($(STYLE),profile)
    CFLAGS=-g -pg  $(INCPATH)
    CXXFLAGS=-g -pg  $(INCPATH)
endif


# generating C++ with flex
../src/%.cpp: ../src/%.l
    $(LEX) -8 -Cf -o$@ $<

我是Makefile的新手,所以任何人都可以帮我解决如何添加&#34; -lz&#34;对吗?或编译Indri 5.9的任何其他建议。非常感谢!

0 个答案:

没有答案