0

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 ?

Alma
  • 31
  • 1
  • 10
  • Generally one doesn't get asked by make what you want to do. Generally you tell make what you want via targets on the command line (i.e. `make install` vs. `make` vs. `make clean`). Do you know the splint command you want/need to run? – Etan Reisner Apr 27 '15 at 11:23
  • @Etan thanks for your reply, not really but for now I just need to run the basic analysis command from within a Makefile... – Alma Apr 27 '15 at 14:07
  • 1
    What is "the basic analysis command"? That was my question. If you know the command (and what inputs it operates on) then you can just write a `split` or `lint` or whatever target in the makefile that runs that command. – Etan Reisner Apr 27 '15 at 14:48
  • I understand now ... I was confusing a script that executes a makefile and the makefile itself ... because we use a shell script for our project which calls makefile according to some conditions....I will just add the command as you said to the makefile. – Alma Apr 28 '15 at 14:42
  • @EtanReisner could you please make your helpful advice as an official answer? thanks – Alma Apr 28 '15 at 14:47

1 Answers1

0

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.)

undur_gongor
  • 15,657
  • 5
  • 63
  • 75
Etan Reisner
  • 77,877
  • 8
  • 106
  • 148