From: Siraaj Khandkar Date: Wed, 22 Apr 2020 13:47:24 +0000 (-0400) Subject: Fix diff and pull targets on Mac X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=0b63d66210f0bfefc55e73d52409117496ecc7b5;p=khome.git Fix diff and pull targets on Mac --- diff --git a/Makefile b/Makefile index 0051363..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 \ @@ -129,13 +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/%' + | $(SED) -z 's/^home\///g' \ + | xargs -0 -I% sh -c '$(DIFF) -q ~/% home/% > /dev/null || cp ~/% home/%' clean: rm -rf ./debfiles diff --git a/pkgs-brew-install.list b/pkgs-brew-install.list index b937eaf..b6543c7 100644 --- a/pkgs-brew-install.list +++ b/pkgs-brew-install.list @@ -1,6 +1,11 @@ # + +# GNU versions of basic tools coreutils +diffutils grep +gnu-sed + dict encfs golang