2014-12-25 33 views
1

輸出的make.Tpo文件如何生成?爲什麼有「沒有這樣的文件或目錄」?

Making all in access/ 
gcc -g -O2 -o fileOpt fileOpt.o 
Making all in executor/ 
gcc -g -O2 -o executor execFilter.o execJoin.o execMain.o execNode.o execProject.o execScan.o execSort.o execUtil.o 
Making all in index/ 
gcc -g -O2 -o index b_plus_tree.o 
Making all in nodes/ 
gcc -g -O2 -o nodes nodes.o 
Making all in optimizer/ 
gcc -g -O2 -o optimizer optimizer.o path.o 
Making all in parse/ 
gcc -g -O2 -o parser analyze.o check.o gram.o parser.o scan.o 
Making all in posql/ 
gcc -DHAVE_CONFIG_H -D_GNU_SOURCE -I. -I.. -I /Users/YOuth/Program/posql/src/backend/include  -g -O2 -MT ../util/transfrom.o -MD -MP -MF .deps/../util/transfrom.Tpo -c -o ../util/transfrom.o ../util/transfrom.c 
error: error opening '.deps/../util/transfrom.Tpo': Error opening output file '.deps/../util/transfrom.Tpo': No such file or director 

我在其他文件夾中找到(訪問/索引/ ...),它也沒有.Tpo文件中的文件夾.dep?爲什麼它只是util找不到?

ls util/ 
Makefile Makefile.am Makefile.in transfrom.c util.c 

transfrom.c

#include "util/transfrom.h" 
#include "util/datatype.h" 
#include "string.h" 
#include "stdlib.h" 

void strToDate(Date* date , char* str){ 
    .... 
} 

我的問題是如何Tpo產生?是否有任何可能的明顯錯誤?提前致謝。

回答

0

除了列出的makefile的其他問題,該參數:.deps/../util/transfrom.Tpo是不太可能是正確的。

它說:在子目錄.deps(請注意.) 升高一個目錄(即生成文件的位置)然後下降到util目錄。然後生成文件transfrom.Tpo

Hummm。也許這只是一個錯字,但我懷疑transform.Tpo是錯誤的,因爲正在呈現的路徑。

但是,有趣的是(通常)每個源文件都有一個依賴文件,而不僅僅是一個依賴文件。通常最好將這些依賴文件命名爲與關聯源文件相同的根名稱,並使用唯一的擴展名,如.d

我建議在獨立的make文件規則中生成依賴文件,使用-M -MF <file name>.c

請勿使用-MP,因爲這會導致gcc爲每個文件創建一個目標並且不提供任何依賴關係。 http://tigcc.ticalc.org/doc/comopts.html#SEC3

以下是處理 生成依賴關係的補充文件(實際上是一個對生成文件的),編譯,在每個子目錄和主目錄鏈接:

gcc的參數細節,可以發現。他們使用sed而不是gcc來生成依賴文件,但上述信息將使您能夠調整該規則。

這是頂層makefile: 注:allDirectories宏的子目錄, 這將必須調整你的子目錄

SHELL = /bin/sh 


# note: this makefile.mak needs to be run from the ./src directory 
# of the GOT4 directory tree 


SRC := $(wildcard *.c) 
OBJ := $(SRC:.c=.o) 
DEP := $(SRC:.c=.d) 
INC := $(SRC:.c=.h) 


MAKE := /usr/bin/make 

CC  := /usr/bin/gcc 

CP  := cp 

MV  := mv 

LDFLAGS := -L/usr/local/lib -L/usr/lib -L/lib 

DEBUG := -ggdb3 

CCFLAGS := $(DEBUG) -Wall -W 

#CPPFLAGS += =MD 

LIBS := -lssl -ldl -lrt -lz -lc -lm -lcrypto 



.PHONY: AllDirectories 
# the following statement needs to be edited as 
# subdirectories are added/deleted/re-named 
AllDirectories := \ 
    CommandConfiguration \ 
    Communication \ 
    MainScheduler \ 
    RetrieveCDSLog \ 
    RetrieveEventRecorderLog \ 
    RetrieveGPS \ 
    QESRouter 

.PHONY: all 
#all: $(OBJ) $(AllDirectories) 
# $(foreach d,$(AllDirectories), \ 
# (cd $d && $(MAKE) -f makefile.mak name=Tsk_$d all);) 

all: $(OBJ) $(AllDirectories) 
    $(foreach d,$(AllDirectories), \ 
    (cd $d && $(MAKE) -f ../makefile.bot name=Tsk_$d all);) 



# 
# create dependancy files 
# 
%.d: %.c 
    # 
    # ========= START $< TO [email protected] ========= 
    $(CC) -M $(CPPFLAGS) $< > [email protected]$$$$;      \ 
    sed 's,\($*\)\.o[ :]*,\1.o [email protected] : ,g' < [email protected]$$$$ > [email protected];  \ 
    rm -f [email protected]$$$$ 
    # ========= END $< TO [email protected] ========= 



# 
# compile the .c file into .o files using the compiler flags 
# 
%.o: %.c %.d 
    # 
    # ========= START $< TO [email protected] ========= 
    $(CC) $(CCFLAGS) -c $< -o [email protected] -I. 
    # ========= END $< TO [email protected] ========= 
    # 



.PHONY: clean 
#clean: $(AllDirectories) 
# # ========== start clean activities ========== 
# rm -f *.o 
# rm -f $(name).map 
# rm -f $(name) 
# rm -f *.d 
# $(foreach d,$(AllDirectories), \ 
# (cd $d && $(MAKE) -f makefile.mak clean);) 
# # ========== end clean activities ========== 

clean: $(AllDirectories) 
    # ========== start clean activities ========== 
    rm -f *.o 
    rm -f $(name).map 
    rm -f $(name) 
    rm -f *.d 
    rm -f ../bin/Tsk_* 
    $(foreach d,$(AllDirectories), \ 
    (cd $d && $(MAKE) -f ../makefile.bot name=Tsk_$d clean);) 
    # ========== end clean activities ========== 



.PHONY: install 
#install: $(AllDirectories) 
# # ========== start install activities ========== 
# $(foreach d,$(AllDirectories), \ 
# (cd $d && $(MAKE) -f makefile.mak clean);) 
# # ========== end install activities ========== 

install: $(AllDirectories) 
    # ========== start install activities ========== 
    $(foreach d,$(AllDirectories), \ 
    (cd $d && $(MAKE) -f ../makefile.bot name=Tsk_$d install);) 
    # ========== end install activities ========== 



# include the contents of all the .d files 
# note: the .d files contain: 
# <filename>.o:<filename>.c plus all the dependancies for that file 
# I.E. the #include'd header files 
# wrap with ifneg... so will not rebuild *.d files when goal is 'clean' 
# 
ifneq "$(MAKECMDGOALS)" "clean" 
-include $(DEP) 
endif 

這個名單列表是生成文件進入每個子目錄。

SHELL = /bin/sh 


BINDIR := /home/user/bin 


.PHONY: all 
all : $(BINDIR)/$(name) ../makefile.mak ../makefile.bot 


# 
# macro of all *.c files 
# (NOTE: 
# (the following 'wildcard' will pick up ALL .c files 
# (like FileHeader.c and FunctionHeader.c 
# (which should not be part of the build 
# (so be sure no unwanted .c files in directory 
# (or change the extension 
# 
SRC := $(wildcard *.c) 
OBJ := $(SRC:.c=.o) 
DEP := $(SRC:.c=.d) 
INC := $(SRC:.c=.h) 


COMMON_OBJ := $(wildcard ../*.o) 
#COMMON_SRC := $(wildcard ../*.c) 
#COMMON_OBJ := $(COMMON_SRC:.c=.o) 
#COMMON_DEP := $(COMMON_SRC:.c=.d) 
#COMMON_INC := $(COMMON_SRC:.c=.h) 

MAKE := /usr/bin/make 

CC  := /usr/bin/gcc 

CP  := cp -f 

MV  := mv 

LDFLAGS := -L/usr/local/lib 

DEBUG := -ggdb3 

CCFLAGS := $(DEBUG) -Wall -W 

#CPPFLAGS += =MD 

#LIBS := -lidn -lssl -ldl -lrt -lz -lc -lm 
LIBS := -lssl -ldl -lrt -lz -lc -lm -lcrypto 



# 
# link the .o files into the executable 
# using the linker flags 
# -- explicit rule 
# 
$(name): $(OBJ) $(COMMON_OBJ) ../makefile.mak ../makefile.bot 
    # 
    # ======= $(name) Link Start ========= 
    $(CC) $(LDFLAGS) -o [email protected] $(OBJ) $(COMMON_OBJ) $(LIBS) 
    # ======= $(name) Link Done ========== 
    # 



# note: 
# using MV rather than CP results in all executables being re-made everytime 
$(BINDIR)/$(name): $(name) 
    # 
    # ======= $(name) Copy Start ========= 
    $(CP) $(name) $(BINDIR)/ 
    # ======= $(name) Copy Done ========== 
    # 



# 
#create dependancy files -- inference rule 
# list makefile.mak as dependancy so changing makfile forces rebuild 
# 
%.d: %.c 
    # 
    # ========= START $< TO [email protected] ========= 
    $(CC) -M $(CPPFLAGS) $< > [email protected]$$$$;      \ 
    sed 's,\($*\)\.o[ :]*,\1.o [email protected] : ,g' < [email protected]$$$$ > [email protected];  \ 
    rm -f [email protected]$$$$ 
    # ========= END $< TO [email protected] ========= 



# 
# compile the .c file into .o files using the compiler flags 
# -- inference rule 
# 
%.o: %.c %.d 
    # 
    # ========= START $< TO [email protected] ========= 
    $(CC) $(CCFLAGS) -c $< -o [email protected] -I. 
    # ========= END $< TO [email protected] ========= 
    # 



.PHONY: clean 
clean: 
    # ========== CLEANING UP ========== 
    rm -f *.o 
    rm -f $(name).map 
    rm -f $(name) 
    rm -f *.d 
    # ========== DONE ========== 



.PHONY: install 
install: all 

# include the contents of all the .d files 
# note: the .d files contain: 
# <filename>.o:<filename>.c plus all the dependencies for that .c file 
# I.E. the #include'd header files 
# wrap with ifneg... so will not rebuild *.d files when goal is 'clean' 
# 
ifneq "$(MAKECMDGOALS)" "clean" 
-include $(DEP) 
endif 
相關問題