X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=Makefile;h=d54f46b4a13c55708c6285b1804f1172c380a576;hb=645a9cd8b57717869e4d5f6bf70d8baba2f406a7;hp=48a22924fdd47e80f39b712c32b61f0acdc303b5;hpb=ba898a096aa4c8f729ee0e25629a3778d61d1d3b;p=khome.git diff --git a/Makefile b/Makefile index 48a2292..d54f46b 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,14 @@ MAKEFLAGS := --no-builtin-rules DEPS := $(wildcard deps/*) +ifeq ($(shell uname),Darwin) + SED := gsed + DIFF := $(shell gls -t1 /usr/local/Cellar/diffutils/*/bin/diff | head -1) +else + SED := sed + DIFF := diff +endif + .PHONY: \ default \ clean \ @@ -9,6 +17,7 @@ DEPS := $(wildcard deps/*) deps \ home \ diff \ + pull \ mpdconf \ pkgs_brew_cask_install \ pkgs_brew_install \ @@ -128,8 +137,13 @@ $(foreach d,$(DEPS),$(eval $(call GEN_DEP_RULE,$(d)))) diff: find home -type f -print0 \ - | sed -z 's/^home\///g' \ - | xargs -0 -I% sh -c 'echo %; diff --color=always ~/% home/%' + | $(SED) -z 's/^home\///g' \ + | xargs -0 -I% sh -c 'echo %; $(DIFF) --color=always ~/% home/%' + +pull: + find home -type f -print0 \ + | $(SED) -z 's/^home\///g' \ + | xargs -0 -I% sh -c '$(DIFF) -q ~/% home/% > /dev/null || cp ~/% home/%' clean: rm -rf ./debfiles