2012-04-29 10 views
1

サンプルプロジェクトから、親ディレクトリを "../bin"として参照しようとするmakefileがあります。これは "make install"を実行しているときには動作しないようです。私が手にエラーがある:Makefile - 親ディレクトリを参照する際の問題

cp: cannot stat `/bin/build/*': No such file or directory 

プロジェクトのレイアウトは次のとおりです。

/binに

/SRC /メイク

(だから私はメイクファイルを実行すると、現在のディレクトリは/ src /です)

親ディレクトリを参照しているようです".."は間違っています。 {$ CURDIR}変数を使って現在のディレクトリを参照することができますが、親ディレクトリを参照するための適切な変数や方法を知る必要があるので、/ bin /が正しく参照されています。私はmakefileを動かすことでこれを回避できるかもしれないと思うが、将来の使用のためにこれを行う本当の方法を知りたい。

メイクファイルは、私はGNUが12

おかげでLinuxのミントに3.81を作り使用しています

# The name of the extension. 
extension_name := xulschoolhello 

# The UUID of the extension. 
extension_uuid := [email protected] 

# The name of the profile dir where the extension can be installed. 
profile_dir := 8mtbjosv.development 

# The zip application to be used. 
ZIP := zip 

# The target location of the build and build files. 
bin_dir := ../bin ##### problem ###### 

# The target XPI file. 
xpi_file := $(bin_dir)/$(extension_name)2.xpi 

# The type of operating system this make command is running on. 
os_type := $(patsubst darwin%,darwin,$(shell echo $(OSTYPE))) 

# The location of the extension profile. 
ifeq ($(os_type), darwin) 
    profile_location := \ 
    ~/Library/Application\ Support/Firefox/Profiles/$(profile_dir)/extensions/\{$(extension_uuid)\} 
else 
    ifeq ($(os_type), linux-gnu) 
    profile_location := \ 
     ~/.mozilla/firefox/$(profile_dir)/extensions/ 
    else 
    profile_location := \ 
     "$(subst \,\\,$(APPDATA))\\Mozilla\\Firefox\\Profiles\\$(profile_dir)\\extensions\\{$(extension_uuid)}" 
    endif 
endif 

# The temporary location where the extension tree will be copied and built. 
build_dir := $(bin_dir)/build ##### problem ###### 

# This builds the extension XPI file. 
.PHONY: all 
all: $(xpi_file) 
    @echo 
    @echo "Build finished successfully." 
    @echo 

# This cleans all temporary files and directories created by 'make'. 
.PHONY: clean 
clean: 
    @rm -rf $(build_dir) 
    @rm -f $(xpi_file) 
    @echo "Cleanup is done." 

# The sources for the XPI file. 
xpi_built := install.rdf \ 
      chrome.manifest \ 
      $(wildcard content/*.js) \ 
      $(wildcard content/*.xul) \ 
      $(wildcard content/*.xml) \ 
      $(wildcard content/*.css) \ 
      $(wildcard skin/*.css) \ 
      $(wildcard skin/*.png) \ 
      $(wildcard locale/*/*.dtd) \ 
      $(wildcard locale/*/*.properties) 

$(build_dir) $(xpi_built): $(xpi_built) 

# This builds everything except for the actual XPI, and then it copies it to the 
# specified profile directory, allowing a quick update that requires no install. 
.PHONY: install 
install: $(build_dir) $(xpi_built) 
    @echo "Installing in profile folder: $(profile_location)" 
    @cp -Rf $(build_dir)/* $(profile_location)  ##### problem ###### 
    @echo "Installing in profile folder. Done!" 
    @echo 


$(xpi_file): $(xpi_built) 
    @echo "Creating XPI file." 
    @$(ZIP) $(xpi_file) $(xpi_built) 
    @echo "Creating XPI file. Done!" 

(問題のアールは、#####の問題######で強調)、このようになります。 。

@echo "Installing in profile folder: $(profile_location)" 
    @echo ${build_dir} 
    @echo ${profile_location} 

出力は次のとおりです。私はあなたが先のフォルダ、$(profile_location)は、存在し、それが書き込み可能であることをことをチェックしてみてください

Installing in profile folder: ~/.mozilla/firefox/8mtbjosv.development/extensions/ 
../bin/build 
/home/owner/.mozilla/firefox/8mtbjosv.development/extensions/ 

答えて

0

と思います。また、行末が適切なLinux形式(\ n)であることを確認してください。私は現時点で他のエラーを見つけることができません。

+0

問題ではないようです。私はchmod'd $(profile_location)と同じエラーを取得します。行末も問題ありません。 – Bryan

+0

これは単なる奇妙なことです... cpの代わりに '$(build_dir)'と '$(profile_location)'にエコーを行いますか?また、ここでエラーをタイプしたのですか?それとも端末からコピーしましたか?あなたが慎重に見れば、引用符には小さな矛盾があります...これは手がかりかもしれません。 –

+0

出力は端末からまっすぐです - それは何が原因か分かりませんが奇妙に見えます。あなたが質問の最後にあなたが要求した出力を追加しました。 – Bryan

0

../binがメークファイルの場所に関連していて、実行されている場所以外の場所になるようにするとどうなりますか? make cleanが動作する場合、それは場合のサインです。いくつかのコンパイラオプションを探して冗長な出力を与え、そこに "pwd"ステートメントを入れて解決方法を見てください。

+0

メイクファイルと私が実行している場所は同じです(srcディレクトリ)。 "cp"コマンドの前に "pwd"を発行すると、現在のディレクトリがproject/srcであることが正しく示されます。 – Bryan

+0

おそらく、/ cpコマンドのbuild_dirの/ *にはディレクトリがありません.cpコマンドの-Rは再帰的なものです。代わりにbuild_dirを置くとうまくいくでしょう。 –

+0

私は再帰オプションと同様に "/ *"を取り除くが、どちらもうまくいきませんでした。 – Bryan

関連する問題