لطفا وارد شوید یا ثبت‌نام کنید تا به انجمن‌ها دسترسی کامل داشته باشید.



 
امتياز موضوع :
  • 0 رأي - معدل امتيازات : 0
  • 1
  • 2
  • 3
  • 4
  • 5
مسیر gcc و headerfileها را چطوری set کنم؟
2007-08-27, 11:34 AM,
ارسال : #1
مسیر gcc و headerfileها را چطوری set کنم؟
با عرض سلام خدمت همه دوستان.
من برای کارم به یه tool نیاز داشتم که اونو از اینترنت دانلود کردم ولی حالا که میخوام نصبش کنم تو فایل README نوشته که باید برم تو فایل Makefile و مسیرهای gcc و g++ و هدرفایل ها رو براش set کنم. تا حالا هر کاری کردم نتونستم درستش کنم.
من انتظار داشتم مثل c که تو ویندوز نصب می کنیم، تو لینوکس هم هر کدوم از اینها در کنار هم تو یه فولدر مشخص باشند. ولی هر چی گشتم هرکدوم رو از یه طرف پیدا کردم. حالا هم که تنظیمشون کردم باز انگار اشتباه کردم.
این رو هم بگم که من واسه این کار هم suse 10 رو نصب کردم و هم fedora 6 رو.
راستی اون makefile رو هم براتون میذلرم که اگر تونستید یه نگاهی بهش بندازید.
با تشکر.
خدا نگهدار.

اینم از makefile:

کد :
##########################################################################
# Make File for GIZA                              #
#                                     #
# Statistical Machine Translation Team, WS99                 #
# The Center for language and Speech Processing                 #
# Johns Hopkins University                         #
#                                      #
# Project Web Page: http://www.clsp.jhu.edu/ws99/projects/mt         #
#                                     #
# File Created by: Yaser Al-Onaizan ([email protected] [email protected])     #
#                                     #
# EGYPT Toolkit for Statistical Machine Translation             #
# Written by Yaser Al-Onaizan, Jan Curin, Michael Jahr, Kevin Knight,      #
#            John Lafferty, Dan Melamed, David Purdy, Franz Och, Noah      #
#            Smith, and David Yarowsky. (C) 1999 Johns Hopkins University#
#                                      #
# This program is free software; you can redistribute it and/or         #
# modify it under the terms of the GNU General Public License         #
# as published by the Free Software Foundation; either version 2     #
# of the License, or (at your option) any later version.         #
#                                      #
# This program is distributed in the hope that it will be useful,     #
# but WITHOUT ANY WARRANTY; without even the implied warranty of     #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
# GNU General Public License for more details.                 #
#                                      #
# You should have received a copy of the GNU General Public License     #
# along with this program; if not, write to the Free Software         #
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,     #
# USA.                                     #
#                                      #
#                                      #
##########################################################################

# Two things must happen before you can run this makefile.  First, you
# must have the environment variable OSTYPE set to whatever your OS
# type is.  This is default on most systems.  Second, you must have a
# file called dependencies in the GIZA/src directory before you can
# use this make file. In Unix, you can create an empty file using:
#     cat > dependencies
# then Ctrl-D.
#
# An alternative to creating this is to first comment out the line at
# the end of this make file (the line that starts with "include" by
# simply preceding it with "#", then "make depend" and then uncomment
# the include line and then you can make any version you want.
#
# This make file can be used to create three different kinds of
# executables:
# 1. Optimized version: use "make GIZA" or simply "make". This will
#     create the fastest binary.
# 2. Debugging version: use "make GIZA_debug". This will create a
#     debugable version of the binary.
# 3. Profiling version: use "make GIZA_profile". This creates a
#     binary with gprofile info.
##########################################################################

# The following requires editing to set paths:

SHELL=/bin/sh
# Where is your gnu C++ compiler located?  You may want to change the
# following 2 lines to point to the correct compiler path.  If you are
# using an operating system other than Solaris and Linux, please add a
# proper variable name similar to the one below with the appropriate
# path for it.

CMP.solaris = /home/kyamada/gcc-2.95.1/
CMP.linux = /home/kyamada/gcc-2.95.1/

# where is the package located (the base directory)

DIR = ${EGYPT}/tools/GIZA


# Use the switch -DWORDINDEX_WITH_4_BYTE for training with vocabulary
# more that 65k entries.  The effect of this is that token ids use 4
# bytes (unsigned int) instead of (unsigned short).  If you're not
# working with large vocabularies, then comment out this switch.  This
# will save you memory space!

VOCABULARY_FLAG = -DWORDINDEX_WITH_4_BYTE

#**** You'll probably not need to edit the makefile below this line ****
########################################################################

#------------------ Setting up variables -------------------------------

# your operating system

ARCH = $(OSTYPE)

CMP = $(CMP.$(ARCH))

# compiler libraries and compilation command

LIB = $(CMP)/lib/
CC = $(CMP)/bin/g++

# ------------------ Compilation flags ---------------------------------

# use the following line for optimized compilation:

CC_ARGS_OPT =  -Wall -O3 -DNDEBUG $(VOCABULARY_FLAG)

# for profiling version

CC_ARGS_PRF = -Wall -pg -DNDEBUG $(VOCABULARY_FLAG)

# use the following line for a debugging version (with assertions - it
# is slower!).

# rigorous  debug

R_DEBUG_FLAG = -DVDEBUG

CC_ARGS_DBG =  -g -DDEBUG  $(VOCABULARY_FLAG) -Wall $(R_DEBUG_FLAG)

CC_COMPILE_FLAG = -c


#------ Setting up path names from the main directory -----------------

# the paths of the different subdirectories

SRC_DIR = $(DIR)/src/
BIN_BASE = $(DIR)/bin/
OBJ_BASE = $(DIR)/obj/
BIN_DIR = $(BIN_BASE)$(ARCH)/
OBJ_DIR = $(OBJ_BASE)$(ARCH)/
OBJ_DIR_PRF = $(OBJ_BASE)$(ARCH)/profile/
OBJ_DIR_OPT = $(OBJ_BASE)$(ARCH)/optimized/
OBJ_DIR_DBG = $(OBJ_BASE)$(ARCH)/debug/

# ---------------------------- source files in the package ------------

SRC= $(SRC_DIR)Perplexity.cc $(SRC_DIR)logprob.cc $(SRC_DIR)utility.cc $(SRC_DIR)model1.cc \
     $(SRC_DIR)model2.cc $(SRC_DIR)model3.cc $(SRC_DIR)getSentence.cc $(SRC_DIR)TTables.cc \
     $(SRC_DIR)ATables.cc $(SRC_DIR)AlignTables.cc $(SRC_DIR)parse.cc $(SRC_DIR)reports.cc \
     $(SRC_DIR)model3_viterbi.cc $(SRC_DIR)model3_viterbi_with_tricks.cc \
     $(SRC_DIR)main.cc $(SRC_DIR)NTables.cc $(SRC_DIR)model2to3.cc $(SRC_DIR)collCounts.cc \
     $(SRC_DIR)alignment.cc $(SRC_DIR)vocab.cc $(SRC_DIR)MoveSwapMatrix.cc \
     $(SRC_DIR)transpair_model3.cc $(SRC_DIR)Dictionary.cc $(SRC_DIR)transpair_model4.cc

OBJ_OPT = ${SRC:$(SRC_DIR)%.cc=$(OBJ_DIR_OPT)%.o}
OBJ_DBG = ${SRC:$(SRC_DIR)%.cc=$(OBJ_DIR_DBG)%.o}
OBJ_PRF = ${SRC:$(SRC_DIR)%.cc=$(OBJ_DIR_PRF)%.o}


# ----------------------------- Compilation Starts here -----------------------------------------

# --------------------------- Making Binary Files -----------------------------------------------

# make  optimized version of GIZA

GIZA:     $(OBJ_DIR_OPT) $(OBJ_OPT) $(BIN_DIR)
    $(CC) $(CC_ARGS_OPT) $(OBJ_OPT) -lm -L$(LIB) -o $(BIN_DIR)$@

# make optimized binary with the user name as an extension to the binary file name (GIZA).

GIZA_user: $(OBJ_DIR_OPT) $(OBJ_OPT) $(BIN_DIR)
    $(CC) $(CC_ARGS_OPT) $(OBJ_OPT) -lm -L$(LIB) -o $(BIN_DIR)GIZA.${USER}

# make a debug version of GIZA

GIZA_debug: $(OBJ_DIR_DBG) $(OBJ_DBG) $(BIN_DIR)
    $(CC) $(CC_ARGS_DBG) $(OBJ_DBG) -lm -L$(LIB) -o $(BIN_DIR)$@

# make a profile version of GIZA

GIZA_profile: $(OBJ_DIR_PRF) $(OBJ_PRF) $(BIN_DIR)
    $(CC) $(CC_ARGS_PRF) $(OBJ_PRF) -lm -L$(LIB) -o $(BIN_DIR)$@


# -------------------- Creating the necessary subdirectories for object and binary files -----------
# create bin and obj directories if they don't already exist


$(OBJ_DIR_PRF): $(OBJ_DIR)
#    @if(!(-e $(OBJ_DIR_PRF)))
    @mkdir $(OBJ_DIR_PRF)
#    endif

$(OBJ_DIR_OPT): $(OBJ_DIR)
#    @if(!(-e $(OBJ_DIR_OPT)))
    @mkdir $(OBJ_DIR_OPT)
#    endif

$(OBJ_DIR_DBG): $(OBJ_DIR)
#    @if(!(-e $(OBJ_DIR_DBG))) \
        @mkdir $(OBJ_DIR_DBG)
#    endif
$(OBJ_DIR): $(OBJ_BASE)
#    @if(!(-e $(OBJ_DIR)))
    @mkdir $(OBJ_DIR)
#    endif
$(OBJ_BASE):
    @mkdir $(OBJ_BASE)

$(BIN_DIR): $(BIN_BASE)
#    @if(!(-e $(BIN_DIR)))
    @mkdir $(BIN_DIR)
#    endif

$(BIN_BASE) :
#    @if(!(-e $(BIN_BASE))) \
        @mkdir $(BIN_BASE)
#    endif

# --------------------------------------- Making Object files  -----------------------------------

$(OBJ_DIR_DBG)%.o: $(SRC_DIR)%.cc
    $(CC)  $(CC_ARGS_DBG) $(CC_COMPILE_FLAG) $< -o $@

$(OBJ_DIR_PRF)%.o: $(SRC_DIR)%.cc
    $(CC)  $(CC_ARGS_PRF) $(CC_COMPILE_FLAG) $< -o $@

$(OBJ_DIR_OPT)%.o: $(SRC_DIR)%.cc
    $(CC)  $(CC_ARGS_OPT) $(CC_COMPILE_FLAG) $< -o $@

# -------------------------------------- Clean up ------------------------------------------------

# clean object files for a specific architecture

clean:
    @(`find $(SRC_DIR) -name \*~ -exec /bin/rm {} \; ` ;\
    `find $(OBJ_DIR) -name \*.o -exec /bin/rm {} \;`)  

# clean all object files generated for GIZA

clean_all:
    @(`find $(SRC_DIR) -name \*~ -exec /bin/rm {} \; ` ;\
    `find $(OBJ_BASE) -name \*.o -exec /bin/rm {} \;`)  

# ------------------------------------ Make dependency file --------------------------------------

depend: depend_OPT depend_DBG depend_PRF

depend_OPT: $(SRC_DIR)
    @(echo "#Automatically generated dependecy list" >>  $(SRC_DIR)dependencies ;\
    $(CC) -MM $(SRC_DIR)*.cc $(CFLAGS) | perl -e 'while(<>){s?^([^\:]+\.o:)?$(OBJ_DIR_OPT)\1?g;print;}'>>  $(SRC_DIR)dependencies)
depend_DBG: $(SRC_DIR)
    @(echo "#Automatically generated dependecy list" >>  $(SRC_DIR)dependencies ;\
    $(CC) -MM $(SRC_DIR)*.cc $(CFLAGS) | perl -e 'while(<>){s?^([^\:]+\.o:)?$(OBJ_DIR_DBG)\1?g;print;}'>>  $(SRC_DIR)dependencies)
depend_PRF:$(SRC_DIR)
    @(echo "#Automatically generated dependecy list" >>  $(SRC_DIR)dependencies ;\
    $(CC) -MM $(SRC_DIR)*.cc $(CFLAGS) | perl -e 'while(<>){s?^([^\:]+\.o:)?$(OBJ_DIR_PRF)\1?g;print;}'>>  $(SRC_DIR)dependencies)

# ------------------------------------- include dependency file ----------------------------------

include $(SRC_DIR)dependencies
جستجوی تمامی ارسال های کاربر
نقل قول این ارسال در یک پاسخ
2007-08-31, 02:48 PM,
ارسال : #2
 
فکر نمی کنم نیازی به ست کردن چیزی باشه. چون اگه چیزی نگین usr/include/ و فکر کنم usr/local/include/ توی مسیر جستجوی فایل های هدر هستند. با گزینه های I- برای هدرفایل ها و با L- برای کتابخانه ها می تونید مسیر های لازم رو به gcc و ++g بفهمونید.
تو این Makefile بعضی جاها CC_COMPILE_FLAG استفاده شده بعضی جاها CC_ARGS_OPT .می تونی اون سوییچ I- رو به اینها اضافه کنی.
جستجوی تمامی ارسال های کاربر
نقل قول این ارسال در یک پاسخ


رفتن به انجمن :


کاربران در حال مشاهده موضوع : 1 مهمان