6f2c14be23
This is related with issue #43. [skip ci]
30 lines
783 B
Text
30 lines
783 B
Text
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
|
|
DIR = $(shell pwd)
|
|
LEAN_FILES = $(shell find $(DIR) -type f -name '*.lean')
|
|
OLEAN_FILES = $(LEAN_FILES:.lean=.olean)
|
|
DEP_FILES = $(LEAN_FILES:.lean=.d)
|
|
LEAN_VERSION_FILE = $(shell dirname $(LEAN))/version
|
|
|
|
all: $(OLEAN_FILES) $(DEP_FILES)
|
|
|
|
%.olean: %.lean $(LEAN_VERSION_FILE)
|
|
@rm -f $@
|
|
$(LEAN) $(LEAN_OPTIONS) $< -o $@ -c $(@:.olean=.clean)
|
|
|
|
%.d: %.lean $(LEAN_VERSION_FILE)
|
|
@echo Making dependency file \'$@\' ...
|
|
@rm -f $@
|
|
@rm -f $@.tmp
|
|
@$(LEAN) --deps $< > $@.tmp
|
|
@printf "$(basename $@).olean : $< $@ " > $@
|
|
@tr "\n" " " < $@.tmp >> $@
|
|
@rm -f $@.tmp
|
|
|
|
-include $(LEAN_FILES:.lean=.d)
|
|
|
|
.PHONY: all clean
|
|
|
|
clean:
|
|
find . -type f -name "*.olean" -delete
|
|
find . -type f -name "*.clean" -delete
|
|
find . -type f -name "*.d" -delete
|