lean2/library/Makefile.common
Leonardo de Moura b279c94037 feat(build): cread .d (dependency) files for .lean files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-01 09:08:16 -07:00

29 lines
650 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