autotoolize
[m6w6/btr] / share / btr / source / git.mk
diff --git a/share/btr/source/git.mk b/share/btr/source/git.mk
new file mode 100644 (file)
index 0000000..3808590
--- /dev/null
@@ -0,0 +1,31 @@
+SOURCE_CLEAN=false
+
+.PHONY: fetch all clean
+.SUFFIXES:
+
+all: $(BRANCH_DIR) clean fetch
+       $(SAY) "Merging $(BRANCH) of $(REPO)..."
+       cd $(BRANCH_DIR) && \
+               git merge $(QUIET_FLAG) --ff-only;
+
+clean: $(BRANCH_DIR)
+       if $(SOURCE_CLEAN); \
+       then \
+               cd $(BRANCH_DIR) && \
+                       git reset --hard $(QUIET_FLAGS); \
+       fi;
+
+fetch: $(CLEAN_DIR)
+       $(SAY) "Fetching $(REPO)..."
+       cd $(CLEAN_DIR) && \
+               git fetch $(QUIET_FLAG);
+
+$(CLEAN_DIR):
+       $(SAY) "Cloning from $(SOURCE_ARGS)..."
+       git clone $(QUIET_FLAG) $(SOURCE_ARGS) $(CLEAN_DIR);
+
+$(BRANCH_DIR): $(CLEAN_DIR)
+       $(SAY) "Creating workdir for $(BRANCH)"
+       git-new-workdir $(CLEAN_DIR) $(BRANCH_DIR) $(BRANCH)
+
+# vim: noet