]>
Commit | Line | Data |
---|---|---|
8fe44445 | 1 | ## Note: starting comments with ## means they don't end up in Makefile |
2 | ||
3 | AUTOMAKE_OPTIONS = 1.5 foreign | |
4 | ||
5 | SUFFIXES = .h .c .o .l .check | |
6 | ||
7 | # Check files before compiling; requires lclint! | |
8 | CHECK = 1 | |
9 | ||
10 | # Some preferences | |
11 | YFLAGS = -v -t -d --debug | |
12 | ||
13 | ## Non-built files we need to distribute | |
14 | EXTRA_DIST = DATE | |
15 | ||
16 | ## We only build LCLint | |
17 | bin_PROGRAMS = lclint | |
18 | ||
19 | ## This is a fake program, so we can easily substitute in the extra LCL objects | |
20 | EXTRA_PROGRAMS = lcl | |
21 | ||
22 | AM_CPPFLAGS = -IHeaders | |
23 | ||
24 | ## The main sources | |
25 | ||
26 | SETSRC = globSet.c intSet.c typeIdSet.c guardSet.c usymIdSet.c sRefSet.c | |
27 | ||
28 | LISTSRC = clauseStack.c filelocStack.c \ | |
29 | cstringList.c cstringSList.c sRefSetList.c ctypeList.c \ | |
30 | enumNameList.c enumNameSList.c exprNodeList.c exprNodeSList.c \ | |
31 | uentryList.c fileIdList.c filelocList.c qualList.c sRefList.c \ | |
32 | flagMarkerList.c idDeclList.c flagSpec.c | |
33 | ||
34 | CPPSRC = cppmain.c cpplib.c cppexp.c cpphash.c cpperror.c | |
35 | ||
36 | CSRC = uentry.c cprim.c macrocache.c qual.c qtype.c stateClause.c \ | |
37 | stateClauseList.c ctype.c cvar.c clabstract.c idDecl.c clause.c \ | |
38 | globalsClause.c modifiesClause.c warnClause.c functionClause.c \ | |
39 | functionClauseList.c metaStateConstraint.c metaStateConstraintList.c \ | |
40 | metaStateExpression.c metaStateSpecifier.c functionConstraint.c | |
41 | ||
42 | LCLINTSRC = exprNode.c exprChecks.c llmain.c | |
43 | CHECKSRC = structNames.c transferChecks.c varKinds.c nameChecks.c | |
44 | ||
45 | GLOBSRC = context.c globals.c flags.c general.c osd.c reader.c | |
46 | ||
47 | GRAMSRC = cgrammar.c cscanner.c mtscanner.c mtreader.c mtgrammar.c | |
48 | ||
49 | OVERFLOWCHSRC = constraintGeneration.c constraintTerm.c \ | |
50 | constraintExprData.c constraintExpr.c constraint.c \ | |
51 | constraintList.c constraintResolve.c \ | |
52 | constraintOutput.c loopHeuristics.c | |
53 | ||
54 | GENERALSRC = exprData.c cstring.c fileloc.c message.c inputStream.c \ | |
55 | fileTable.c cstringTable.c valueTable.c stateValue.c \ | |
56 | llerror.c messageLog.c flagMarker.c aliasTable.c ynm.c \ | |
57 | sRefTable.c genericTable.c ekind.c usymtab.c multiVal.c \ | |
58 | lltok.c sRef.c lcllib.c randomNumbers.c fileLib.c | |
59 | ||
60 | METASTATESRC = stateInfo.c stateCombinationTable.c metaStateTable.c \ | |
61 | metaStateInfo.c annotationTable.c annotationInfo.c mttok.c \ | |
62 | mtDeclarationNode.c mtDeclarationPieces.c mtDeclarationPiece.c \ | |
63 | mtContextNode.c mtValuesNode.c mtDefaultsNode.c \ | |
64 | mtAnnotationsNode.c mtMergeNode.c mtAnnotationList.c \ | |
65 | mtAnnotationDecl.c mtTransferClauseList.c mtTransferClause.c \ | |
66 | mtTransferAction.c mtLoseReferenceList.c mtLoseReference.c \ | |
67 | mtDefaultsDeclList.c mtDefaultsDecl.c mtMergeItem.c \ | |
68 | mtMergeClause.c mtMergeClauseList.c | |
69 | ||
70 | ## These are only used if LCL is enabled | |
71 | ||
72 | LCLONLYSRC = usymtab_interface.c abstract.c ltoken.c lclscanline.c \ | |
73 | lclsyntable.c lcltokentable.c sort.c symtable.c lclinit.c \ | |
74 | shift.c lclscan.c lsymbol.c mapping.c | |
75 | ||
76 | LSLSRC = tokentable.c scan.c scanline.c lslparse.c \ | |
77 | lh.c checking.c lclctypes.c imports.c lslinit.c syntable.c | |
78 | ||
79 | LCLGRAMSRC = llgrammar.c signature.c | |
80 | ||
81 | LCLSETSRC = lsymbolSet.c sigNodeSet.c lslOpSet.c sortSet.c | |
82 | ||
83 | LCLLISTSRC = initDeclNodeList.c sortList.c declaratorInvNodeList.c \ | |
84 | interfaceNodeList.c sortSetList.c declaratorNodeList.c \ | |
85 | letDeclNodeList.c stDeclNodeList.c storeRefNodeList.c \ | |
86 | lslOpList.c lsymbolList.c termNodeList.c ltokenList.c \ | |
87 | traitRefNodeList.c pairNodeList.c typeNameNodeList.c \ | |
88 | fcnNodeList.c paramNodeList.c programNodeList.c \ | |
89 | varDeclarationNodeList.c varNodeList.c quantifierNodeList.c \ | |
90 | replaceNodeList.c importNodeList.c | |
91 | ||
92 | COMMONSRC = $(OVERFLOWCHSRC) $(CPPSRC) $(CSRC) $(CHECKSRC) $(GENERALSRC) \ | |
93 | $(GLOBSRC) $(IFACESRC) $(LISTSRC) $(SETSRC) $(METASTATESRC) | |
94 | ||
95 | ALLSRC = $(GRAMSRC) $(COMMONSRC) $(LCLINTSRC) | |
96 | ||
97 | LCLSRC = $(LCLSETSRC) $(LCLLISTSRC) $(LSLSRC) $(CMNSRC) $(LCLONLYSRC) \ | |
98 | $(LCLGRAMSRC) | |
99 | ||
100 | lcl_SOURCES = $(LCLSRC) | |
101 | ||
102 | lclint_SOURCES = $(ALLSRC) | |
103 | lclint_LDADD = $(LCLOBJ) @LEXLIB@ | |
104 | ||
105 | # Ensure the LCL objects get built if needed | |
106 | lclint_DEPENDENCIES = $(LCLOBJ) | |
107 | ||
108 | # Keep it fake | |
109 | .PHONY: lcl$(EXEEXT) | |
110 | lcl$(EXEEXT): | |
111 | @echo "This is a fake target"; \ | |
112 | echo "Use configure's --with-lcl option to enable lcl" | |
113 | ||
114 | ## Sources that need to be built | |
115 | BUILT_SOURCES = Headers/signature_gen.h Headers/cgrammar_tokens.h \ | |
116 | Headers/llgrammar_gen.h Headers/llgrammar_gen2.h \ | |
117 | Headers/mtgrammar_tokens.h signature.c cgrammar.c \ | |
118 | llgrammar.c mtgrammar.c Headers/flag_codes.gen | |
119 | ||
120 | ## Grammars | |
121 | ||
122 | Headers/signature_gen.h signature.c: signature.c.der signature.y | |
123 | if test x$(BISON) = xno; then \ | |
124 | $(CP) signature.c.der signature.c; \ | |
125 | else \ | |
126 | $(BISON) $(YFLAGS) -p lsl signature.y; \ | |
127 | $(CAT) bison.head signature.tab.c bison.reset >signature.c; \ | |
128 | $(MV) Headers/signature_gen.h Headers/signature_gen.bak; \ | |
129 | $(CAT) bison.head signature.tab.h bison.reset >Headers/signature_gen.h; \ | |
130 | $(RM) signature.tab.c signature.tab.h; \ | |
131 | fi | |
132 | ||
133 | Headers/cgrammar_tokens.h cgrammar.c: cgrammar.c.der cgrammar.y | |
134 | if test x$(BISON) = xno; then \ | |
135 | $(CP) cgrammar.c.der cgrammar.c; \ | |
136 | else \ | |
137 | echo '* Expect 141 shift/reduce conflicts and 111 reduce/reduce conflicts.'; \ | |
138 | echo '* (see cgrammar.y for explanation)'; \ | |
139 | $(BISON) $(YFLAGS) cgrammar.y; \ | |
140 | $(CAT) bison.head cgrammar.tab.c bison.reset >cgrammar.c; \ | |
141 | $(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak; \ | |
142 | $(CAT) bison.head cgrammar.tab.h bison.reset >Headers/cgrammar_tokens.h; \ | |
143 | $(RM) cgrammar.tab.c cgrammar.tab.h; \ | |
144 | fi | |
145 | ||
146 | Headers/mtgrammar_tokens.h mtgrammar.c: mtgrammar.c.der mtgrammar.y | |
147 | if test x$(BISON) = xno; then \ | |
148 | $(CP) mtgrammar.c.der mtgrammar.c; \ | |
149 | else \ | |
150 | $(BISON) $(YFLAGS) -p mt mtgrammar.y; \ | |
151 | $(CAT) bison.head mtgrammar.tab.c bison.reset >mtgrammar.c; \ | |
152 | $(MV) Headers/mtgrammar_tokens.h Headers/mtgrammar_tokens.bak; \ | |
153 | $(CAT) bison.head mtgrammar.tab.h bison.reset >Headers/mtgrammar_tokens.h; \ | |
154 | $(RM) mtgrammar.tab.c mtgrammar.tab.h; \ | |
155 | fi | |
156 | ||
157 | Headers/llgrammar_gen.h Headers/llgrammar_gen2.h llgrammar.c: llgrammar.c.der llgrammar.y | |
158 | if test x$(BISON) = xno; then \ | |
159 | $(CP) llgrammar.c.der llgrammar.c; \ | |
160 | else \ | |
161 | echo '* Expect 2 shift/reduce conflicts'; \ | |
162 | $(BISON) $(YFLAGS) -p yl llgrammar.y; \ | |
163 | $(CAT) bison.head llgrammar.tab.c bison.reset >llgrammar.c; \ | |
164 | $(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak; \ | |
165 | $(CAT) bison.head llgrammar.tab.h bison.reset >Headers/llgrammar_gen2.h; \ | |
166 | $(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak; \ | |
167 | $(CAT) bison.head llgrammar.tab.h bison.reset >Headers/llgrammar_gen.h; \ | |
168 | $(RM) llgrammar.tab.c llgrammar.tab.h; \ | |
169 | fi | |
170 | ||
171 | cscanner.c: cscanner.l | |
172 | $(LEX) $(LFLAGS) cscanner.l | |
173 | $(CAT) flex.head @LEX_OUTPUT_ROOT@.c flex.reset > cscanner.c | |
174 | ||
175 | Headers/flag_codes.gen: flags.def | |
176 | grep "FLG_" flags.def > Headers/flag_codes.gen | |
177 | ||
178 | ## Checking rules | |
179 | ||
180 | CHECKS = $(subst .c,.check,$(lclint_SOURCES)) | |
181 | ||
182 | ## Other rules | |
183 | ||
184 | .PHONY: nocheck | |
185 | nocheck: | |
186 | $(MAKE) CHECK=0 | |
187 | ||
188 | lintnew: | |
189 | ./lclint -f lclint.lclintrc $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(ALLSRC) $(LCLSRC) -dump lclint \ | |
190 | +forcehints -misplacedsharequal +showsourceloc -unrecogcomments \ | |
191 | -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw | |
192 | ||
193 | ||
194 | ||
195 | .PHONY: purify | |
196 | purify: $(lclint_OBJECTS) | |
197 | purify $(LINK) -o lclint$(EXEEXT) $^ $(lclint_LDADD) | |
198 | ||
199 | ## This ensures that lclint can be run from ../bin | |
200 | ## $(CP) was $(Ln_S) but that doesn't work for me... | |
201 | ||
202 | all: $(top_builddir)/bin/lclint$(EXEEXT) | |
203 | $(top_builddir)/bin/lclint$(EXEEXT): lclint$(EXEEXT) | |
204 | $(CP) $< $@ | |
205 | ||
206 | CLEANFILES = $(top_builddir)/bin/lclint$(EXEEXT) |