Mercurial > hg > truffle
comparison make/solaris/makefiles/adlc.make @ 475:284d0af00d53
6771309: debugging AD files is difficult without #line directives in generated code
Summary: more and better #line and #define directives in the generated code; ADLC itself accepts #line directives
Reviewed-by: never, kvn
author | jrose |
---|---|
date | Tue, 09 Dec 2008 12:41:26 -0800 |
parents | d1605aabd0a1 |
children | 0fbdb4381b99 dbbe28fc66b5 |
comparison
equal
deleted
inserted
replaced
474:7a018855d2f0 | 475:284d0af00d53 |
---|---|
52 | 52 |
53 # set INCLUDES for C preprocessor | 53 # set INCLUDES for C preprocessor |
54 Src_Dirs_I = ${Src_Dirs} $(GENERATED) | 54 Src_Dirs_I = ${Src_Dirs} $(GENERATED) |
55 INCLUDES += $(Src_Dirs_I:%=-I%) | 55 INCLUDES += $(Src_Dirs_I:%=-I%) |
56 | 56 |
57 # set flags for adlc compilation | |
58 CPPFLAGS = $(SYSDEFS) $(INCLUDES) | |
59 | |
57 # Force assertions on. | 60 # Force assertions on. |
58 SYSDEFS += -DASSERT | 61 CPPFLAGS += -DASSERT |
59 CPPFLAGS = $(SYSDEFS) $(INCLUDES) | |
60 | 62 |
61 ifndef USE_GCC | 63 ifndef USE_GCC |
62 # We need libCstd.so for adlc | 64 # We need libCstd.so for adlc |
63 CFLAGS += -library=Cstd -g | 65 CFLAGS += -library=Cstd -g |
64 LFLAGS += -library=Cstd -g | 66 LFLAGS += -library=Cstd -g |
139 | 141 |
140 # Get a unique temporary directory name, so multiple makes can run in parallel. | 142 # Get a unique temporary directory name, so multiple makes can run in parallel. |
141 # Note that product files are updated via "mv", which is atomic. | 143 # Note that product files are updated via "mv", which is atomic. |
142 TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) | 144 TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) |
143 | 145 |
144 ADLCFLAGS = -q -T | 146 # Pass -D flags into ADLC. |
147 ADLCFLAGS += $(SYSDEFS) | |
148 | |
149 # Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO. | |
150 ADLCFLAGS += -q -T | |
151 | |
152 # Normally, debugging is done directly on the ad_<arch>*.cpp files. | |
153 # But -g will put #line directives in those files pointing back to <arch>.ad. | |
154 #ADLCFLAGS += -g | |
145 | 155 |
146 ifdef LP64 | 156 ifdef LP64 |
147 ADLCFLAGS += -D_LP64 | 157 ADLCFLAGS += -D_LP64 |
148 else | 158 else |
149 ADLCFLAGS += -U_LP64 | 159 ADLCFLAGS += -U_LP64 |
154 # used to selectively update generated adlc files. This should | 164 # used to selectively update generated adlc files. This should |
155 # provide a nice compilation speed improvement. | 165 # provide a nice compilation speed improvement. |
156 # | 166 # |
157 ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS) | 167 ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS) |
158 ADLC_UPDATER = adlc_updater | 168 ADLC_UPDATER = adlc_updater |
169 $(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) | |
170 $(QUIETLY) cp $< $@; chmod +x $@ | |
159 | 171 |
160 # This action refreshes all generated adlc files simultaneously. | 172 # This action refreshes all generated adlc files simultaneously. |
161 # The way it works is this: | 173 # The way it works is this: |
162 # 1) create a scratch directory to work in. | 174 # 1) create a scratch directory to work in. |
163 # 2) if the current working directory does not have $(ADLC_UPDATER), copy it. | 175 # 2) if the current working directory does not have $(ADLC_UPDATER), copy it. |
164 # 3) run the compiled adlc executable. This will create new adlc files in the scratch directory. | 176 # 3) run the compiled adlc executable. This will create new adlc files in the scratch directory. |
165 # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files. | 177 # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files. |
166 # 5) If we actually updated any files, echo a notice. | 178 # 5) If we actually updated any files, echo a notice. |
167 # | 179 # |
168 refresh_adfiles: $(EXEC) $(SOURCE.AD) | 180 refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) |
169 @rm -rf $(TEMPDIR); mkdir $(TEMPDIR) | 181 @rm -rf $(TEMPDIR); mkdir $(TEMPDIR) |
170 $(QUIETLY) [ -f $(ADLC_UPDATER) ] || ( cp $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) . ; chmod +x $(ADLC_UPDATER) ) | |
171 $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \ | 182 $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \ |
172 -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \ | 183 -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \ |
173 || { rm -rf $(TEMPDIR); exit 1; } | 184 || { rm -rf $(TEMPDIR); exit 1; } |
174 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) | 185 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) |
175 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) | 186 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) |
188 | 199 |
189 | 200 |
190 # ######################################################################### | 201 # ######################################################################### |
191 | 202 |
192 $(SOURCE.AD): $(SOURCES.AD) | 203 $(SOURCE.AD): $(SOURCES.AD) |
193 $(QUIETLY) cat $(SOURCES.AD) > $(SOURCE.AD) | 204 $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD) |
205 | |
206 #PROCESS_AD_FILES = cat | |
207 # Pass through #line directives, in case user enables -g option above: | |
208 PROCESS_AD_FILES = awk '{ \ | |
209 if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \ | |
210 if (need_lineno && $$0 !~ /\/\//) \ | |
211 { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \ | |
212 print }' | |
194 | 213 |
195 $(OUTDIR)/%.o: %.cpp | 214 $(OUTDIR)/%.o: %.cpp |
196 @echo Compiling $< | 215 @echo Compiling $< |
197 $(QUIETLY) $(REMOVE_TARGET) | 216 $(QUIETLY) $(REMOVE_TARGET) |
198 $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE) | 217 $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE) |