執行一個文件

執行一個文件

如何執行一個makefile?該檔案包含在 sts-2.1.2 檔案中,可從以下位置下載這裡:

根據 NIST 文件(第 5.3 節),我需要編輯makefile.

修改以下行:
(a) CC(您的 ANSI C 編譯器)
(b) ROOTDIR(在此程序之前指定的根目錄,例如 rng/)

user@SC13-VM:~/Documents/sts-2.1.2$ ./makefile
./makefile: line 1: CC: command not found
./makefile: line 2: GCCFLAGS: command not found
./makefile: line 3: ROOTDIR: command not found
./makefile: line 4: ROOTDIR: command not found
./makefile: line 4: SRCDIR: command not found
./makefile: line 5: ROOTDIR: command not found
./makefile: line 5: OBJDIR: command not found
./makefile: line 6: VPATH: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
./makefile: line 8: OBJDIR: command not found
 ......

總共有94行。

然後我就照你說的做了:

 user@SC13-VM:~/Documents/sts-2.1.2$ make makefile
 make: Nothing to be done for `makefile'.
 user@SC13-VM:~/Documents/sts-2.1.2$ ls
 data  experiments  include  makefile  makefile~  obj  src  templates

 user@SC13-VM:~/Documents/sts-2.1.2$ make  makefile
 make: Nothing to be done for `makefile'.

答案1

運行make以運行 Makefile。這假設您與文件Makefile所在的目錄位於同一目錄中。

如果您位於不同的目錄中,請執行make -C directory,其中directory是包含該檔案的目錄的路徑Makefile

答案2

看了上面答案的評論,你可能犯了跟我一樣的錯誤:

錯誤的命令:make makefile 這會給你錯誤“沒有什麼可做的”

正確的命令:make -f makefile

我應該提到的是,我已經將其製作為可執行文件,並遇到了相同的錯誤。此外,上述命令一開始執行時沒有錯誤,但assess文件並未依承諾出現。我重複了一遍,結果成功了。我是一個新手,所以我真的不能評論那麼多。

相關內容