# -*- Makefile -*- ifeq "$(COQBIN)" "" COQBIN=$(dir $(shell which coqtop))/ endif ifeq "$(COQMAKEFILE)" "" COQMAKEFILE=$(COQBIN)coq_makefile endif COQDEP=$(COQBIN)coqdep ifeq "$(COQPROJECT)" "" COQPROJECT="_CoqProject" endif # -------------------------------------------------------------------- .PHONY: all config build clean distclean __always__ .SUFFIXES: TOP = $(dir $(lastword $(MAKEFILE_LIST))) COQMAKE = $(MAKE) -f Makefile.coq $(COQMAKEOPTIONS) # -------------------------------------------------------------------- all: config build # -------------------------------------------------------------------- Makefile.coq: Makefile $(BEFOREMAKEFILE) $(COQMAKEFILE) $(COQMAKEFILEOPTIONS) -f $(COQPROJECT) -o Makefile.coq # -------------------------------------------------------------------- config: sub-config this-config Makefile.coq build: sub-build this-build clean: sub-clean this-clean distclean: sub-distclean this-distclean # -------------------------------------------------------------------- .PHONY: this-config this-build this-distclean this-clean this-build:: +$(COQMAKE) this-distclean:: this-clean rm -f Makefile.coq Makefile.coq.conf this-clean:: @if [ -f Makefile.coq ]; then $(COQMAKE) cleanall; fi # -------------------------------------------------------------------- .PHONY: install install: $(COQMAKE) install # -------------------------------------------------------------------- .PHONY: count COQFILES := $(shell grep '.v$$' Make) count: @coqwc $(COQFILES) | tail -1 | \ awk '{printf ("%d (spec=%d+proof=%d)\n", $$1+$$2, $$1, $$2)}' # -------------------------------------------------------------------- this-distclean:: rm -f $(shell find . -name '*~') # -------------------------------------------------------------------- ifdef SUBDIRS sub-%: __always__ @set -e; for d in $(SUBDIRS); do +$(MAKE) -C $$d $(@:sub-%=%); done else sub-%: __always__ @true endif # -------------------------------------------------------------------- %.vo: __always__ +$(COQMAKE) $@