Fix parallel builds

This commit is contained in:
Steven Fackler 2014-06-15 18:22:38 -07:00
parent 6021534951
commit a2447f64d8

View File

@ -9,22 +9,29 @@ INSTALL_DIR := %PREFIX%
###############################################################################
PHF_DIR := submodules/rust-phf
PHF := $(foreach file,$(shell $(MAKE) -s -C $(PHF_DIR) print-targets),$(PHF_DIR)/$(file))
PHF_STAMP := $(BUILDDIR)/phf.stamp
OPENSSL_DIR := submodules/rust-openssl
OPENSSL := $(foreach file,$(shell $(MAKE) -s -C $(OPENSSL_DIR) print-target),$(OPENSSL_DIR)/$(file))
OPENSSL_STAMP := $(BUILDDIR)/openssl.stamp
$(PHF):
$(PHF): $(PHF_STAMP)
$(PHF_STAMP):
$(MAKE) -C $(PHF_DIR)
touch $(PHF)
touch $(PHF_STAMP)
$(OPENSSL):
$(OPENSSL): $(OPENSSL_STAMP)
$(OPENSSL_STAMP):
$(MAKE) -C $(OPENSSL_DIR)
touch $(OPENSSL)
touch $(OPENSSL_STAMP)
###############################################################################
# Main targets
###############################################################################
POSTGRES_LIB_FILE := src/lib.rs
POSTGRES_LIB := $(foreach file,$(shell $(RUSTC) --crate-file-name $(POSTGRES_LIB_FILE)),$(BUILDDIR)/$(file))
POSTGRES_STAMP := $(BUILDDIR)/postgres.stamp
POSTGRES_TEST := $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(POSTGRES_LIB_FILE))
POSTGRES_LIB_DEPS := $(BUILDDIR)/postgres.d
@ -38,9 +45,12 @@ LINK_ARGS := $(foreach file,$(OPENSSL),-L $(dir $(file))) $(foreach file,$(PHF),
$(BUILDDIR):
mkdir -p $@
$(POSTGRES_LIB): $(POSTGRES_LIB_FILE) $(PHF) $(OPENSSL) | $(BUILDDIR)
$(POSTGRES_LIB): $(POSTGRES_STAMP)
$(POSTGRES_STAMP): $(POSTGRES_LIB_FILE) $(PHF) $(OPENSSL) | $(BUILDDIR)
$(RUSTC) $(RUSTFLAGS) $(LINK_ARGS) --dep-info $(POSTGRES_LIB_DEPS) \
--out-dir $(@D) $<
touch $(POSTGRES_STAMP)
$(POSTGRES_TEST): $(POSTGRES_LIB_FILE) $(PHF) $(OPENSSL) | $(BUILDDIR)
$(RUSTC) $(RUSTFLAGS) $(LINK_ARGS) --dep-info $(POSTGRES_TEST_DEPS) \