First part of transition from not-function header.
[splint-patched.git] / src / Makefile.am
blob73792f00a875a2b778b307d4f620cacb7c72d41a
1 ## Note: starting comments with ## means they don't end up in Makefile
3 AUTOMAKE_OPTIONS = 1.5 foreign
5 bin_PROGRAMS = splint
7 INCDIR = Headers
9 AM_CPPFLAGS = -I$(srcdir)/$(INCDIR) -DPKGDATADIR='"$(pkgdatadir)"'
10 AM_YFLAGS = -d
12 PARSERS = \
13           cgrammar.y \
14           mtgrammar.y \
15           llgrammar.y \
16           lslgrammar.y
18 HAND_SCANNERS = \
19                 lclscan.c \
20                 mtscanner.c \
21                 lslscan.c
23 SCANNERS = \
24            cscanner.l \
25            $(HAND_SCANNERS)
27 GRAMSRC = $(PARSERS) $(SCANNERS)
29 ## The main sources
31 SETSRC = \
32          globSet.c \
33          guardSet.c \
34          intSet.c \
35          sRefSet.c \
36          typeIdSet.c \
37          usymIdSet.c
39 LISTSRC = \
40           clauseStack.c \
41           cstringList.c \
42           cstringSList.c \
43           ctypeList.c \
44           enumNameList.c \
45           enumNameSList.c \
46           exprNodeList.c \
47           exprNodeSList.c \
48           filelocList.c \
49           filelocStack.c \
50           flagMarkerList.c \
51           flagSpec.c \
52           idDeclList.c \
53           qualList.c \
54           sRefSetList.c \
55           uentryList.c
57 CPPSRC = \
58          cppmain.c \
59          cpplib.c \
60          cppexp.c \
61          cpphash.c \
62          cpperror.c
64 CSRC = \
65        clabstract.c \
66        clause.c \
67        context.c \
68        cprim.c \
69        cscannerHelp.c \
70        ctype.c \
71        functionClause.c \
72        functionClauseList.c \
73        functionConstraint.c \
74        globalsClause.c \
75        idDecl.c \
76        macrocache.c \
77        metaStateConstraint.c \
78        metaStateConstraintList.c \
79        metaStateExpression.c \
80        metaStateSpecifier.c \
81        modifiesClause.c \
82        pointers.c \
83        qtype.c \
84        qual.c \
85        stateClause.c \
86        stateClauseList.c \
87        uentry.c \
88        warnClause.c
90 SPLINTSRC = \
91             exprChecks.c \
92             exprNode.c \
93             help.c \
94             llmain.c \
95             rcfiles.c
97 CHECKSRC = \
98            nameChecks.c \
99            structNames.c \
100            transferChecks.c \
101            varKinds.c
103 GLOBSRC = \
104           globals.c \
105           flags.c \
106           general.c \
107           mstring.c \
108           misc.c \
109           osd.c \
110           reader.c \
111           mtreader.c
113 OVERFLOWCHSRC = \
114                 constraintList.c \
115                 constraintResolve.c \
116                 constraintGeneration.c \
117                 constraintTerm.c \
118                 constraintExprData.c \
119                 constraintExpr.c \
120                 constraint.c \
121                 loopHeuristics.c 
123 GENERALSRC = \
124              exprData.c \
125              cstring.c \
126              fileloc.c \
127              message.c \
128              inputStream.c \
129              fileTable.c \
130              cstringHash.c \
131              cstringTable.c \
132              valueTable.c \
133              stateValue.c \
134              llerror.c \
135              messageLog.c \
136              flagMarker.c \
137              aliasTable.c \
138              ynm.c \
139              sRefTable.c \
140              genericTable.c \
141              ekind.c \
142              usymtab.c \
143              multiVal.c \
144              lltok.c \
145              sRef.c \
146              library.c \
147              fileLib.c
149 METASTATESRC = \
150                stateInfo.c \
151                stateCombinationTable.c \
152                metaStateTable.c \
153                metaStateInfo.c \
154                annotationTable.c \
155                annotationInfo.c \
156                mttok.c \
157                mtDeclarationNode.c \
158                mtDeclarationPieces.c \
159                mtDeclarationPiece.c \
160                mtContextNode.c \
161                mtValuesNode.c \
162                mtDefaultsNode.c \
163                mtAnnotationsNode.c \
164                mtMergeNode.c \
165                mtAnnotationList.c \
166                mtAnnotationDecl.c \
167                mtTransferClauseList.c \
168                mtTransferClause.c \
169                mtTransferAction.c \
170                mtLoseReferenceList.c \
171                mtLoseReference.c \
172                mtDefaultsDeclList.c \
173                mtDefaultsDecl.c \
174                mtMergeItem.c \
175                mtMergeClause.c \
176                mtMergeClauseList.c
178 ## These are only used if LCL is enabled
180 LCLONLYSRC = \
181              usymtab_interface.c \
182              abstract.c \
183              ltoken.c \
184              lclscanline.c \
185              lclsyntable.c \
186              lcltokentable.c \
187              sort.c \
188              symtable.c \
189              lclinit.c \
190              shift.c \
191              lsymbol.c \
192              mapping.c
194 LSLSRC = \
195          lsltokentable.c \
196          lslscanline.c \
197          lslparse.c \
198          lh.c \
199          checking.c \
200          lclctypes.c \
201          imports.c \
202          lslinit.c \
203          lslsyntable.c 
205 LCLSETSRC  = \
206              lsymbolSet.c \
207              sigNodeSet.c \
208              lslOpSet.c \
209              sortSet.c
211 LCLLISTSRC = \
212              initDeclNodeList.c \
213              sortList.c \
214              declaratorInvNodeList.c \
215              interfaceNodeList.c \
216              sortSetList.c \
217              declaratorNodeList.c \
218              letDeclNodeList.c \
219              stDeclNodeList.c \
220              storeRefNodeList.c \
221              lslOpList.c \
222              lsymbolList.c \
223              termNodeList.c \
224              ltokenList.c \
225              traitRefNodeList.c \
226              pairNodeList.c \
227              typeNameNodeList.c \
228              fcnNodeList.c \
229              paramNodeList.c \
230              programNodeList.c \
231              varDeclarationNodeList.c \
232              varNodeList.c \
233              quantifierNodeList.c \
234              replaceNodeList.c \
235              importNodeList.c
237 LCLSRC = \
238          $(LCLSETSRC) \
239          $(LCLLISTSRC) \
240          $(LSLSRC) \
241          $(LCLONLYSRC) 
243 COMMONSRC =  \
244              $(CPPSRC) \
245              $(CSRC) \
246              $(CHECKSRC) \
247              $(GENERALSRC) \
248              $(GLOBSRC) \
249              $(LISTSRC) \
250              $(SETSRC) \
251              $(METASTATESRC) \
252              $(OVERFLOWCHSRC) \
253              $(SPLINTSRC) \
254              $(LCLSRC)
256 HEADERSRC = \
257             $(INCDIR)/abstBodyNode.h \
258             $(INCDIR)/abstract.h \
259             $(INCDIR)/abstractNode.h \
260             $(INCDIR)/aliasTable.h \
261             $(INCDIR)/annotationInfo.h \
262             $(INCDIR)/annotationTable.h \
263             $(INCDIR)/arrayQualNode.h \
264             $(INCDIR)/basic.h \
265             $(INCDIR)/bool.h \
266             $(INCDIR)/checking.h \
267             $(INCDIR)/clabstract.h \
268             $(INCDIR)/claimNode.h \
269             $(INCDIR)/clause.h \
270             $(INCDIR)/clauseStack.h \
271             $(INCDIR)/code.h \
272             $(INCDIR)/constants.h \
273             $(INCDIR)/constDeclarationNode.h \
274             $(INCDIR)/constraintExprData.h \
275             $(INCDIR)/constraintExpr.h \
276             $(INCDIR)/constraint.h \
277             $(INCDIR)/constraintList.h \
278             $(INCDIR)/constraintOutput.h \
279             $(INCDIR)/constraintResolve.h \
280             $(INCDIR)/constraintTerm.h \
281             $(INCDIR)/context.h \
282             $(INCDIR)/cppconf.h \
283             $(INCDIR)/cpperror.h \
284             $(INCDIR)/cppexp.h \
285             $(INCDIR)/cpp.h \
286             $(INCDIR)/cpphash.h \
287             $(INCDIR)/cpplib.h \
288             $(INCDIR)/cprim.h \
289             $(INCDIR)/cscanner.h \
290             $(INCDIR)/cscannerHelp.h \
291             $(INCDIR)/cstring.h \
292             $(INCDIR)/cstringHash.h \
293             $(INCDIR)/cstringList.h \
294             $(INCDIR)/cstringSList.h \
295             $(INCDIR)/cstringTable.h \
296             $(INCDIR)/ctypeList.h \
297             $(INCDIR)/CTypesNode.h \
298             $(INCDIR)/declaratorInvNode.h \
299             $(INCDIR)/declaratorInvNodeList.h \
300             $(INCDIR)/declaratorNode.h \
301             $(INCDIR)/declaratorNodeList.h \
302             $(INCDIR)/ekind.h \
303             $(INCDIR)/enumNameList.h \
304             $(INCDIR)/enumNameSList.h \
305             $(INCDIR)/enumSpecNode.h \
306             $(INCDIR)/exportNode.h \
307             $(INCDIR)/exposedNode.h \
308             $(INCDIR)/exprChecks.h \
309             $(INCDIR)/exprData.h \
310             $(INCDIR)/exprNode.h \
311             $(INCDIR)/exprNodeList.h \
312             $(INCDIR)/exprNodeSList.h \
313             $(INCDIR)/fcnNode.h \
314             $(INCDIR)/fcnNodeList.h \
315             $(INCDIR)/fileId.h \
316             $(INCDIR)/fileIdList.h \
317             $(INCDIR)/fileLib.h \
318             $(INCDIR)/fileloc.h \
319             $(INCDIR)/filelocList.h \
320             $(INCDIR)/filelocStack.h \
321             $(INCDIR)/fileTable.h \
322             $(INCDIR)/flagMarker.h \
323             $(INCDIR)/flagMarkerList.h \
324             $(INCDIR)/flags.h \
325             $(INCDIR)/flagSpec.h \
326             $(INCDIR)/forwardTypes.h \
327             $(INCDIR)/functionClause.h \
328             $(INCDIR)/functionClauseList.h \
329             $(INCDIR)/functionConstraint.h \
330             $(INCDIR)/general.h \
331             $(INCDIR)/genericTable.h \
332             $(INCDIR)/globalList.h \
333             $(INCDIR)/globalsClause.h \
334             $(INCDIR)/globals.h \
335             $(INCDIR)/globSet.h \
336             $(INCDIR)/guardSet.h \
337             $(INCDIR)/help.h \
338             $(INCDIR)/idDecl.h \
339             $(INCDIR)/idDeclList.h \
340             $(INCDIR)/importNode.h \
341             $(INCDIR)/importNodeList.h \
342             $(INCDIR)/imports.h \
343             $(INCDIR)/initDeclNode.h \
344             $(INCDIR)/initDeclNodeList.h \
345             $(INCDIR)/inputStream.h \
346             $(INCDIR)/interfaceNode.h \
347             $(INCDIR)/interfaceNodeList.h \
348             $(INCDIR)/intSet.h \
349             $(INCDIR)/iterNode.h \
350             $(INCDIR)/lcl_constants.h \
351             $(INCDIR)/lclctypes.h \
352             $(INCDIR)/lclForwardTypes.h \
353             $(INCDIR)/lclinit.h \
354             $(INCDIR)/library.h \
355             $(INCDIR)/lclMisc.h \
356             $(INCDIR)/lclPredicateNode.h \
357             $(INCDIR)/lclscan.h \
358             $(INCDIR)/lclscanline.h \
359             $(INCDIR)/lclsyntable.h \
360             $(INCDIR)/lcltokentable.h \
361             $(INCDIR)/lclTypeSpecNode.h \
362             $(INCDIR)/lctype.h \
363             $(INCDIR)/letDeclNode.h \
364             $(INCDIR)/letDeclNodeList.h \
365             $(INCDIR)/lh.h \
366             $(INCDIR)/llerror.h \
367             $(INCDIR)/llglobals.h \
368             $(INCDIR)/llmain.h \
369             $(INCDIR)/lltok.h \
370             $(INCDIR)/lslinit.h \
371             $(INCDIR)/lslOp.h \
372             $(INCDIR)/lslOpList.h \
373             $(INCDIR)/lslOpSet.h \
374             $(INCDIR)/lslparse.h \
375             $(INCDIR)/lslscan.h \
376             $(INCDIR)/lslscanline.h \
377             $(INCDIR)/lslsyntable.h \
378             $(INCDIR)/lsltokentable.h \
379             $(INCDIR)/lsymbol.h \
380             $(INCDIR)/lsymbolList.h \
381             $(INCDIR)/lsymbolSet.h \
382             $(INCDIR)/ltoken.h \
383             $(INCDIR)/ltokenList.h \
384             $(INCDIR)/macrocache.h \
385             $(INCDIR)/mapping.h \
386             $(INCDIR)/message.h \
387             $(INCDIR)/messageLog.h \
388             $(INCDIR)/metaStateConstraint.h \
389             $(INCDIR)/metaStateConstraintList.h \
390             $(INCDIR)/metaStateExpression.h \
391             $(INCDIR)/metaStateInfo.h \
392             $(INCDIR)/metaStateSpecifier.h \
393             $(INCDIR)/metaStateTable.h \
394             $(INCDIR)/misc.h \
395             $(INCDIR)/modifiesClause.h \
396             $(INCDIR)/modifyNode.h \
397             $(INCDIR)/mstring.h \
398             $(INCDIR)/mtAnnotationDecl.h \
399             $(INCDIR)/mtAnnotationList.h \
400             $(INCDIR)/mtAnnotationsNode.h \
401             $(INCDIR)/mtContextNode.h \
402             $(INCDIR)/mtDeclarationNode.h \
403             $(INCDIR)/mtDeclarationPiece.h \
404             $(INCDIR)/mtDeclarationPieces.h \
405             $(INCDIR)/mtDefaultsDecl.h \
406             $(INCDIR)/mtDefaultsDeclList.h \
407             $(INCDIR)/mtDefaultsNode.h \
408             $(INCDIR)/mtincludes.h \
409             $(INCDIR)/mtLoseReference.h \
410             $(INCDIR)/mtLoseReferenceList.h \
411             $(INCDIR)/mtMergeClause.h \
412             $(INCDIR)/mtMergeClauseList.h \
413             $(INCDIR)/mtMergeItem.h \
414             $(INCDIR)/mtMergeNode.h \
415             $(INCDIR)/mtreader.h \
416             $(INCDIR)/mtscanner.h \
417             $(INCDIR)/mttok.h \
418             $(INCDIR)/mtTransferAction.h \
419             $(INCDIR)/mtTransferClause.h \
420             $(INCDIR)/mtTransferClauseList.h \
421             $(INCDIR)/mtValuesNode.h \
422             $(INCDIR)/multiVal.h \
423             $(INCDIR)/nameChecks.h \
424             $(INCDIR)/nameNode.h \
425             $(INCDIR)/opFormNode.h \
426             $(INCDIR)/osd.h \
427             $(INCDIR)/pairNode.h \
428             $(INCDIR)/pairNodeList.h \
429             $(INCDIR)/paramNode.h \
430             $(INCDIR)/paramNodeList.h \
431             $(INCDIR)/pointers.h \
432             $(INCDIR)/privateNode.h \
433             $(INCDIR)/programNode.h \
434             $(INCDIR)/programNodeList.h \
435             $(INCDIR)/qtype.h \
436             $(INCDIR)/qual.h \
437             $(INCDIR)/qualList.h \
438             $(INCDIR)/quantifiedTermNode.h \
439             $(INCDIR)/quantifierNode.h \
440             $(INCDIR)/quantifierNodeList.h \
441             $(INCDIR)/rcfiles.h \
442             $(INCDIR)/reader.h \
443             $(INCDIR)/renamingNode.h \
444             $(INCDIR)/replaceNode.h \
445             $(INCDIR)/replaceNodeList.h \
446             $(INCDIR)/shift.h \
447             $(INCDIR)/signNode.h \
448             $(INCDIR)/sigNode.h \
449             $(INCDIR)/sigNodeSet.h \
450             $(INCDIR)/sort.h \
451             $(INCDIR)/sortList.h \
452             $(INCDIR)/sortSet.h \
453             $(INCDIR)/sortSetList.h \
454             $(INCDIR)/sRef.h \
455             $(INCDIR)/sRefSet.h \
456             $(INCDIR)/sRefSetList.h \
457             $(INCDIR)/sRefTable.h \
458             $(INCDIR)/stateClause.h \
459             $(INCDIR)/stateClauseList.h \
460             $(INCDIR)/stateCombinationTable.h \
461             $(INCDIR)/stateInfo.h \
462             $(INCDIR)/stateValue.h \
463             $(INCDIR)/stDeclNode.h \
464             $(INCDIR)/stDeclNodeList.h \
465             $(INCDIR)/stmtNode.h \
466             $(INCDIR)/storeRefNode.h \
467             $(INCDIR)/storeRefNodeList.h \
468             $(INCDIR)/strOrUnionNode.h \
469             $(INCDIR)/structNames.h \
470             $(INCDIR)/symtable.h \
471             $(INCDIR)/system_constants.h \
472             $(INCDIR)/taggedUnionNode.h \
473             $(INCDIR)/termNode.h \
474             $(INCDIR)/termNodeList.h \
475             $(INCDIR)/traitRefNode.h \
476             $(INCDIR)/traitRefNodeList.h \
477             $(INCDIR)/transferChecks.h \
478             $(INCDIR)/typeExpr.h \
479             $(INCDIR)/typeId.h \
480             $(INCDIR)/typeIdSet.h \
481             $(INCDIR)/typeNameNode.h \
482             $(INCDIR)/typeNameNodeList.h \
483             $(INCDIR)/typeNamePack.h \
484             $(INCDIR)/typeNode.h \
485             $(INCDIR)/uentry.h \
486             $(INCDIR)/uentryList.h \
487             $(INCDIR)/usymId.h \
488             $(INCDIR)/usymIdSet.h \
489             $(INCDIR)/usymtab.h \
490             $(INCDIR)/usymtab_interface.h \
491             $(INCDIR)/valueTable.h \
492             $(INCDIR)/varDeclarationNode.h \
493             $(INCDIR)/varDeclarationNodeList.h \
494             $(INCDIR)/varKinds.h \
495             $(INCDIR)/varNode.h \
496             $(INCDIR)/varNodeList.h \
497             $(INCDIR)/libversion.h \
498             $(INCDIR)/warnClause.h \
499             $(INCDIR)/ynm.h
501 splint_SOURCES =  $(COMMONSRC) $(GRAMSRC) $(HEADERSRC)
503 dist_bin_SCRIPTS = genflagcodes
505 ## Sources that need to be built.
506 ## Automake knows how to handle yacc generated C files, but for C headers
507 ## it needs to have these added explicitly for correct dependency tracking.
508 BUILT_SOURCES = \
509                 $(srcdir)/cgrammar.h \
510                 $(srcdir)/mtgrammar.h \
511                 $(srcdir)/llgrammar.h \
512                 $(srcdir)/lslgrammar.h \
513                 $(srcdir)/flag_codes.h
515 IFILES = \
516          ctbase.i \
517          cttable.i
519 EXTRAGRAMMARFILES = bison.head bison.reset flex.head flex.reset
521 EXTRA_DIST = \
522              flags.def \
523              $(srcdir)/flag_codes.h \
524              $(srcdir)/reservedNames.c \
525              $(INCDIR)/splintMacros.nf \
526              $(EXTRAGRAMMARFILES) \
527              $(IFILES) \
528              .splintrc \
529              LICENSE
532 ## Hand-generated 
533 $(srcdir)/flag_codes.h: flags.def genflagcodes
534         @if $(AM_V_P); then set -x; else echo "  GEN      " $(notdir $@); fi; \
535                 $(srcdir)/genflagcodes "$<" "$@.temp"; \
536                 if test $$? -eq 0; then \
537                         if test -f "$@" && cmp -s "$@" "$@.temp"; then \
538                                 echo $(notdir $@) "is unchanged"; \
539                                 rm -f "$@.temp"; \
540                         else \
541                                 echo "updating" $(notdir $@); \
542                                 mv -f "$@.temp" "$@"; \
543                         fi; \
544                 else \
545                         exit 1; \
546                 fi;
549 ##############
550 # Self-check #
551 ##############
553 # files to run Splint on; some scanners are hand-written and shouldn't
554 # cause (much) problems; lex/yacc generated files don't play nice and
555 # thus need some pampering (with some prefixing/suffixing).
557 # TODO: these files have been disactivated for some time; I (mg) might
558 # have removed some of the inclusion of these head/reset files from the
559 # source *.{l,y} files.
560 CHK_GRAMSRC = $(HAND_SCANNERS)
562 ## original used LFLAGS=-L to suppress #line from output
563 # LFLAGS = -L
564 # chk_cscanner.c: cscanner.c
565 #       $(CAT) flex.head $< flex.reset > $@
567 # CHK_GRAMSRC += chk_cscanner.c
568 # EXTRA_DIST += flex.head flex.reset
570 # chk_lslgrammar.c: lslgrammar.c
571 #       $(CAT) bison.head $< bison.reset > $@
572 # chk_lslgrammar.h: lslgrammar.h
573 #       $(CAT) bison.head $< bison.reset > $@
574 # CHK_GRAMSRC += chk_lslgrammar.c
576 # chk_llgrammar.c: llgrammar.c
577 #       $(CAT) bison.head $< bison.reset > $@
578 # chk_llgrammar.h: llgrammar.h
579 #       $(CAT) bison.head $< bison.reset > $@
580 # CHK_GRAMSRC += chk_llgrammar.c
582 # chk_mtgrammar.c: mtgrammar.c
583 #       $(CAT) bison.head $< bison.reset > $@
584 # chk_mtgrammar.h: mtgrammar.h
585 #       $(CAT) bison.head $< bison.reset > $@
586 # CHK_GRAMSRC += chk_mtgrammar.c
588 # chk_cgrammar.c: cgrammar.c
589 #       $(CAT) bison.head $< bison.reset > $@
590 # chk_cgrammar.h: cgrammar.h
591 #       $(CAT) bison.head $< bison.reset > $@
592 # CHK_GRAMSRC += chk_cgrammar.c
594 # EXTRA_DIST += bison.head bison.reset
596 LINTSRC = $(COMMONSRC) $(CHK_GRAMSRC)
598 # Define INTERCEPT environment variable before calling make to interpose some
599 # other program before splint, e.g. 
600 # INTERCEPT = valgrind -v --leak-resolution=high --num-callers=20 \
601 #       --show-reachable=no --leak-check=yes
603 RUNSPLINT = $(INTERCEPT) $(builddir)/splint \
604          -mts file -mts filerw -mts tainted \
605          +singleinclude +forcehints +showsourceloc \
606          -misplacedsharequal -fcnuse -incondefs -exportlocal -constuse \
607          $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)
609 .PHONY: splintme
610 splintme: 
611         $(RUNSPLINT) -dump splint $(LINTSRC)
613 .PHONY: splintme-bounds
614 splintme-bounds: 
615         $(RUNSPLINT) -dump splint +bounds +impboundsconstraints $(LINTSRC)
617 .PHONY: splintme-supcounts
618 splintme-supcounts: 
619         $(RUNSPLINT) -dump splint -unrecogcomments -supcounts $(LINTSRC)
621 .PHONY: splintme-bufchk
622 splintme-bufchk: 
623         $(RUNSPLINT) -dump splint -unrecogcomments -supcounts +bounds -DLINTBUFFERCHECK $(LINTSRC) 
625 # Example of a partial (one file) analysis
626 .PHONY: splintme-some
627 splintme-some: 
628         $(RUNSPLINT) -load splint -unrecogcomments -supcounts +partial library.c