44 lines
1.1 KiB
Makefile
44 lines
1.1 KiB
Makefile
# Copyright (c) 2018 Simon Hudon. All rights reserved.
|
|
# Released under Apache 2.0 license as described in the file LICENSE.
|
|
# Authors: Simon Hudon, Sebastian Ullrich, Leonardo de Moura
|
|
LEAN = ../bin/lean
|
|
SRCS = $(shell find . -name '*.lean')
|
|
OBJS = $(SRCS:.lean=.olean)
|
|
DEPS = $(SRCS:.lean=.depend)
|
|
OPTS = @LEAN_EXTRA_MAKE_OPTS@
|
|
BOOT_DIR = ../src/boot
|
|
CPPS = $(addprefix $(BOOT_DIR)/,$(patsubst %.lean,%.cpp,$(SRCS)))
|
|
# ensure deterministic ordering
|
|
CPPS_CORE=$(sort $(patsubst %.lean,%.cpp,$(SRCS)))
|
|
|
|
.PHONY: all clean
|
|
|
|
all: $(OBJS)
|
|
|
|
depends: $(DEPS)
|
|
|
|
%.depend: %.lean
|
|
@echo $(<:.lean=.olean): `$(LEAN) --deps $< | python relative.py` > $@
|
|
|
|
%.olean: %.lean %.depend
|
|
$(LEAN) $(OPTS) --make $<
|
|
# make sure the .olean file is newer than the .depend file to prevent infinite make cycles
|
|
@touch $@
|
|
|
|
clean:
|
|
find . -name *.olean -delete
|
|
find . -name *.depend -delete
|
|
|
|
$(BOOT_DIR)/%.cpp: %.lean %.olean
|
|
@mkdir -p $(@D)
|
|
$(LEAN) $(OPTS) --cpp=$@ $<
|
|
|
|
updatecpp: $(CPPS)
|
|
echo "add_library (boot OBJECT $(CPPS_CORE))" > $(BOOT_DIR)/CMakeLists.txt
|
|
|
|
cleancpp:
|
|
find $(BOOT_DIR) -name '*.cpp' -delete
|
|
|
|
.PRECIOUS: %.depend
|
|
|
|
include $(DEPS)
|