0

我正在尝试编写一个规则,该规则仅在某个共享对象库不存在时才应执行

$(OUTDIR)/libv8-$(ARCH).so: v8

v8: # to be able to build V8 only with "make v8"
    cd V8; bash V8Update.sh

但是,V8Update.sh每次都执行。这是完整的Makefile

CC=g++
V8INCLUDEDIR=V8/build/v8/include
CFLAGS=-c -Wall -std=c++0x -fPIC -I$(V8INCLUDEDIR) -I/usr/include -I/usr/include/c++/4.6                               \
       -I/usr/include/c++/4.6/backward -I/usr/include/c++/4.6/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu         \
       -I/usr/lib/gcc/x86_64-linux-gnu/4.6/include -I/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed                   \
       -I/usr/local/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/
DEPS=ProxyTypes.h $(V8INCLUDEDIR)/v8.h $(V8INCLUDEDIR)/v8-debug.h $(V8INCLUDEDIR)/v8stdint.h
ARCH=x64 # TODO: Add support for building 32-bit libraries.
LDFLAGS=-shared -lglib-2.0 -L/usr/lib/x86_64-linux-gnu/ #-Wl,--no-undefined
SOURCES=Exports.cpp FunctionTemplateProxy.cpp HandleProxy.cpp ObjectTemplateProxy.cpp Utilities.cpp V8EngineProxy.cpp  \
        ValueProxy.cpp
OBJECTS=$(patsubst %,$(OUTDIR)/%,$(SOURCES:.cpp=.o))
LIBRARY=libV8_Net_Proxy.so

.PHONY: all v8 release debug makeoutdir clean copybin

all: debug copybin

v8: # to be able to build V8 only with "make v8"
    cd V8; bash V8Update.sh

release: OUTDIR=bin/Release
debug: OUTDIR=bin/Debug

release debug:
    $(MAKE) -S makeoutdir $(LIBRARY) OUTDIR=$(OUTDIR)


makeoutdir:
    mkdir -p $(OUTDIR)

clean:
    rm bin/ -rf
#   rm V8/build -rf

copybin:
    cp -a bin/Debug/*.so ../bin/Debug

$(LIBRARY): $(OUTDIR)/libv8-$(ARCH).so $(OBJECTS)
    $(CC) $(LDFLAGS) -lv8-$(ARCH) -L$(OUTDIR) -o $(patsubst %,$(OUTDIR)/%,$@) $(OBJECTS)

$(OUTDIR)/libv8-$(ARCH).so: v8

$(OUTDIR)/%.o: %.cpp $(DEPS)
    $(CC) $(CFLAGS) -o $@ $<

我在这里做错了什么?

4

1 回答 1

1

它应该是

v8: $(OUTDIR)/libv8-$(ARCH).so

$(OUTDIR)/libv8-$(ARCH).so:
    cd V8; bash V8Update.sh

您不能依赖虚假目标 - 它每次都会执行(顺便说一句,这是一个功能)。

于 2013-09-13T09:18:29.737 回答