2014-01-18 21:46:39 +00:00
|
|
|
export RUSTC = rustc
|
|
|
|
BUILDDIR = build
|
|
|
|
export RUSTFLAGS = -O -Z debug-info
|
2014-01-14 05:04:19 +00:00
|
|
|
|
2014-01-18 21:46:39 +00:00
|
|
|
POSTGRES_LIB = lib.rs
|
|
|
|
POSTGRES = $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(POSTGRES_LIB))
|
|
|
|
POSTGRES_TEST = $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(POSTGRES_LIB))
|
|
|
|
OPENSSL_DIR = submodules/rust-openssl
|
|
|
|
OPENSSL = $(OPENSSL_DIR)/$(shell $(MAKE) -s -C $(OPENSSL_DIR) print-target)
|
2014-01-18 22:09:31 +00:00
|
|
|
PHF_DIR = submodules/rust-phf
|
|
|
|
PHF = $(PHF_DIR)/$(shell $(MAKE) -s -C $(PHF_DIR) print-targets)
|
2014-01-14 05:04:19 +00:00
|
|
|
|
2014-01-18 21:46:39 +00:00
|
|
|
all: $(POSTGRES)
|
2014-01-14 05:04:19 +00:00
|
|
|
|
2014-01-18 21:46:39 +00:00
|
|
|
-include $(BUILDDIR)/postgres.d
|
|
|
|
-include $(BUILDDIR)/postgres_test.d
|
|
|
|
|
|
|
|
$(BUILDDIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
2014-01-18 22:09:31 +00:00
|
|
|
$(BUILDDIR)/submodule-trigger: submodules/submodule-trigger | $(BUILDDIR)
|
2014-01-18 21:46:39 +00:00
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
touch $@
|
|
|
|
|
2014-01-18 22:09:31 +00:00
|
|
|
$(OPENSSL): $(BUILDDIR)/submodule-trigger | $(BUILDDIR)
|
2014-01-18 21:46:39 +00:00
|
|
|
$(MAKE) -C $(OPENSSL_DIR)
|
|
|
|
|
2014-01-18 22:09:31 +00:00
|
|
|
$(PHF): $(BUILDDIR)/submodule-trigger | $(BUILDDIR)
|
|
|
|
$(MAKE) -C $(PHF_DIR)
|
|
|
|
|
|
|
|
$(POSTGRES): $(POSTGRES_LIB) $(OPENSSL) $(PHF) | $(BUILDDIR)
|
2014-01-18 21:46:39 +00:00
|
|
|
$(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres.d --out-dir $(@D) \
|
2014-01-18 22:09:31 +00:00
|
|
|
-L $(dir $(OPENSSL)) $(foreach file,$(PHF),-L $(dir $(file))) $<
|
2014-01-18 21:46:39 +00:00
|
|
|
|
2014-01-18 22:09:31 +00:00
|
|
|
$(POSTGRES_TEST): $(POSTGRES_LIB) $(OPENSSL) $(PHF) | $(BUILDDIR)
|
2014-01-18 21:46:39 +00:00
|
|
|
$(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres_test.d --out-dir $(@D) \
|
2014-01-18 22:09:31 +00:00
|
|
|
-L $(dir $(OPENSSL)) $(foreach file,$(PHF),-L $(dir $(file))) --test $<
|
2014-01-18 21:46:39 +00:00
|
|
|
|
|
|
|
check: $(POSTGRES_TEST)
|
|
|
|
$<
|
2014-01-14 05:04:19 +00:00
|
|
|
|
|
|
|
clean:
|
2014-01-18 21:46:39 +00:00
|
|
|
rm -rf $(BUILDDIR)
|
|
|
|
|
2014-01-18 22:36:24 +00:00
|
|
|
doc: $(OPENSSL) $(PHF)
|
|
|
|
rustdoc -L $(dir $(OPENSSL)) $(foreach file,$(PHF),-L $(dir $(file))) \
|
|
|
|
$(POSTGRES_LIB)
|
|
|
|
|
2014-01-18 21:46:39 +00:00
|
|
|
.PHONY: all check clean
|