Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HOSTNAME := $(shell hostname)
- BUILD := $(patsubst %.d,build/%,$(wildcard *.d))
- BUILD_DEST := $(patsubst %.d,%,$(wildcard *.d))
- ASIS := $(filter-out Makefile build tools %.d,$(wildcard *))
- INSTALL := $(addprefix ~/.,$(subst \#,/,$(BUILD_DEST) $(ASIS)))
- FORCE := a # available: y=yes, always; n=no, never; a=ask
- COMBINE := tools/combine-config
- ISL := tools/install-symlink
- all: $(BUILD)
- clean:
- @echo "You probably don't want to actually do a 'make clean' as the"
- @echo "symlinks in your home directory can point to files in build/"
- @echo
- @echo "If you really want to, just rm -Rf build/"
- @exit 1
- install: $(INSTALL)
- .DELETE_ON_ERROR:
- .SECONDARY:
- .PHONY: all clean install
- ~/.%: %
- $(ISL) $(FORCE) "$<" "$@"
- ~/.%: build/%
- $(ISL) $(FORCE) "$<" "$@"
- .SECONDEXPANSION:
- # Note that patsubst does not seem to work in second expansion. Its
- # documented to, but doesn't, at least with Debian GNU make 3.81-8.3.
- build/%: %.d $(COMBINE) $$(wildcard $$(addsuffix .d,$$(subst build/,,$$<))/*)
- @mkdir -p build
- if [ -e "$@" ]; then chmod u+w "$@"; fi
- $(COMBINE) "$(HOSTNAME)" $(wordlist 3,66535,$+) > "$@"
- chmod u-w "$@"
- ~/.%: build/$$(subst /,\#,$$(subst $(HOME)/.,,$$@))
- mkdir -p $(dir $@)
- $(ISL) $(FORCE) "$<" "$@"
- ~/.%: $$(subst /,\#,$$(subst $(HOME)/.,,$$@))
- mkdir -p $(dir $@)
- $(ISL) $(FORCE) "$<" "$@"
Add Comment
Please, Sign In to add comment