2016-04-27 15 views
1

Anyterm(http://anyterm.org/)を変更して、私が行ったいくつかの変更で必要な設定ファイルを追加します。anytermをコンパイルするための新しいライブラリを追加します。 Makefileを編集するには?

私はこのファイルを読むためにinihプロジェクト(https://github.com/benhoyt/inih)を使用しています。このファイルの内容は、接続するデータベースのデータです。 また、私はmysqlライブラリを含んでいます。コンパイル時にはすべてが問題ありません。

問題は、新しいinihライブラリをMakefileに追加しようとしているときに発生します。 Inihのファイルは、拡張子が.cと.cppファイルを持っている、しかしanytermのファイルが

の.cc拡張子を持っているMakefileはこれです:

default_target: anytermd 

SRC_DIR=../src 

VPATH=${SRC_DIR} . 

UNAME_S=$(shell uname -s) 

ifeq (${UNAME_S},Darwin) 
else 
HAVE_GNU_LD=1 
endif 

LIBPBE_DIR=../libpbe 

CPP_FLAGS= 

GCC_FLAGS=-pthread 
#GCC_FLAGS=-D_REENTRANT 

COMPILE_FLAGS=$(CPP_FLAGS) $(GCC_FLAGS) -W -Wall ${OPTIMISE_FLAGS} ${DEBUG_FLAGS} 

CC_COMPILE_FLAGS=$(COMPILE_FLAGS) 

LINK_FLAGS=${GCC_FLAGS} ${DEBUG_FLAGS} \ 
     -lutil 

ifeq (${UNAME_S},OpenBSD) 
LINK_FLAGS+=-liconv 
endif 

ifeq (${UNAME_S},Darwin) 
LINK_FLAGS+=-liconv 
endif 

LIBPBE_MAKE_OPTIONS= 
include ../libpbe.mk 

CC_SRCS=$(sort $(notdir $(wildcard ${SRC_DIR}/*.cc)) static_content.cc) 

BLOBFILES=anyterm.html anyterm.js anyterm.css copy.png paste.png copy.gif paste.gif 

BLOBS=$(addsuffix .blob.o,$(BLOBFILES)) 

OBJS=$(addsuffix .o,$(notdir $(basename $(CC_SRCS)))) 

%.o: %.cc 
     $(CXX) $(CC_COMPILE_FLAGS) -c $< 

ifdef HAVE_GNU_LD 
%.blob.o: ../browser/% 
     cp $^ . ; $(LD) -r -b binary -o [email protected] $* ; rm $* 

else 
%.blob.c: ../browser/% ./mk_blob 

     ./mk_blob $(subst .,_,$*) < $< > [email protected] 

mk_blob: mk_blob.c 
     $(CC) -o [email protected] $< 
endif 


anytermd: $(OBJS) $(BLOBS) $(LIBPBE_LIB) 
     $(CXX) -o [email protected] -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX -DUNIV_LINUX $(OBJS) -rdynamic -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto $(BLOBS) $(LINK_FLAGS) 

%.d: %.cc 
    $(CXX) -MM -MG -MT [email protected] -MT $(<:%.cc=%.o) $(CPP_FLAGS) $(GCC_FLAGS) -o [email protected] $< 

DEPENDS=$(addsuffix .d,$(basename $(OBJS))) 

-include $(DEPENDS) 

install: FORCE 
    install anytermd /usr/local/bin 

clean: FORCE 
    $(RM) -f *.o *.blob.c static_content.cc 

veryclean: clean 
     $(RM) *.d 

.PHONY: default_target install FORCE 


static_content.cc: ../scripts/mk_static_content.sh ../browser/* 
     PATH="$${PATH}:../scripts" ../scripts/mk_static_content.sh $(BLOBFILES) > [email protected] 

static_content.o: CPP_FLAGS+=-I../src 

inihのファイルは、srcディレクトリにあり、私がしようとすると、「作ります"私はこれらのエラーを受け取ります:

Anyterm.o: In function `checkPermission(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, booking_info&)': 
Anyterm.cc:(.text+0x4527): undefined reference to `INIReader::INIReader(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)' 
Anyterm.cc:(.text+0x4596): undefined reference to `INIReader::ParseError() const' 
Anyterm.cc:(.text+0x46a7): undefined reference to `INIReader::Get(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >) const' 
Anyterm.cc:(.text+0x4894): undefined reference to `INIReader::Get(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >) const' 
Anyterm.cc:(.text+0x49e2): undefined reference to `INIReader::Get(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >) const' 
Anyterm.cc:(.text+0x4af5): undefined reference to `INIReader::Get(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >) const' 

これは私には、リンカーでは、ライブラリが見つからないと信じています。 私はinypでanytermをコンパイルするためにMakefileで何を変更しなければなりませんか?

ありがとうございます。

答えて

0

私はMakefileのにこれらの変更を行い、私の作品ています助けをすべてに

CPP_FLAGS=-I$(SRC_DIR) 
... 
FILTER=mk_blob.c 
CC_SRCS=$(sort $(notdir $(wildcard ${SRC_DIR}/*.cc)) static_content.cc) 
CC_SRCS+=$(sort $(filter-out ${FILTER},$(notdir $(wildcard ${SRC_DIR}/*.c)))) 
CC_SRCS+=$(sort $(notdir $(wildcard ${SRC_DIR}/*.cpp))) 
... 
%.o: %.c 
    $(CXX) $(CC_COMPILE_FLAGS) -c $< 

%.o: %.cpp 
    $(CXX) $(CC_COMPILE_FLAGS) -c $< 

感謝。

関連する問題