2014-06-29 01:32:44 +00:00
|
|
|
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
|
2014-08-03 02:47:55 +00:00
|
|
|
DIR = $(shell pwd)
|
|
|
|
LEAN_FILES = $(shell find $(DIR) -type f -name '*.lean')
|
2014-06-29 01:32:44 +00:00
|
|
|
OLEAN_FILES = $(LEAN_FILES:.lean=.olean)
|
2014-08-01 16:08:16 +00:00
|
|
|
DEP_FILES = $(LEAN_FILES:.lean=.d)
|
2014-08-14 22:44:08 +00:00
|
|
|
LEAN_VERSION_FILE = $(shell dirname $(LEAN))/version
|
2014-06-29 01:32:44 +00:00
|
|
|
|
2014-08-01 16:08:16 +00:00
|
|
|
all: $(OLEAN_FILES) $(DEP_FILES)
|
2014-06-29 01:32:44 +00:00
|
|
|
|
2014-08-15 01:21:19 +00:00
|
|
|
%.olean: %.lean $(LEAN_VERSION_FILE)
|
2014-08-04 20:55:53 +00:00
|
|
|
@rm -f $@
|
2014-08-15 01:02:36 +00:00
|
|
|
$(LEAN) $(LEAN_OPTIONS) $< -o $@ -c $(@:.olean=.clean) -i $(@:.olean=.ilean)
|
2014-06-29 01:32:44 +00:00
|
|
|
|
2014-08-15 01:21:19 +00:00
|
|
|
%.d: %.lean $(LEAN_VERSION_FILE)
|
2014-08-01 16:08:16 +00:00
|
|
|
@echo Making dependency file \'$@\' ...
|
2014-08-04 20:55:53 +00:00
|
|
|
@rm -f $@
|
|
|
|
@rm -f $@.tmp
|
|
|
|
@$(LEAN) --deps $< > $@.tmp
|
2014-08-01 17:21:17 +00:00
|
|
|
@printf "$(basename $@).olean : $< $@ " > $@
|
2014-08-04 20:55:53 +00:00
|
|
|
@tr "\n" " " < $@.tmp >> $@
|
|
|
|
@rm -f $@.tmp
|
2014-08-01 16:08:16 +00:00
|
|
|
|
2014-08-01 17:11:01 +00:00
|
|
|
-include $(LEAN_FILES:.lean=.d)
|
2014-08-01 16:08:16 +00:00
|
|
|
|
2014-06-29 01:32:44 +00:00
|
|
|
.PHONY: all clean
|
|
|
|
|
|
|
|
clean:
|
2014-08-04 18:44:17 +00:00
|
|
|
find . -type f -name "*.olean" -delete
|
2014-08-10 18:20:08 +00:00
|
|
|
find . -type f -name "*.clean" -delete
|
2014-08-15 01:02:36 +00:00
|
|
|
find . -type f -name "*.ilean" -delete
|
2014-08-04 18:44:17 +00:00
|
|
|
find . -type f -name "*.d" -delete
|