lean2/library/Makefile.common
Leonardo de Moura d27c85e30c fix(library/Makefile.common): avoid error message when .d files do not exist
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-01 10:11:01 -07:00

29 lines
651 B
Text

TOP := $(dir $(lastword $(MAKEFILE_LIST)))
LEAN_FILES = $(shell find . -type f -name '*.lean')
OLEAN_FILES = $(LEAN_FILES:.lean=.olean)
DEP_FILES = $(LEAN_FILES:.lean=.d)
SED = sed
all: $(OLEAN_FILES) $(DEP_FILES)
%.olean: %.lean
$(LEAN) $(LEAN_OPTIONS) $< -o $@
%.olean: %.lua
$(LEAN) $(LEAN_OPTIONS) $< -o $@
%.d: %.lean
@echo Making dependency file \'$@\' ...
@echo -n "$(basename $@).olean : $< $@ " > $@.tmp.1
@$(LEAN) --deps $< | $(SED) -e ':a;N;$$!ba;s/\n/ /g' > $@.tmp.2
@cat $@.tmp.1 $@.tmp.2 > $@
@rm -f $@.tmp.1
@rm -f $@.tmp.2
-include $(LEAN_FILES:.lean=.d)
.PHONY: all clean
clean:
rm -f *.olean *.d *.d.tmp.1 $.d.tmp.2