lean2/library/Makefile.common

30 lines
650 B
Text
Raw Normal View History

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