|
135 | 135 | Truffle::CExt::Preprocessor.makefile_matcher("#{preprocess_ruby} #{cext_dir}/preprocess.rb $< | #{command1}", command2)
|
136 | 136 | end
|
137 | 137 |
|
| 138 | + for_file = proc do |compiler, flags, opt_command| |
| 139 | + "#{compiler} #{flags} $< && #{opt_command}" |
| 140 | + end |
| 141 | + |
| 142 | + for_pipe = proc do |compiler, flags, opt_command| |
| 143 | + "#{compiler} -I$(<D) #{flags} - -o $@ && #{opt_command}" |
| 144 | + end |
| 145 | + |
| 146 | + c_flags = "$(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG) -xc" |
| 147 | + cxx_flags = "$(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG) -xc++" |
| 148 | + opt_command = "#{opt} #{opt_passes} $@ -o $@" |
| 149 | + |
138 | 150 | mkconfig['COMPILE_C'] = with_conditional_preprocessing.call(
|
139 |
| - "$(CC) -I$(<D) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG) -xc - -o $@ && #{opt} #{opt_passes} $@ -o $@", |
140 |
| - "$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG) -xc $(<) && #{opt} #{opt_passes} $@ -o $@") |
141 |
| - mkconfig['COMPILE_CXX'] = with_conditional_preprocessing.call( |
142 |
| - "$(CXX) -I$(<D) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG) -xc++ - -o $@ && #{opt} #{opt_passes} $@ -o $@", |
143 |
| - "$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG) -xc++ $(<) && #{opt} #{opt_passes} $@ -o $@") |
| 151 | + for_pipe.call("$(CC)", c_flags, opt_command), |
| 152 | + for_file.call("$(CC)", c_flags, opt_command)) |
| 153 | + |
| 154 | + mkconfig['COMPILE_CXX'] = with_conditional_preprocessing.call( |
| 155 | + for_pipe.call("$(CXX)", cxx_flags, opt_command), |
| 156 | + for_file.call("$(CXX)", cxx_flags, opt_command)) |
144 | 157 | end
|
145 | 158 |
|
146 | 159 | # From mkmf.rb: "$(CC) #{OUTFLAG}#{CONFTEST}#{$EXEEXT} $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
|
|
0 commit comments