Skip to content

Commit 47a3a15

Browse files
committed
Include CSRCFLAG in file command and language in pipe command.
1 parent e90b583 commit 47a3a15

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/truffle/rbconfig-for-mkmf.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,21 @@
136136
end
137137

138138
for_file = proc do |compiler, flags, opt_command|
139-
"#{compiler} #{flags} $< && #{opt_command}"
139+
"#{compiler} #{flags} $(CSRCFLAG)$< && #{opt_command}"
140140
end
141141

142142
for_pipe = proc do |compiler, flags, opt_command|
143-
"#{preprocess_ruby} #{cext_dir}/preprocess.rb $< | #{compiler} -I$(<D) #{flags}&& #{opt_command}"
143+
language_flag = if ('$(CXX)' == compiler)
144+
'-xc++'
145+
else
146+
'-xc'
147+
end
148+
149+
"#{preprocess_ruby} #{cext_dir}/preprocess.rb $< | #{compiler} -I$(<D) #{flags} #{language_flag} - && #{opt_command}"
144150
end
145151

146-
c_flags = '$(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -xc'
147-
cxx_flags = '$(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -xc++'
152+
c_flags = '$(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@'
153+
cxx_flags = '$(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@'
148154
opt_command = "#{opt} #{opt_passes} $@ -o $@"
149155

150156
mkconfig['TRUFFLE_RAW_COMPILE_C'] = for_file.call('$(CC)', c_flags, opt_command)

0 commit comments

Comments
 (0)