2014-06-29 01:32:44 +00:00
|
|
|
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
|
2014-08-15 19:25:21 +00:00
|
|
|
DIR := $(shell pwd)
|
|
|
|
LEAN_FILES := $(shell find $(DIR) -type f -name '*.lean')
|
|
|
|
OLEAN_FILES := $(LEAN_FILES:.lean=.olean)
|
|
|
|
ILEAN_FILES := $(LEAN_FILES:.lean=.ilean)
|
|
|
|
DEP_FILES := $(LEAN_FILES:.lean=.d)
|
|
|
|
LEAN_BIN_DIR := $(dir $(LEAN))
|
|
|
|
LEAN_VERSION_FILE := $(LEAN_BIN_DIR)version
|
|
|
|
LTAGS := $(LEAN_BIN_DIR)ltags
|
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-15 19:25:21 +00:00
|
|
|
%.ilean: %.lean %.olean $(LEAN_VERSION_FILE)
|
|
|
|
$(LEAN) $(LEAN_OPTIONS) $< -i $@
|
|
|
|
|
|
|
|
etags tags: TAGS
|
|
|
|
|
|
|
|
TAGS: $(ILEAN_FILES)
|
|
|
|
$(LTAGS)
|
|
|
|
|
2014-08-01 17:11:01 +00:00
|
|
|
-include $(LEAN_FILES:.lean=.d)
|
2014-08-01 16:08:16 +00:00
|
|
|
|
2014-08-15 19:25:21 +00:00
|
|
|
.PHONY: all clean tags etags gtags
|
2014-06-29 01:32:44 +00:00
|
|
|
|
|
|
|
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
|