Fix diff and pull targets on Mac
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 22 Apr 2020 13:47:24 +0000 (09:47 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Wed, 22 Apr 2020 13:47:24 +0000 (09:47 -0400)
Makefile
pkgs-brew-install.list

index 0051363..d54f46b 100644 (file)
--- 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
index b937eaf..b6543c7 100644 (file)
@@ -1,6 +1,11 @@
 #
+
+# GNU versions of basic tools
 coreutils
+diffutils
 grep
+gnu-sed
+
 dict
 encfs
 golang
This page took 0.032032 seconds and 4 git commands to generate.