makefilesplint

How to insert Splint into Makefile?


I would like to configure my project in order to use Splint to analyse the different components.

How to add the command line into my Makefile, in a way it will ask if I want to run an analysis with Splint or just compile the program normally ?


Solution

  • To run splint as part of the running of make you can either add it to an existing target in the makefile or you can add a new splint/lint/etc. target that runs the command you need to run.

    lint:
            splint arg1 arg2
    

    You will want to mark that target as a .PHONY so make does the right thing should a lint file ever exist.

    You may also, for completeness/etc., list the files that splint operates on as prerequisites of the target. (e.g. lint: $(SOURCE_FILES) or whatever.)