refactor(Makefile): do not use full path on makefile rules

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-08-23 18:28:34 -07:00
parent df3c1d8dd2
commit 7cb2ca62f4

View file

@ -1,6 +1,6 @@
TOP := $(dir $(lastword $(MAKEFILE_LIST))) TOP := $(dir $(lastword $(MAKEFILE_LIST)))
DIR := $(shell pwd) DIR := $(shell pwd)
LEAN_FILES := $(shell find $(DIR) -type f -name '*.lean') LEAN_FILES := $(shell cd $(DIR); find . -type f -name '*.lean')
OLEAN_FILES := $(LEAN_FILES:.lean=.olean) OLEAN_FILES := $(LEAN_FILES:.lean=.olean)
ILEAN_FILES := $(LEAN_FILES:.lean=.ilean) ILEAN_FILES := $(LEAN_FILES:.lean=.ilean)
DEP_FILES := $(LEAN_FILES:.lean=.d) DEP_FILES := $(LEAN_FILES:.lean=.d)
@ -16,12 +16,10 @@ all: $(OLEAN_FILES) $(DEP_FILES)
%.d: %.lean $(LEAN_VERSION_FILE) %.d: %.lean $(LEAN_VERSION_FILE)
@echo Making dependency file \'$@\' ... @echo Making dependency file \'$@\' ...
@rm -f $@ $(eval DEPS := $(shell $(LEAN) --deps $<))
@rm -f $@.tmp $(eval DEPS := $(subst $(DIR)/,, $(DEPS)))
@$(LEAN) --deps $< > $@.tmp $(eval DEPS := $(subst "\n", " ", $(DEPS)))
@printf "$(basename $@).olean : $< $@ " > $@ @printf "$(basename $@).olean : $< $@ $(DEPS)\n" > $@
@tr "\n" " " < $@.tmp >> $@
@rm -f $@.tmp
%.ilean: %.lean %.olean $(LEAN_VERSION_FILE) %.ilean: %.lean %.olean $(LEAN_VERSION_FILE)
$(LEAN) $(LEAN_OPTIONS) $< -i $@ $(LEAN) $(LEAN_OPTIONS) $< -i $@