Skip to content

Instantly share code, notes, and snippets.

@Kimundi
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kimundi/4f6529575ff5d7831bbd to your computer and use it in GitHub Desktop.
Save Kimundi/4f6529575ff5d7831bbd to your computer and use it in GitHub Desktop.
RUSTC ?= rustc
RUSTDOC ?= rustdoc
MAKE = make
ifeq ($(OS), Windows_NT)
MAKE = mingw32-make
endif
SRC_DIR = src
DEPS_DIR = deps
LIB_FILE = $(SRC_DIR)/main.rs
LIB_INPUT = $(SRC_DIR)/*.rs
LIB_DIR = lib
DEPS_LIB_DIRS = $(wildcard $(DEPS_DIR)/*/lib)
LIB_OUT = $(LIB_DIR)/main
DEPS_INCLUDE_FLAGS = $(patsubst %,-L %, $(DEPS_LIB_DIRS))
LIB_INCLUDE_FLAGS = -L $(LIB_DIR) $(DEPS_INCLUDE_FLAGS)
all: lib
submodule-update:
@git submodule init
@git submodule update --recursive
$(DEPS_DIR)/gfx-rs/README.md: submodule-update
deps: $(DEPS_DIR)/gfx-rs/README.md
$(MAKE) deps lib -C $(DEPS_DIR)/gfx-rs
mkdir -p $(LIB_DIR)
$(LIB_OUT): $(LIB_INPUT)
$(RUSTC) $(LIB_INCLUDE_FLAGS) --out-dir=$(LIB_DIR) -O $(LIB_FILE)
lib: $(LIB_OUT)
clean-deps:
$(MAKE) clean -C $(DEPS_DIR)/gfx-rs
clean:
rm -rf $(LIB_DIR)
.PHONY: \
all \
submodule-update \
deps \
lib \
clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment