diff --git a/scripts/mk_util.py b/scripts/mk_util.py index dff9051e8..c762d518e 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -1578,20 +1578,22 @@ class CppExampleComponent(ExampleComponent): def mk_makefile(self, out): dll_name = get_component(Z3_DLL_COMPONENT).dll_name dll = '%s$(SO_EXT)' % dll_name + + objfiles = '' + for cppfile in self.src_files(): + objfile = '%s$(OBJ_EXT)' % (cppfile[:cppfile.rfind('.')]) + objfiles = objfiles + ('%s ' % objfile) + out.write('%s: %s\n' % (objfile, os.path.join(self.to_ex_dir, cppfile))); + out.write('\t%s $(CXXFLAGS) $(OS_DEFINES) $(EXAMP_DEBUG_FLAG) $(CXX_OUT_FLAG)%s $(LINK_FLAGS)' % (self.compiler(), objfile)) + # Add include dir components + out.write(' -I%s' % get_component(API_COMPONENT).to_src_dir) + out.write(' -I%s' % get_component(CPP_COMPONENT).to_src_dir) + out.write(' %s' % cppfile) + out.write('\n') + exefile = '%s$(EXE_EXT)' % self.name - out.write('%s: %s' % (exefile, dll)) - for cppfile in self.src_files(): - out.write(' ') - out.write(os.path.join(self.to_ex_dir, cppfile)) - out.write('\n') - out.write('\t%s $(OS_DEFINES) $(EXAMP_DEBUG_FLAG) $(LINK_OUT_FLAG)%s $(LINK_FLAGS)' % (self.compiler(), exefile)) - # Add include dir components - out.write(' -I%s' % get_component(API_COMPONENT).to_src_dir) - out.write(' -I%s' % get_component(CPP_COMPONENT).to_src_dir) - for cppfile in self.src_files(): - out.write(' ') - out.write(os.path.join(self.to_ex_dir, cppfile)) - out.write(' ') + out.write('%s: %s %s\n' % (exefile, dll, objfiles)) + out.write('\t$(LINK) $(LINK_OUT_FLAG)%s $(LINK_FLAGS) %s ' % (exefile, objfiles)) if IS_WINDOWS: out.write('%s.lib' % dll_name) else: