# Kernel # # Douglas Thrift # # $Id$ kernels := $(wildcard */*) install_kernels := $(foreach kernel,$(kernels),install_$(dir $(kernel))_$(notdir $(kernel))) .PHONY: all install $(install_kernels) clean all: $(kernels) define all_kernel $(1): /usr/src/sys/$(dir $(1))conf/GENERIC vimdiff $$@ $$< endef $(foreach kernel,$(kernels),$(eval $(call all_kernel,$(kernel)))) install: all $(install_kernels) define install_kernel install_$(dir $(1))_$(notdir $(1)): ln -sf $(realpath $(1)) /usr/src/sys/$(dir $(1))conf endef $(foreach kernel,$(kernels),$(eval $(call install_kernel,$(kernel)))) clean: for file in /usr/src/sys/*/conf/*; do [ -L $$file ] && [ ! -f `readlink $$file` ] && rm -f $$file || true; done