forked from langroid/langroid-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (22 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Path Definitions
LANGROID := ~/Git/langroid/examples/
EXAMPLES := ~/Git/langroid-examples/examples/
# Base rsync command
SYNC_CMD := rsync -avc --files-from=-
# Command with itemized changes for rsync
SYNC_CMD_AI := rsync -aivcn --files-from=-
.PHONY: sync sync-dry stage
sync:
@(cd $(LANGROID) && git ls-files) | $(SYNC_CMD) $(LANGROID)/ $(EXAMPLES)/
sync-dry:
@echo "Files that would be added or modified by rsync..."
@(cd $(LANGROID) && git ls-files) | $(SYNC_CMD_AI) $(LANGROID)/ $(EXAMPLES)/ | grep '^>f'
stage-dry:
@echo "Would add the following modified and newly tracked files to stage:"
@cd $(EXAMPLES) && echo "Modified files:" && git ls-files -m --exclude-standard
@cd $(EXAMPLES) && echo "Newly tracked files:" && bash -c "comm -23 <(cd $(LANGROID) && git ls-files | sort) <(cd $(EXAMPLES) && git ls-files | sort)"
stage:
@echo "Staging modified files..."
@cd $(EXAMPLES) && git ls-files -m --exclude-standard | xargs -r git add
@echo "Staging newly tracked files..."
@cd $(EXAMPLES) && bash -c "comm -23 <(cd $(LANGROID) && git ls-files | sort) <(cd $(EXAMPLES) && git ls-files | sort)" | xargs -r git add