diff options
| author | coqbot-app[bot] | 2020-11-18 13:04:51 +0000 |
|---|---|---|
| committer | GitHub | 2020-11-18 13:04:51 +0000 |
| commit | 162c19cbb1863e11a81450a188a6d7f9f79e8b73 (patch) | |
| tree | bf1f2c534d3dcc86cc85597c9a49f3451fb48c2f /doc/sphinx | |
| parent | 4a56d4d90294d3f6128d68d7d1d11e3e27ae8b9a (diff) | |
| parent | 3fb5c7751988d6e8e0193dba36828bb0eb0d7a41 (diff) | |
Merge PR #13220: Give a typical example of Makefile wrapper for coq_makefile (addresses #12903)
Reviewed-by: gares
Ack-by: Zimmi48
Ack-by: SkySkimmer
Diffstat (limited to 'doc/sphinx')
| -rw-r--r-- | doc/sphinx/practical-tools/utilities.rst | 88 |
1 files changed, 42 insertions, 46 deletions
diff --git a/doc/sphinx/practical-tools/utilities.rst b/doc/sphinx/practical-tools/utilities.rst index ec3689bbbe..5d36ec3cf9 100644 --- a/doc/sphinx/practical-tools/utilities.rst +++ b/doc/sphinx/practical-tools/utilities.rst @@ -92,14 +92,54 @@ CoqMakefile is a makefile for ``GNU Make`` with targets to build the project (e.g. generate .vo or .html files from .v or compile .ml* files) and install it in the ``user-contrib`` directory where the Coq - library is installed. Run ``make`` with the ``-f CoqMakefile`` - option to use ``CoqMakefile``. + library is installed. CoqMakefile.conf contains make variables assignments that reflect the contents of the ``_CoqProject`` file as well as the path relevant to Coq. +The recommended approach is to invoke ``CoqMakefile`` from a standard +``Makefile`` of the following form: + +.. example:: + + :: + + # KNOWNTARGETS will not be passed along to CoqMakefile + KNOWNTARGETS := CoqMakefile extra-stuff extra-stuff2 + # KNOWNFILES will not get implicit targets from the final rule, and so + # depending on them won't invoke the submake + # Warning: These files get declared as PHONY, so any targets depending + # on them always get rebuilt + KNOWNFILES := Makefile _CoqProject + + .DEFAULT_GOAL := invoke-coqmakefile + + CoqMakefile: Makefile _CoqProject + $(COQBIN)coq_makefile -f _CoqProject -o CoqMakefile + + invoke-coqmakefile: CoqMakefile + $(MAKE) --no-print-directory -f CoqMakefile $(filter-out $(KNOWNTARGETS),$(MAKECMDGOALS)) + + .PHONY: invoke-coqmakefile $(KNOWNFILES) + + #################################################################### + ## Your targets here ## + #################################################################### + + # This should be the last rule, to handle any targets not declared above + %: invoke-coqmakefile + @true + +The advantage of a wrapper, compared to directly calling the generated +``Makefile``, is that it +provides a target independent of the version of Coq to regenerate a +``Makefile`` specific to the current version of Coq. Additionally, the +master ``Makefile`` can be extended with targets not specific to Coq. +Including the generated makefile with an include directive is +discouraged, since the contents of this file, including variable names and +status of rules, may change in the future. An optional file ``CoqMakefile.local`` can be provided by the user in order to extend ``CoqMakefile``. In particular one can declare custom actions to be @@ -453,50 +493,6 @@ line timing data: This target requires python to build the table. -Reusing/extending the generated Makefile -++++++++++++++++++++++++++++++++++++++++ - -Including the generated makefile with an include directive is -discouraged. The contents of this file, including variable names and -status of rules shall change in the future. Users are advised to -include ``Makefile.conf`` or call a target of the generated Makefile as in -``make -f Makefile target`` from another Makefile. - -One way to get access to all targets of the generated ``CoqMakefile`` is to -have a generic target for invoking unknown targets. - -.. example:: - - :: - - # KNOWNTARGETS will not be passed along to CoqMakefile - KNOWNTARGETS := CoqMakefile extra-stuff extra-stuff2 - # KNOWNFILES will not get implicit targets from the final rule, and so - # depending on them won't invoke the submake - # Warning: These files get declared as PHONY, so any targets depending - # on them always get rebuilt - KNOWNFILES := Makefile _CoqProject - - .DEFAULT_GOAL := invoke-coqmakefile - - CoqMakefile: Makefile _CoqProject - $(COQBIN)coq_makefile -f _CoqProject -o CoqMakefile - - invoke-coqmakefile: CoqMakefile - $(MAKE) --no-print-directory -f CoqMakefile $(filter-out $(KNOWNTARGETS),$(MAKECMDGOALS)) - - .PHONY: invoke-coqmakefile $(KNOWNFILES) - - #################################################################### - ## Your targets here ## - #################################################################### - - # This should be the last rule, to handle any targets not declared above - %: invoke-coqmakefile - @true - - - Building a subset of the targets with ``-j`` ++++++++++++++++++++++++++++++++++++++++++++ |
