]> git.ipfire.org Git - thirdparty/git.git/commit - Makefile
Makefile: add a hdr-check target
authorRamsay Jones <ramsay@ramsayjones.plus.com>
Wed, 19 Sep 2018 00:07:08 +0000 (01:07 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Sep 2018 18:47:38 +0000 (11:47 -0700)
commitebb7baf02f69f2164b1f89148945d18c376fc6a8
tree1fa1e3bd6c5811fb719e99739d9f22388b9ae70f
parent2d3b1c576c85b7f5db1f418907af00ab88e0c303
Makefile: add a hdr-check target

Commit ef3ca95475 ("Add missing includes and forward declarations",
2018-08-15) resulted from the author employing a manual method to
create a C file consisting of a pair of pre-processor #include
lines (for 'git-compat-util.h' and a given toplevel header), and
fixing any resulting compiler errors or warnings.

Add a Makefile target to automate this process. This implementation
relies on the '-include' and '-xc' arguments to the 'gcc' and 'clang'
compilers, which allows us to effectively create the required C
compilation unit on-the-fly. This limits the portability of this
solution to those systems which have such a compiler.

The new 'hdr-check' target can be used to check most header files in
the project (for various reasons, the 'compat' and 'xdiff' directories
are not included). Also, note that individual header files can be
checked directly using the '.hco' extension (read: Hdr-Check Object)
like so:

    $ make config.hco
        HDR config.h
    $

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile