make install 一問 - Linux

By Callum
at 2011-04-16T02:43
at 2011-04-16T02:43
Table of Contents
我有關於make install的問題想問
在我的Makefile裡面有一段內容如下
all:hello
CC = gcc
INSTDIR = /usr/local/bin
hello: hello.c
$(CC) hello.c -o hello
install: hello
@if[ -d $(INSTDIR) ];\
then\
cp hello $(INSTDIR);\
echo "Installed in $(INSTDIR)";\
else\
echo "Sorry, $(INSTDIR) does not exist";\
fi
但當我下make install的時候卻
/bin/sh: if[: not found
cp: cannot create regular file `/usr/local/bin/hello': Permission denied
Installed in /usr/local/bin
Sorry, /usr/local/bin does not exist
換句話說if判斷式是無用的
而我是從網路上的範例嘗試的
@if[ -d $(INSTDIR) ];\ 其中的-d就是判斷INSTDIR是否存在
有大大知道這是什麼樣的情況嗎?
謝謝!
--
--
在我的Makefile裡面有一段內容如下
all:hello
CC = gcc
INSTDIR = /usr/local/bin
hello: hello.c
$(CC) hello.c -o hello
install: hello
@if[ -d $(INSTDIR) ];\
then\
cp hello $(INSTDIR);\
echo "Installed in $(INSTDIR)";\
else\
echo "Sorry, $(INSTDIR) does not exist";\
fi
但當我下make install的時候卻
/bin/sh: if[: not found
cp: cannot create regular file `/usr/local/bin/hello': Permission denied
Installed in /usr/local/bin
Sorry, /usr/local/bin does not exist
換句話說if判斷式是無用的
而我是從網路上的範例嘗試的
@if[ -d $(INSTDIR) ];\ 其中的-d就是判斷INSTDIR是否存在
有大大知道這是什麼樣的情況嗎?
謝謝!
--
推 sinon2mayday:玩具反斗城來了03/26 16:52
推 kodo555:XD03/26 17:00
推 crueangel: 現在他來了03/26 17:01
推 papazzz: 你也知道我也知道03/26 17:09
推 taogc: 獨眼龍也知道03/26 17:11
--
Tags:
Linux
All Comments

By Victoria
at 2011-04-16T23:29
at 2011-04-16T23:29

By Sierra Rose
at 2011-04-21T11:10
at 2011-04-21T11:10

By Linda
at 2011-04-24T17:36
at 2011-04-24T17:36

By Quintina
at 2011-04-25T17:33
at 2011-04-25T17:33

By Noah
at 2011-04-25T20:15
at 2011-04-25T20:15

By Kyle
at 2011-04-26T23:09
at 2011-04-26T23:09

By George
at 2011-04-28T12:49
at 2011-04-28T12:49

By Harry
at 2011-05-02T10:42
at 2011-05-02T10:42
Related Posts
坎特伯雷專案真的是愚人節計畫

By Dorothy
at 2011-04-15T20:21
at 2011-04-15T20:21
system freeze

By Christine
at 2011-04-15T18:58
at 2011-04-15T18:58
切換程式後不會 redraw @@"

By Andrew
at 2011-04-15T15:48
at 2011-04-15T15:48
桌布設成網頁

By Belly
at 2011-04-15T15:22
at 2011-04-15T15:22
codeblocks在ubuntu10.10上執行

By Andy
at 2011-04-14T22:32
at 2011-04-14T22:32