parents := . .. ../.. ../../.. ../../../.. ../../../../.. base := $(foreach dir,$(parents),$(wildcard $(dir)/make.rules)) BLD_TOP := $(subst /make.rules,,$(word 1,$(base))) include $(BLD_TOP)/config.make include $(BLD_TOP)/make.os include $(BLD_TOP)/make.rules