mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 03:32:28 +00:00 
			
		
		
		
	cleaning mk_make
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
		
							parent
							
								
									fdb3e22560
								
							
						
					
					
						commit
						db6e20b2ea
					
				
					 1 changed files with 117 additions and 117 deletions
				
			
		|  | @ -447,7 +447,7 @@ def reverse_path(p): | ||||||
|     n = len(l) |     n = len(l) | ||||||
|     r = '..' |     r = '..' | ||||||
|     for i in range(1, n): |     for i in range(1, n): | ||||||
|         r = '%s/%s' % (r, '..') |         r = os.path.join(r, '..') | ||||||
|     return r |     return r | ||||||
| 
 | 
 | ||||||
| def mk_dir(d): | def mk_dir(d): | ||||||
|  | @ -461,7 +461,7 @@ def set_build_dir(d): | ||||||
| 
 | 
 | ||||||
| def set_z3py_dir(p): | def set_z3py_dir(p): | ||||||
|     global SRC_DIR, Z3PY_SRC_DIR |     global SRC_DIR, Z3PY_SRC_DIR | ||||||
|     full = '%s/%s' % (SRC_DIR, p) |     full = os.path.join(SRC_DIR, p) | ||||||
|     if not os.path.exists(full): |     if not os.path.exists(full): | ||||||
|         raise MKException("Python bindings directory '%s' does not exist" % full) |         raise MKException("Python bindings directory '%s' does not exist" % full) | ||||||
|     Z3PY_SRC_DIR = full |     Z3PY_SRC_DIR = full | ||||||
|  | @ -562,19 +562,19 @@ class Component: | ||||||
|         self.path = path |         self.path = path | ||||||
|         self.deps = find_all_deps(name, deps) |         self.deps = find_all_deps(name, deps) | ||||||
|         self.build_dir = path |         self.build_dir = path | ||||||
|         self.src_dir   = '%s/%s' % (SRC_DIR, path) |         self.src_dir   = os.path.join(SRC_DIR, path) | ||||||
|         self.to_src_dir = '%s/%s' % (REV_BUILD_DIR, self.src_dir) |         self.to_src_dir = os.path.join(REV_BUILD_DIR, self.src_dir) | ||||||
| 
 | 
 | ||||||
|     # Find fname in the include paths for the given component. |     # Find fname in the include paths for the given component. | ||||||
|     # ownerfile is only used for creating error messages. |     # ownerfile is only used for creating error messages. | ||||||
|     # That is, we were looking for fname when processing ownerfile |     # That is, we were looking for fname when processing ownerfile | ||||||
|     def find_file(self, fname, ownerfile): |     def find_file(self, fname, ownerfile): | ||||||
|         full_fname = '%s/%s' % (self.src_dir, fname) |         full_fname = os.path.join(self.src_dir, fname) | ||||||
|         if os.path.exists(full_fname): |         if os.path.exists(full_fname): | ||||||
|             return self |             return self | ||||||
|         for dep in self.deps: |         for dep in self.deps: | ||||||
|             c_dep = get_component(dep) |             c_dep = get_component(dep) | ||||||
|             full_fname = '%s/%s' % (c_dep.src_dir, fname) |             full_fname = os.path.join(c_dep.src_dir, fname) | ||||||
|             if os.path.exists(full_fname): |             if os.path.exists(full_fname): | ||||||
|                 return c_dep |                 return c_dep | ||||||
|         raise MKException("Failed to find include file '%s' for '%s' when processing '%s'." % (fname, ownerfile, self.name)) |         raise MKException("Failed to find include file '%s' for '%s' when processing '%s'." % (fname, ownerfile, self.name)) | ||||||
|  | @ -582,15 +582,15 @@ class Component: | ||||||
|     # Display all dependencies of file basename located in the given component directory. |     # Display all dependencies of file basename located in the given component directory. | ||||||
|     # The result is displayed at out |     # The result is displayed at out | ||||||
|     def add_cpp_h_deps(self, out, basename): |     def add_cpp_h_deps(self, out, basename): | ||||||
|         includes = extract_c_includes('%s/%s' % (self.src_dir, basename)) |         includes = extract_c_includes(os.path.join(self.src_dir, basename)) | ||||||
|         out.write('%s/%s' % (self.to_src_dir, basename)) |         out.write(os.path.join(self.to_src_dir, basename)) | ||||||
|         for include in includes: |         for include in includes: | ||||||
|             owner = self.find_file(include, basename) |             owner = self.find_file(include, basename) | ||||||
|             out.write(' %s/%s.node' % (owner.build_dir, include)) |             out.write(' %s.node' % os.path.join(owner.build_dir, include)) | ||||||
| 
 | 
 | ||||||
|     # Add a rule for each #include directive in the file basename located at the current component. |     # Add a rule for each #include directive in the file basename located at the current component. | ||||||
|     def add_rule_for_each_include(self, out, basename): |     def add_rule_for_each_include(self, out, basename): | ||||||
|         fullname = '%s/%s' % (self.src_dir, basename) |         fullname = os.path.join(self.src_dir, basename) | ||||||
|         includes = extract_c_includes(fullname) |         includes = extract_c_includes(fullname) | ||||||
|         for include in includes: |         for include in includes: | ||||||
|             owner = self.find_file(include, fullname) |             owner = self.find_file(include, fullname) | ||||||
|  | @ -602,12 +602,12 @@ class Component: | ||||||
|     #     ast/ast_pp.h.node : ../src/util/ast_pp.h util/util.h.node ast/ast.h.node |     #     ast/ast_pp.h.node : ../src/util/ast_pp.h util/util.h.node ast/ast.h.node | ||||||
|     #       @echo "done" > ast/ast_pp.h.node |     #       @echo "done" > ast/ast_pp.h.node | ||||||
|     def add_h_rule(self, out, include): |     def add_h_rule(self, out, include): | ||||||
|         include_src_path   = '%s/%s' % (self.to_src_dir, include) |         include_src_path   = os.path.join(self.to_src_dir, include) | ||||||
|         if include_src_path in _Processed_Headers: |         if include_src_path in _Processed_Headers: | ||||||
|             return |             return | ||||||
|         _Processed_Headers.add(include_src_path) |         _Processed_Headers.add(include_src_path) | ||||||
|         self.add_rule_for_each_include(out, include) |         self.add_rule_for_each_include(out, include) | ||||||
|         include_node = '%s/%s.node' % (self.build_dir, include) |         include_node = '%s.node' % os.path.join(self.build_dir, include) | ||||||
|         out.write('%s: ' % include_node) |         out.write('%s: ' % include_node) | ||||||
|         self.add_cpp_h_deps(out, include)               |         self.add_cpp_h_deps(out, include)               | ||||||
|         out.write('\n') |         out.write('\n') | ||||||
|  | @ -615,13 +615,13 @@ class Component: | ||||||
| 
 | 
 | ||||||
|     def add_cpp_rules(self, out, include_defs, cppfile): |     def add_cpp_rules(self, out, include_defs, cppfile): | ||||||
|         self.add_rule_for_each_include(out, cppfile) |         self.add_rule_for_each_include(out, cppfile) | ||||||
|         objfile = '%s/%s$(OBJ_EXT)' % (self.build_dir, os.path.splitext(cppfile)[0]) |         objfile = '%s$(OBJ_EXT)' % os.path.join(self.build_dir, os.path.splitext(cppfile)[0]) | ||||||
|         srcfile = '%s/%s' % (self.to_src_dir, cppfile) |         srcfile = os.path.join(self.to_src_dir, cppfile) | ||||||
|         out.write('%s: ' % objfile) |         out.write('%s: ' % objfile) | ||||||
|         self.add_cpp_h_deps(out, cppfile) |         self.add_cpp_h_deps(out, cppfile) | ||||||
|         out.write('\n') |         out.write('\n') | ||||||
|         if SHOW_CPPS: |         if SHOW_CPPS: | ||||||
|             out.write('\t@echo %s/%s\n' % (self.src_dir, cppfile)) |             out.write('\t@echo %s\n' % os.path.join(self.src_dir, cppfile)) | ||||||
|         out.write('\t@$(CXX) $(CXXFLAGS) $(%s) $(CXX_OUT_FLAG)%s %s\n' % (include_defs, objfile, srcfile)) |         out.write('\t@$(CXX) $(CXXFLAGS) $(%s) $(CXX_OUT_FLAG)%s %s\n' % (include_defs, objfile, srcfile)) | ||||||
| 
 | 
 | ||||||
|     def mk_makefile(self, out): |     def mk_makefile(self, out): | ||||||
|  | @ -630,7 +630,7 @@ class Component: | ||||||
|         for dep in self.deps: |         for dep in self.deps: | ||||||
|             out.write(' -I%s' % get_component(dep).to_src_dir) |             out.write(' -I%s' % get_component(dep).to_src_dir) | ||||||
|         out.write('\n') |         out.write('\n') | ||||||
|         mk_dir('%s/%s' % (BUILD_DIR, self.build_dir)) |         mk_dir(os.path.join(BUILD_DIR, self.build_dir)) | ||||||
|         for cppfile in get_cpp_files(self.src_dir): |         for cppfile in get_cpp_files(self.src_dir): | ||||||
|             self.add_cpp_rules(out, include_defs, cppfile) |             self.add_cpp_rules(out, include_defs, cppfile) | ||||||
| 
 | 
 | ||||||
|  | @ -679,10 +679,10 @@ class LibComponent(Component): | ||||||
|         # generate rule for lib |         # generate rule for lib | ||||||
|         objs = [] |         objs = [] | ||||||
|         for cppfile in get_cpp_files(self.src_dir): |         for cppfile in get_cpp_files(self.src_dir): | ||||||
|             objfile = '%s/%s$(OBJ_EXT)' % (self.build_dir, os.path.splitext(cppfile)[0]) |             objfile = '%s$(OBJ_EXT)' % os.path.join(self.build_dir, os.path.splitext(cppfile)[0]) | ||||||
|             objs.append(objfile) |             objs.append(objfile) | ||||||
| 
 | 
 | ||||||
|         libfile = '%s/%s$(LIB_EXT)' % (self.build_dir, self.name) |         libfile = '%s$(LIB_EXT)' % os.path.join(self.build_dir, self.name) | ||||||
|         out.write('%s:' % libfile) |         out.write('%s:' % libfile) | ||||||
|         for obj in objs: |         for obj in objs: | ||||||
|             out.write(' ') |             out.write(' ') | ||||||
|  | @ -697,17 +697,17 @@ class LibComponent(Component): | ||||||
| 
 | 
 | ||||||
|     def mk_install(self, out): |     def mk_install(self, out): | ||||||
|         for include in self.includes2install: |         for include in self.includes2install: | ||||||
|             out.write('\t@cp %s/%s $(PREFIX)/include/%s\n' % (self.to_src_dir, include, include)) |             out.write('\t@cp %s %s\n' % (os.path.join(self.to_src_dir, include), os.path.join('$(PREFIX)', 'include', include))) | ||||||
|      |      | ||||||
|     def mk_uninstall(self, out): |     def mk_uninstall(self, out): | ||||||
|         for include in self.includes2install: |         for include in self.includes2install: | ||||||
|             out.write('\t@rm -f $(PREFIX)/include/%s\n' % include) |             out.write('\t@rm -f %s\n' % os.path.join('$(PREFIX)', 'include', include)) | ||||||
| 
 | 
 | ||||||
|     def mk_win_dist(self, build_path, dist_path): |     def mk_win_dist(self, build_path, dist_path): | ||||||
|         mk_dir('%s/include' % dist_path) |         mk_dir(os.path.join(dist_path, 'include')) | ||||||
|         for include in self.includes2install: |         for include in self.includes2install: | ||||||
|             shutil.copy('%s/%s' % (self.src_dir, include), |             shutil.copy(os.path.join(self.src_dir, include), | ||||||
|                         '%s/include/%s' % (dist_path, include))         |                         os.path.join(dist_path, 'include', include))         | ||||||
| 
 | 
 | ||||||
| # "Library" containing only .h files. This is just a placeholder for includes files to be installed. | # "Library" containing only .h files. This is just a placeholder for includes files to be installed. | ||||||
| class HLibComponent(LibComponent): | class HLibComponent(LibComponent): | ||||||
|  | @ -744,14 +744,14 @@ class ExeComponent(Component): | ||||||
|         deps = sort_components(self.deps) |         deps = sort_components(self.deps) | ||||||
|         objs = [] |         objs = [] | ||||||
|         for cppfile in get_cpp_files(self.src_dir): |         for cppfile in get_cpp_files(self.src_dir): | ||||||
|             objfile = '%s/%s$(OBJ_EXT)' % (self.build_dir, os.path.splitext(cppfile)[0]) |             objfile = '%s$(OBJ_EXT)' % os.path.join(self.build_dir, os.path.splitext(cppfile)[0]) | ||||||
|             objs.append(objfile) |             objs.append(objfile) | ||||||
|         for obj in objs: |         for obj in objs: | ||||||
|             out.write(' ') |             out.write(' ') | ||||||
|             out.write(obj) |             out.write(obj) | ||||||
|         for dep in deps: |         for dep in deps: | ||||||
|             c_dep = get_component(dep) |             c_dep = get_component(dep) | ||||||
|             out.write(' %s/%s$(LIB_EXT)' % (c_dep.build_dir, c_dep.name)) |             out.write(' %s$(LIB_EXT)' % os.path.join(c_dep.build_dir, c_dep.name)) | ||||||
|         out.write('\n') |         out.write('\n') | ||||||
|         out.write('\t$(LINK) $(LINK_OUT_FLAG)%s $(LINK_FLAGS)' % exefile) |         out.write('\t$(LINK) $(LINK_OUT_FLAG)%s $(LINK_FLAGS)' % exefile) | ||||||
|         for obj in objs: |         for obj in objs: | ||||||
|  | @ -759,7 +759,7 @@ class ExeComponent(Component): | ||||||
|             out.write(obj) |             out.write(obj) | ||||||
|         for dep in deps: |         for dep in deps: | ||||||
|             c_dep = get_component(dep) |             c_dep = get_component(dep) | ||||||
|             out.write(' %s/%s$(LIB_EXT)' % (c_dep.build_dir, c_dep.name)) |             out.write(' %s$(LIB_EXT)' % os.path.join(c_dep.build_dir, c_dep.name)) | ||||||
|         out.write(' $(LINK_EXTRA_FLAGS)\n') |         out.write(' $(LINK_EXTRA_FLAGS)\n') | ||||||
|         out.write('%s: %s\n\n' % (self.name, exefile)) |         out.write('%s: %s\n\n' % (self.name, exefile)) | ||||||
| 
 | 
 | ||||||
|  | @ -776,17 +776,17 @@ class ExeComponent(Component): | ||||||
|     def mk_install(self, out): |     def mk_install(self, out): | ||||||
|         if self.install: |         if self.install: | ||||||
|             exefile = '%s$(EXE_EXT)' % self.exe_name |             exefile = '%s$(EXE_EXT)' % self.exe_name | ||||||
|             out.write('\t@cp %s $(PREFIX)/bin/%s\n' % (exefile, exefile)) |             out.write('\t@cp %s %s\n' % (exefile, os.path.join('$(PREFIX)', 'bin', exefile))) | ||||||
|      |      | ||||||
|     def mk_uninstall(self, out): |     def mk_uninstall(self, out): | ||||||
|         exefile = '%s$(EXE_EXT)' % self.exe_name |         exefile = '%s$(EXE_EXT)' % self.exe_name | ||||||
|         out.write('\t@rm -f $(PREFIX)/bin/%s\n' % exefile) |         out.write('\t@rm -f %s\n' % os.path.join('$(PREFIX)', 'bin', exefile)) | ||||||
| 
 | 
 | ||||||
|     def mk_win_dist(self, build_path, dist_path): |     def mk_win_dist(self, build_path, dist_path): | ||||||
|         if self.install: |         if self.install: | ||||||
|             mk_dir('%s/bin' % dist_path) |             mk_dir(os.path.join(dist_path, 'bin')) | ||||||
|             shutil.copy('%s/%s.exe' % (build_path, self.exe_name), |             shutil.copy('%s.exe' % os.path.join(build_path, self.exe_name), | ||||||
|                         '%s/bin/%s.exe' % (dist_path, self.exe_name)) |                         '%s.exe' % os.path.join(dist_path, 'bin', self.exe_name)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class ExtraExeComponent(ExeComponent): | class ExtraExeComponent(ExeComponent): | ||||||
|  | @ -815,13 +815,13 @@ class DLLComponent(Component): | ||||||
|         deps = sort_components(self.deps) |         deps = sort_components(self.deps) | ||||||
|         objs = [] |         objs = [] | ||||||
|         for cppfile in get_cpp_files(self.src_dir): |         for cppfile in get_cpp_files(self.src_dir): | ||||||
|             objfile = '%s/%s$(OBJ_EXT)' % (self.build_dir, os.path.splitext(cppfile)[0]) |             objfile = '%s$(OBJ_EXT)' % os.path.join(self.build_dir, os.path.splitext(cppfile)[0]) | ||||||
|             objs.append(objfile) |             objs.append(objfile) | ||||||
|         # Explicitly include obj files of reexport. This fixes problems with exported symbols on Linux and OSX. |         # Explicitly include obj files of reexport. This fixes problems with exported symbols on Linux and OSX. | ||||||
|         for reexport in self.reexports: |         for reexport in self.reexports: | ||||||
|             reexport = get_component(reexport) |             reexport = get_component(reexport) | ||||||
|             for cppfile in get_cpp_files(reexport.src_dir): |             for cppfile in get_cpp_files(reexport.src_dir): | ||||||
|                 objfile = '%s/%s$(OBJ_EXT)' % (reexport.build_dir, os.path.splitext(cppfile)[0]) |                 objfile = '%s$(OBJ_EXT)' % os.path.join(reexport.build_dir, os.path.splitext(cppfile)[0]) | ||||||
|                 objs.append(objfile) |                 objs.append(objfile) | ||||||
|         for obj in objs: |         for obj in objs: | ||||||
|             out.write(' ') |             out.write(' ') | ||||||
|  | @ -829,7 +829,7 @@ class DLLComponent(Component): | ||||||
|         for dep in deps: |         for dep in deps: | ||||||
|             if not dep in self.reexports: |             if not dep in self.reexports: | ||||||
|                 c_dep = get_component(dep) |                 c_dep = get_component(dep) | ||||||
|                 out.write(' %s/%s$(LIB_EXT)' % (c_dep.build_dir, c_dep.name)) |                 out.write(' %s$(LIB_EXT)' % os.path.join(c_dep.build_dir, c_dep.name)) | ||||||
|         out.write('\n') |         out.write('\n') | ||||||
|         out.write('\t$(LINK) $(SLINK_OUT_FLAG)%s $(SLINK_FLAGS)' % dllfile) |         out.write('\t$(LINK) $(SLINK_OUT_FLAG)%s $(SLINK_FLAGS)' % dllfile) | ||||||
|         for obj in objs: |         for obj in objs: | ||||||
|  | @ -838,10 +838,10 @@ class DLLComponent(Component): | ||||||
|         for dep in deps: |         for dep in deps: | ||||||
|             if not dep in self.reexports: |             if not dep in self.reexports: | ||||||
|                 c_dep = get_component(dep) |                 c_dep = get_component(dep) | ||||||
|                 out.write(' %s/%s$(LIB_EXT)' % (c_dep.build_dir, c_dep.name)) |                 out.write(' %s$(LIB_EXT)' % os.path.join(c_dep.build_dir, c_dep.name)) | ||||||
|         out.write(' $(SLINK_EXTRA_FLAGS)') |         out.write(' $(SLINK_EXTRA_FLAGS)') | ||||||
|         if IS_WINDOWS: |         if IS_WINDOWS: | ||||||
|             out.write(' /DEF:%s/%s.def' % (self.to_src_dir, self.name)) |             out.write(' /DEF:%s.def' % os.path.join(self.to_src_dir, self.name)) | ||||||
|         out.write('\n') |         out.write('\n') | ||||||
|         if self.static: |         if self.static: | ||||||
|             self.mk_static(out) |             self.mk_static(out) | ||||||
|  | @ -854,13 +854,13 @@ class DLLComponent(Component): | ||||||
|         # generate rule for lib |         # generate rule for lib | ||||||
|         objs = [] |         objs = [] | ||||||
|         for cppfile in get_cpp_files(self.src_dir): |         for cppfile in get_cpp_files(self.src_dir): | ||||||
|             objfile = '%s/%s$(OBJ_EXT)' % (self.build_dir, os.path.splitext(cppfile)[0]) |             objfile = '%s$(OBJ_EXT)' % os.path.join(self.build_dir, os.path.splitext(cppfile)[0]) | ||||||
|             objs.append(objfile) |             objs.append(objfile) | ||||||
|         # we have to "reexport" all object files |         # we have to "reexport" all object files | ||||||
|         for dep in self.deps: |         for dep in self.deps: | ||||||
|             dep = get_component(dep) |             dep = get_component(dep) | ||||||
|             for cppfile in get_cpp_files(dep.src_dir): |             for cppfile in get_cpp_files(dep.src_dir): | ||||||
|                 objfile = '%s/%s$(OBJ_EXT)' % (dep.build_dir, os.path.splitext(cppfile)[0]) |                 objfile = '%s$(OBJ_EXT)' % os.path.join(dep.build_dir, os.path.splitext(cppfile)[0]) | ||||||
|                 objs.append(objfile) |                 objs.append(objfile) | ||||||
|         libfile = '%s$(LIB_EXT)' % self.dll_name |         libfile = '%s$(LIB_EXT)' % self.dll_name | ||||||
|         out.write('%s:' % libfile) |         out.write('%s:' % libfile) | ||||||
|  | @ -889,29 +889,29 @@ class DLLComponent(Component): | ||||||
|     def mk_install(self, out): |     def mk_install(self, out): | ||||||
|         if self.install: |         if self.install: | ||||||
|             dllfile = '%s$(SO_EXT)' % self.dll_name |             dllfile = '%s$(SO_EXT)' % self.dll_name | ||||||
|             out.write('\t@cp %s $(PREFIX)/lib/%s\n' % (dllfile, dllfile)) |             out.write('\t@cp %s %s\n' % (dllfile, os.path.join('$(PREFIX)', 'lib', dllfile))) | ||||||
|             out.write('\t@cp %s %s/%s\n' % (dllfile, PYTHON_PACKAGE_DIR, dllfile)) |             out.write('\t@cp %s %s\n' % (dllfile, os.path.join(PYTHON_PACKAGE_DIR, dllfile))) | ||||||
|             if self.static: |             if self.static: | ||||||
|                 libfile = '%s$(LIB_EXT)' % self.dll_name |                 libfile = '%s$(LIB_EXT)' % self.dll_name | ||||||
|                 out.write('\t@cp %s $(PREFIX)/lib/%s\n' % (libfile, libfile)) |                 out.write('\t@cp %s %s\n' % (libfile, os.path.join('$(PREFIX)', 'lib', libfile))) | ||||||
|              |              | ||||||
| 
 | 
 | ||||||
|     def mk_uninstall(self, out): |     def mk_uninstall(self, out): | ||||||
|         dllfile = '%s$(SO_EXT)' % self.dll_name |         dllfile = '%s$(SO_EXT)' % self.dll_name | ||||||
|         out.write('\t@rm -f $(PREFIX)/lib/%s\n' % dllfile) |         out.write('\t@rm -f %s\n' % os.path.join('$(PREFIX)', 'lib', dllfile)) | ||||||
|         out.write('\t@rm -f %s/%s\n' % (PYTHON_PACKAGE_DIR, dllfile)) |         out.write('\t@rm -f %s\n' % os.path.join(PYTHON_PACKAGE_DIR, dllfile)) | ||||||
|         libfile = '%s$(LIB_EXT)' % self.dll_name |         libfile = '%s$(LIB_EXT)' % self.dll_name | ||||||
|         out.write('\t@rm -f $(PREFIX)/lib/%s\n' % libfile) |         out.write('\t@rm -f %s\n' % os.path.join('$(PREFIX)', 'lib', libfile)) | ||||||
| 
 | 
 | ||||||
|     def mk_win_dist(self, build_path, dist_path): |     def mk_win_dist(self, build_path, dist_path): | ||||||
|         if self.install: |         if self.install: | ||||||
|             mk_dir('%s/bin' % dist_path) |             mk_dir(os.path.join(dist_path, 'bin')) | ||||||
|             shutil.copy('%s/%s.dll' % (build_path, self.dll_name), |             shutil.copy('%s.dll' % os.path.join(build_path, self.dll_name), | ||||||
|                         '%s/bin/%s.dll' % (dist_path, self.dll_name)) |                         '%s.dll' % os.path.join(dist_path, 'bin', self.dll_name)) | ||||||
|             if self.static: |             if self.static: | ||||||
|                 mk_dir('%s/bin' % dist_path) |                 mk_dir(os.path.join(dist_path, 'bin')) | ||||||
|                 shutil.copy('%s/%s.lib' % (build_path, self.dll_name), |                 shutil.copy('%s.lib' % os.path.join(build_path, self.dll_name), | ||||||
|                             '%s/bin/%s.lib' % (dist_path, self.dll_name)) |                             '%s.lib' % os.path.join(dist_path, 'bin', self.dll_name)) | ||||||
| 
 | 
 | ||||||
| class DotNetDLLComponent(Component): | class DotNetDLLComponent(Component): | ||||||
|     def __init__(self, name, dll_name, path, deps, assembly_info_dir): |     def __init__(self, name, dll_name, path, deps, assembly_info_dir): | ||||||
|  | @ -928,12 +928,12 @@ class DotNetDLLComponent(Component): | ||||||
|             cs_fp_files = [] |             cs_fp_files = [] | ||||||
|             cs_files    = [] |             cs_files    = [] | ||||||
|             for cs_file in get_cs_files(self.src_dir): |             for cs_file in get_cs_files(self.src_dir): | ||||||
|                 cs_fp_files.append('%s/%s' % (self.to_src_dir, cs_file)) |                 cs_fp_files.append(os.path.join(self.to_src_dir, cs_file)) | ||||||
|                 cs_files.append(cs_file) |                 cs_files.append(cs_file) | ||||||
|             if self.assembly_info_dir != '.': |             if self.assembly_info_dir != '.': | ||||||
|                 for cs_file in get_cs_files('%s/%s' % (self.src_dir, self.assembly_info_dir)): |                 for cs_file in get_cs_files(os.path.join(self.src_dir, self.assembly_info_dir)): | ||||||
|                     cs_fp_files.append('%s/%s/%s' % (self.to_src_dir, self.assembly_info_dir, cs_file)) |                     cs_fp_files.append(os.path.join(self.to_src_dir, self.assembly_info_dir, cs_file)) | ||||||
|                     cs_files.append('%s\%s' % (self.assembly_info_dir, cs_file)) |                     cs_files.append(os.path.join(self.assembly_info_dir, cs_file)) | ||||||
|             dllfile = '%s.dll' % self.dll_name |             dllfile = '%s.dll' % self.dll_name | ||||||
|             out.write('%s:' % dllfile) |             out.write('%s:' % dllfile) | ||||||
|             for cs_file in cs_fp_files: |             for cs_file in cs_fp_files: | ||||||
|  | @ -947,8 +947,8 @@ class DotNetDLLComponent(Component): | ||||||
|             out.write('\n') |             out.write('\n') | ||||||
|             # HACK |             # HACK | ||||||
|             win_to_src_dir = self.to_src_dir.replace('/', '\\') |             win_to_src_dir = self.to_src_dir.replace('/', '\\') | ||||||
|             out.write('  move %s\%s\n' % (win_to_src_dir, dllfile)) |             out.write('  move %s\n' % os.path.join(win_to_src_dir, dllfile)) | ||||||
|             out.write('  move %s\%s.pdb\n' % (win_to_src_dir, self.dll_name)) |             out.write('  move %s.pdb\n' % os.path.join(win_to_src_dir, self.dll_name)) | ||||||
|             out.write('%s: %s\n\n' % (self.name, dllfile)) |             out.write('%s: %s\n\n' % (self.name, dllfile)) | ||||||
|             return |             return | ||||||
|      |      | ||||||
|  | @ -961,9 +961,9 @@ class DotNetDLLComponent(Component): | ||||||
|     def mk_win_dist(self, build_path, dist_path): |     def mk_win_dist(self, build_path, dist_path): | ||||||
|         if DOTNET_ENABLED: |         if DOTNET_ENABLED: | ||||||
|             # Assuming all DotNET dll should be in the distribution |             # Assuming all DotNET dll should be in the distribution | ||||||
|             mk_dir('%s/bin' % dist_path) |             mk_dir(os.path.join(dist_path, 'bin')) | ||||||
|             shutil.copy('%s/%s.dll' % (build_path, self.dll_name), |             shutil.copy('%s.dll' % os.path.join(build_path, self.dll_name), | ||||||
|                         '%s/bin/%s.dll' % (dist_path, self.dll_name)) |                         '%s.dll' % os.path.join(dist_path, 'bin', self.dll_name)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class JavaDLLComponent(Component): | class JavaDLLComponent(Component): | ||||||
|  | @ -977,9 +977,9 @@ class JavaDLLComponent(Component): | ||||||
| 
 | 
 | ||||||
|     def mk_makefile(self, out): |     def mk_makefile(self, out): | ||||||
|         if is_java_enabled(): |         if is_java_enabled(): | ||||||
|             mk_dir(BUILD_DIR+'/api/java/classes') |             mk_dir(os.path.join(BUILD_DIR, 'api', 'java', 'classes')) | ||||||
|             dllfile = '%s$(SO_EXT)' % self.dll_name             |             dllfile = '%s$(SO_EXT)' % self.dll_name             | ||||||
|             out.write('libz3java$(SO_EXT): libz3$(SO_EXT) %s/Native.cpp\n' % self.to_src_dir) |             out.write('libz3java$(SO_EXT): libz3$(SO_EXT) %s\n' % os.path.join(self.to_src_dir, 'Native.cpp')) | ||||||
|             t = '\t$(CXX) $(CXXFLAGS) $(CXX_OUT_FLAG)api/java/Native$(OBJ_EXT) -I"%s/include" -I"%s/include/PLATFORM" -I%s %s/Native.cpp\n' % (JAVA_HOME, JAVA_HOME, get_component('api').to_src_dir, self.to_src_dir) |             t = '\t$(CXX) $(CXXFLAGS) $(CXX_OUT_FLAG)api/java/Native$(OBJ_EXT) -I"%s/include" -I"%s/include/PLATFORM" -I%s %s/Native.cpp\n' % (JAVA_HOME, JAVA_HOME, get_component('api').to_src_dir, self.to_src_dir) | ||||||
|             if IS_OSX: |             if IS_OSX: | ||||||
|                 t = t.replace('PLATFORM', 'darwin') |                 t = t.replace('PLATFORM', 'darwin') | ||||||
|  | @ -995,9 +995,9 @@ class JavaDLLComponent(Component): | ||||||
|             out.write('%s.jar: libz3java$(SO_EXT) ' % self.package_name) |             out.write('%s.jar: libz3java$(SO_EXT) ' % self.package_name) | ||||||
|             deps = '' |             deps = '' | ||||||
|             for jfile in get_java_files(self.src_dir): |             for jfile in get_java_files(self.src_dir): | ||||||
|                 deps += ('%s/%s ' % (self.to_src_dir, jfile)) |                 deps += ('%s ' % os.path.join(self.to_src_dir, jfile)) | ||||||
|             for jfile in get_java_files((self.src_dir + "/enumerations")): |             for jfile in get_java_files(os.path.join(self.src_dir, "enumerations")): | ||||||
|                 deps += ('%s/enumerations/%s ' % (self.to_src_dir, jfile)) |                 deps += '%s ' % os.path.join(self.to_src_dir, 'enumerations', jfile) | ||||||
|             if IS_WINDOWS: deps = deps.replace('/', '\\') |             if IS_WINDOWS: deps = deps.replace('/', '\\') | ||||||
|             out.write(deps) |             out.write(deps) | ||||||
|             out.write('\n') |             out.write('\n') | ||||||
|  | @ -1017,8 +1017,8 @@ class JavaDLLComponent(Component): | ||||||
| class ExampleComponent(Component): | class ExampleComponent(Component): | ||||||
|     def __init__(self, name, path): |     def __init__(self, name, path): | ||||||
|         Component.__init__(self, name, path, []) |         Component.__init__(self, name, path, []) | ||||||
|         self.ex_dir   = '%s/%s' % (EXAMPLE_DIR, self.path) |         self.ex_dir   = os.path.join(EXAMPLE_DIR, self.path) | ||||||
|         self.to_ex_dir = '%s/%s' % (REV_BUILD_DIR, self.ex_dir) |         self.to_ex_dir = os.path.join(REV_BUILD_DIR, self.ex_dir) | ||||||
| 
 | 
 | ||||||
|     def is_example(self): |     def is_example(self): | ||||||
|         return True |         return True | ||||||
|  | @ -1041,7 +1041,7 @@ class CppExampleComponent(ExampleComponent): | ||||||
|         out.write('%s: %s' % (exefile, dll)) |         out.write('%s: %s' % (exefile, dll)) | ||||||
|         for cppfile in self.src_files(): |         for cppfile in self.src_files(): | ||||||
|             out.write(' ') |             out.write(' ') | ||||||
|             out.write('%s/%s' % (self.to_ex_dir, cppfile)) |             out.write(os.path.join(self.to_ex_dir, cppfile)) | ||||||
|         out.write('\n') |         out.write('\n') | ||||||
|         out.write('\t%s $(LINK_OUT_FLAG)%s $(LINK_FLAGS)' % (self.compiler(), exefile)) |         out.write('\t%s $(LINK_OUT_FLAG)%s $(LINK_FLAGS)' % (self.compiler(), exefile)) | ||||||
|         # Add include dir components |         # Add include dir components | ||||||
|  | @ -1049,7 +1049,7 @@ class CppExampleComponent(ExampleComponent): | ||||||
|         out.write(' -I%s' % get_component(CPP_COMPONENT).to_src_dir) |         out.write(' -I%s' % get_component(CPP_COMPONENT).to_src_dir) | ||||||
|         for cppfile in self.src_files(): |         for cppfile in self.src_files(): | ||||||
|             out.write(' ') |             out.write(' ') | ||||||
|             out.write('%s/%s' % (self.to_ex_dir, cppfile)) |             out.write(os.path.join(self.to_ex_dir, cppfile)) | ||||||
|         out.write(' ') |         out.write(' ') | ||||||
|         if IS_WINDOWS: |         if IS_WINDOWS: | ||||||
|             out.write('%s.lib' % dll_name) |             out.write('%s.lib' % dll_name) | ||||||
|  | @ -1083,7 +1083,7 @@ class DotNetExampleComponent(ExampleComponent): | ||||||
|             out.write('%s: %s' % (exefile, dll)) |             out.write('%s: %s' % (exefile, dll)) | ||||||
|             for csfile in get_cs_files(self.ex_dir): |             for csfile in get_cs_files(self.ex_dir): | ||||||
|                 out.write(' ') |                 out.write(' ') | ||||||
|                 out.write('%s/%s' % (self.to_ex_dir, csfile)) |                 out.write(os.path.join(self.to_ex_dir, csfile)) | ||||||
|             out.write('\n') |             out.write('\n') | ||||||
|             out.write('\tcsc /out:%s /reference:%s /debug:full /reference:System.Numerics.dll' % (exefile, dll)) |             out.write('\tcsc /out:%s /reference:%s /debug:full /reference:System.Numerics.dll' % (exefile, dll)) | ||||||
|             if VS_X64: |             if VS_X64: | ||||||
|  | @ -1094,7 +1094,7 @@ class DotNetExampleComponent(ExampleComponent): | ||||||
|                 out.write(' ') |                 out.write(' ') | ||||||
|                 # HACK |                 # HACK | ||||||
|                 win_ex_dir = self.to_ex_dir.replace('/', '\\') |                 win_ex_dir = self.to_ex_dir.replace('/', '\\') | ||||||
|                 out.write('%s\\%s' % (win_ex_dir, csfile)) |                 out.write(os.path.join(win_ex_dir, csfile)) | ||||||
|             out.write('\n') |             out.write('\n') | ||||||
|             out.write('_ex_%s: %s\n\n' % (self.name, exefile)) |             out.write('_ex_%s: %s\n\n' % (self.name, exefile)) | ||||||
| 
 | 
 | ||||||
|  | @ -1111,7 +1111,7 @@ class JavaExampleComponent(ExampleComponent): | ||||||
|             out.write('_ex_%s: %s' % (self.name, pkg)) |             out.write('_ex_%s: %s' % (self.name, pkg)) | ||||||
|             deps = '' |             deps = '' | ||||||
|             for jfile in get_java_files(self.ex_dir): |             for jfile in get_java_files(self.ex_dir): | ||||||
|                 out.write(' %s/%s' % (self.to_ex_dir, jfile)) |                 out.write(os.path.join(self.to_ex_dir, jfile)) | ||||||
|             if IS_WINDOWS: |             if IS_WINDOWS: | ||||||
|                 deps = deps.replace('/', '\\') |                 deps = deps.replace('/', '\\') | ||||||
|             out.write('%s\n' % deps) |             out.write('%s\n' % deps) | ||||||
|  | @ -1119,7 +1119,7 @@ class JavaExampleComponent(ExampleComponent): | ||||||
|             win_ex_dir = self.to_ex_dir |             win_ex_dir = self.to_ex_dir | ||||||
|             for javafile in get_java_files(self.ex_dir): |             for javafile in get_java_files(self.ex_dir): | ||||||
|                 out.write(' ') |                 out.write(' ') | ||||||
|                 out.write('%s/%s' % (win_ex_dir, javafile)) |                 out.write(os.path.join(win_ex_dir, javafile)) | ||||||
|             out.write(' -d .\n\n') |             out.write(' -d .\n\n') | ||||||
| 
 | 
 | ||||||
| class PythonExampleComponent(ExampleComponent): | class PythonExampleComponent(ExampleComponent): | ||||||
|  | @ -1129,9 +1129,9 @@ class PythonExampleComponent(ExampleComponent): | ||||||
|     # Python examples are just placeholders, we just copy the *.py files when mk_makefile is invoked. |     # Python examples are just placeholders, we just copy the *.py files when mk_makefile is invoked. | ||||||
|     # We don't need to include them in the :examples rule |     # We don't need to include them in the :examples rule | ||||||
|     def mk_makefile(self, out): |     def mk_makefile(self, out): | ||||||
|         full = '%s/%s' % (EXAMPLE_DIR, self.path) |         full = os.path.join(EXAMPLE_DIR, self.path) | ||||||
|         for py in filter(lambda f: f.endswith('.py'), os.listdir(full)): |         for py in filter(lambda f: f.endswith('.py'), os.listdir(full)): | ||||||
|             shutil.copyfile('%s/%s' % (full, py), '%s/%s' % (BUILD_DIR, py)) |             shutil.copyfile(os.path.join(full, py), os.path.join(BUILD_DIR, py)) | ||||||
|             if is_verbose(): |             if is_verbose(): | ||||||
|                 print "Copied Z3Py example '%s' to '%s'" % (py, BUILD_DIR) |                 print "Copied Z3Py example '%s' to '%s'" % (py, BUILD_DIR) | ||||||
|         out.write('_ex_%s: \n\n' % self.name) |         out.write('_ex_%s: \n\n' % self.name) | ||||||
|  | @ -1198,7 +1198,7 @@ def add_z3py_example(name, path=None): | ||||||
| def mk_config(): | def mk_config(): | ||||||
|     if ONLY_MAKEFILES: |     if ONLY_MAKEFILES: | ||||||
|         return |         return | ||||||
|     config = open('%s/config.mk' % BUILD_DIR, 'w') |     config = open(os.path.join(BUILD_DIR, 'config.mk'), 'w') | ||||||
|     if IS_WINDOWS: |     if IS_WINDOWS: | ||||||
|         config.write( |         config.write( | ||||||
|             'CC=cl\n' |             'CC=cl\n' | ||||||
|  | @ -1351,9 +1351,9 @@ def mk_config(): | ||||||
| 
 | 
 | ||||||
| def mk_install(out): | def mk_install(out): | ||||||
|     out.write('install:\n') |     out.write('install:\n') | ||||||
|     out.write('\t@mkdir -p $(PREFIX)/bin\n') |     out.write('\t@mkdir -p %s\n' % os.path.join('$(PREFIX)', 'bin')) | ||||||
|     out.write('\t@mkdir -p $(PREFIX)/include\n') |     out.write('\t@mkdir -p %s\n' % os.path.join('$(PREFIX)', 'include')) | ||||||
|     out.write('\t@mkdir -p $(PREFIX)/lib\n') |     out.write('\t@mkdir -p %s\n' % os.path.join('$(PREFIX)', 'lib')) | ||||||
|     for c in get_components(): |     for c in get_components(): | ||||||
|         c.mk_install(out) |         c.mk_install(out) | ||||||
|     out.write('\t@cp z3*.pyc %s\n' % PYTHON_PACKAGE_DIR) |     out.write('\t@cp z3*.pyc %s\n' % PYTHON_PACKAGE_DIR) | ||||||
|  | @ -1364,7 +1364,7 @@ def mk_uninstall(out): | ||||||
|     out.write('uninstall:\n') |     out.write('uninstall:\n') | ||||||
|     for c in get_components(): |     for c in get_components(): | ||||||
|         c.mk_uninstall(out) |         c.mk_uninstall(out) | ||||||
|     out.write('\t@rm -f %s/z3*.pyc\n' % PYTHON_PACKAGE_DIR) |     out.write('\t@rm -f %s*.pyc\n' % os.path.join(PYTHON_PACKAGE_DIR, 'z3')) | ||||||
|     out.write('\t@echo Z3 was successfully uninstalled.\n') |     out.write('\t@echo Z3 was successfully uninstalled.\n') | ||||||
|     out.write('\n')     |     out.write('\n')     | ||||||
| 
 | 
 | ||||||
|  | @ -1373,9 +1373,9 @@ def mk_makefile(): | ||||||
|     mk_dir(BUILD_DIR) |     mk_dir(BUILD_DIR) | ||||||
|     mk_config() |     mk_config() | ||||||
|     if VERBOSE: |     if VERBOSE: | ||||||
|         print "Writing %s/Makefile" % BUILD_DIR |         print "Writing %s" % os.path.join(BUILD_DIR, 'Makefile') | ||||||
|     out = open('%s/Makefile' % BUILD_DIR, 'w') |     out = open(os.path.join(BUILD_DIR, 'Makefile'), 'w') | ||||||
|     out.write('# Automatically generated file. Generator: scripts/mk_make.py\n') |     out.write('# Automatically generated file.\n') | ||||||
|     out.write('include config.mk\n') |     out.write('include config.mk\n') | ||||||
|     # Generate :all rule |     # Generate :all rule | ||||||
|     out.write('all:') |     out.write('all:') | ||||||
|  | @ -1415,7 +1415,7 @@ def mk_makefile(): | ||||||
|             else: |             else: | ||||||
|                 print "  platform: x86" |                 print "  platform: x86" | ||||||
|                 print "To build Z3, open a [Visual Studio Command Prompt], then" |                 print "To build Z3, open a [Visual Studio Command Prompt], then" | ||||||
|             print "type 'cd %s/%s && nmake'\n" % (os.getcwd(), BUILD_DIR) |             print "type 'cd %s && nmake'\n" % os.path.join(os.getcwd(), BUILD_DIR) | ||||||
|             print 'Remark: to open a Visual Studio Command Prompt, go to: "Start > All Programs > Visual Studio > Visual Studio Tools"' |             print 'Remark: to open a Visual Studio Command Prompt, go to: "Start > All Programs > Visual Studio > Visual Studio Tools"' | ||||||
|         else: |         else: | ||||||
|             print "Type 'cd %s; make' to build Z3" % BUILD_DIR |             print "Type 'cd %s; make' to build Z3" % BUILD_DIR | ||||||
|  | @ -1535,14 +1535,14 @@ def exec_pyg_scripts(): | ||||||
| # database.smt ==> database.h | # database.smt ==> database.h | ||||||
| def mk_pat_db(): | def mk_pat_db(): | ||||||
|     c = get_component(PATTERN_COMPONENT) |     c = get_component(PATTERN_COMPONENT) | ||||||
|     fin  = open('%s/database.smt2' % c.src_dir, 'r') |     fin  = open(os.path.join(c.src_dir, 'database.smt2'), 'r') | ||||||
|     fout = open('%s/database.h'  % c.src_dir, 'w') |     fout = open(os.path.join(c.src_dir, 'database.h'), 'w') | ||||||
|     fout.write('char const * g_pattern_database =\n') |     fout.write('char const * g_pattern_database =\n') | ||||||
|     for line in fin: |     for line in fin: | ||||||
|         fout.write('"%s\\n"\n' % line.strip('\n')) |         fout.write('"%s\\n"\n' % line.strip('\n')) | ||||||
|     fout.write(';\n')     |     fout.write(';\n')     | ||||||
|     if VERBOSE: |     if VERBOSE: | ||||||
|         print "Generated '%s/database.h'" % c.src_dir |         print "Generated '%s'" % os.path.join(c.src_dir, 'database.h') | ||||||
| 
 | 
 | ||||||
| # Update version numbers | # Update version numbers | ||||||
| def update_version(): | def update_version(): | ||||||
|  | @ -1560,32 +1560,32 @@ def update_version(): | ||||||
| # Update files with the version number | # Update files with the version number | ||||||
| def mk_version_dot_h(major, minor, build, revision): | def mk_version_dot_h(major, minor, build, revision): | ||||||
|     c = get_component(UTIL_COMPONENT) |     c = get_component(UTIL_COMPONENT) | ||||||
|     fout = open('%s/version.h' % c.src_dir, 'w') |     fout = open(os.path.join(c.src_dir, 'version.h'), 'w') | ||||||
|     fout.write('// automatically generated file.\n') |     fout.write('// automatically generated file.\n') | ||||||
|     fout.write('#define Z3_MAJOR_VERSION   %s\n' % major) |     fout.write('#define Z3_MAJOR_VERSION   %s\n' % major) | ||||||
|     fout.write('#define Z3_MINOR_VERSION   %s\n' % minor) |     fout.write('#define Z3_MINOR_VERSION   %s\n' % minor) | ||||||
|     fout.write('#define Z3_BUILD_NUMBER    %s\n' % build) |     fout.write('#define Z3_BUILD_NUMBER    %s\n' % build) | ||||||
|     fout.write('#define Z3_REVISION_NUMBER %s\n' % revision) |     fout.write('#define Z3_REVISION_NUMBER %s\n' % revision) | ||||||
|     if VERBOSE: |     if VERBOSE: | ||||||
|         print "Generated '%s/version.h'" % c.src_dir |         print "Generated '%s'" % os.path.join(c.src_dir, 'version.h') | ||||||
| 
 | 
 | ||||||
| # Update version number in AssemblyInfo.cs files | # Update version number in AssemblyInfo.cs files | ||||||
| def update_all_assembly_infos(major, minor, build, revision): | def update_all_assembly_infos(major, minor, build, revision): | ||||||
|     for c in get_components(): |     for c in get_components(): | ||||||
|         if c.has_assembly_info(): |         if c.has_assembly_info(): | ||||||
|             assembly = '%s/%s/AssemblyInfo.cs' % (c.src_dir, c.assembly_info_dir) |             assembly = os.path.join(c.src_dir, c.assembly_info_dir, 'AssemblyInfo.cs') | ||||||
|             if os.path.exists(assembly): |             if os.path.exists(assembly): | ||||||
|                 # It is a CS file |                 # It is a CS file | ||||||
|                 update_assembly_info_version(assembly, |                 update_assembly_info_version(assembly, | ||||||
|                                              major, minor, build, revision, False) |                                              major, minor, build, revision, False) | ||||||
|             else: |             else: | ||||||
|                 assembly = '%s/%s/AssemblyInfo.cpp' % (c.src_dir, c.assembly_info_dir) |                 assembly = os.path.join(c.src_dir, c.assembly_info_dir, 'AssemblyInfo.cs') | ||||||
|                 if os.path.exists(assembly): |                 if os.path.exists(assembly): | ||||||
|                     # It is a cpp file |                     # It is a cpp file | ||||||
|                     update_assembly_info_version(assembly, |                     update_assembly_info_version(assembly, | ||||||
|                                                  major, minor, build, revision, True) |                                                  major, minor, build, revision, True) | ||||||
|                 else: |                 else: | ||||||
|                     raise MKException("Failed to find assembly info file at '%s/%s'" % (c.src_dir, c.assembly_info_dir)) |                     raise MKException("Failed to find assembly info file at '%s'" % os.path.join(c.src_dir, c.assembly_info_dir)) | ||||||
|                      |                      | ||||||
|                  |                  | ||||||
| # Update version number in the given AssemblyInfo.cs files | # Update version number in the given AssemblyInfo.cs files | ||||||
|  | @ -1644,7 +1644,7 @@ def mk_install_tactic_cpp(cnames, path): | ||||||
|     global ADD_TACTIC_DATA, ADD_PROBE_DATA |     global ADD_TACTIC_DATA, ADD_PROBE_DATA | ||||||
|     ADD_TACTIC_DATA = [] |     ADD_TACTIC_DATA = [] | ||||||
|     ADD_PROBE_DATA = [] |     ADD_PROBE_DATA = [] | ||||||
|     fullname = '%s/install_tactic.cpp' % path |     fullname = os.path.join(path, 'install_tactic.cpp') | ||||||
|     fout  = open(fullname, 'w') |     fout  = open(fullname, 'w') | ||||||
|     fout.write('// Automatically generated file.\n') |     fout.write('// Automatically generated file.\n') | ||||||
|     fout.write('#include"tactic.h"\n') |     fout.write('#include"tactic.h"\n') | ||||||
|  | @ -1657,7 +1657,7 @@ def mk_install_tactic_cpp(cnames, path): | ||||||
|         h_files = filter(lambda f: f.endswith('.h') or f.endswith('.hpp'), os.listdir(c.src_dir)) |         h_files = filter(lambda f: f.endswith('.h') or f.endswith('.hpp'), os.listdir(c.src_dir)) | ||||||
|         for h_file in h_files: |         for h_file in h_files: | ||||||
|             added_include = False |             added_include = False | ||||||
|             fin = open("%s/%s" % (c.src_dir, h_file), 'r') |             fin = open(os.path.join(c.src_dir, h_file), 'r') | ||||||
|             for line in fin: |             for line in fin: | ||||||
|                 if tactic_pat.match(line): |                 if tactic_pat.match(line): | ||||||
|                     if not added_include: |                     if not added_include: | ||||||
|  | @ -1710,7 +1710,7 @@ def mk_all_install_tactic_cpps(): | ||||||
| def mk_mem_initializer_cpp(cnames, path): | def mk_mem_initializer_cpp(cnames, path): | ||||||
|     initializer_cmds = [] |     initializer_cmds = [] | ||||||
|     finalizer_cmds   = [] |     finalizer_cmds   = [] | ||||||
|     fullname = '%s/mem_initializer.cpp' % path |     fullname = os.path.join(path, 'mem_initializer.cpp') | ||||||
|     fout  = open(fullname, 'w') |     fout  = open(fullname, 'w') | ||||||
|     fout.write('// Automatically generated file.\n') |     fout.write('// Automatically generated file.\n') | ||||||
|     initializer_pat      = re.compile('[ \t]*ADD_INITIALIZER\(\'([^\']*)\'\)') |     initializer_pat      = re.compile('[ \t]*ADD_INITIALIZER\(\'([^\']*)\'\)') | ||||||
|  | @ -1722,7 +1722,7 @@ def mk_mem_initializer_cpp(cnames, path): | ||||||
|         h_files = filter(lambda f: f.endswith('.h') or f.endswith('.hpp'), os.listdir(c.src_dir)) |         h_files = filter(lambda f: f.endswith('.h') or f.endswith('.hpp'), os.listdir(c.src_dir)) | ||||||
|         for h_file in h_files: |         for h_file in h_files: | ||||||
|             added_include = False |             added_include = False | ||||||
|             fin = open("%s/%s" % (c.src_dir, h_file), 'r') |             fin = open(os.path.join(c.src_dir, h_file), 'r') | ||||||
|             for line in fin: |             for line in fin: | ||||||
|                 m = initializer_pat.match(line) |                 m = initializer_pat.match(line) | ||||||
|                 if m: |                 if m: | ||||||
|  | @ -1773,7 +1773,7 @@ def mk_gparams_register_modules(cnames, path): | ||||||
|     cmds = [] |     cmds = [] | ||||||
|     mod_cmds = [] |     mod_cmds = [] | ||||||
|     mod_descrs = [] |     mod_descrs = [] | ||||||
|     fullname = '%s/gparams_register_modules.cpp' % path |     fullname = os.path.join(path, 'gparams_register_modules.cpp') | ||||||
|     fout  = open(fullname, 'w') |     fout  = open(fullname, 'w') | ||||||
|     fout.write('// Automatically generated file.\n') |     fout.write('// Automatically generated file.\n') | ||||||
|     fout.write('#include"gparams.h"\n') |     fout.write('#include"gparams.h"\n') | ||||||
|  | @ -1785,7 +1785,7 @@ def mk_gparams_register_modules(cnames, path): | ||||||
|         h_files = filter(lambda f: f.endswith('.h') or f.endswith('.hpp'), os.listdir(c.src_dir)) |         h_files = filter(lambda f: f.endswith('.h') or f.endswith('.hpp'), os.listdir(c.src_dir)) | ||||||
|         for h_file in h_files: |         for h_file in h_files: | ||||||
|             added_include = False |             added_include = False | ||||||
|             fin = open("%s/%s" % (c.src_dir, h_file), 'r') |             fin = open(os.path.join(c.src_dir, h_file), 'r') | ||||||
|             for line in fin: |             for line in fin: | ||||||
|                 m = reg_pat.match(line) |                 m = reg_pat.match(line) | ||||||
|                 if m: |                 if m: | ||||||
|  | @ -1825,13 +1825,13 @@ def mk_all_gparams_register_modules(): | ||||||
| # Generate a .def based on the files at c.export_files slot. | # Generate a .def based on the files at c.export_files slot. | ||||||
| def mk_def_file(c): | def mk_def_file(c): | ||||||
|     pat1 = re.compile(".*Z3_API.*") |     pat1 = re.compile(".*Z3_API.*") | ||||||
|     defname = '%s/%s.def' % (c.src_dir, c.name) |     defname = '%s.def' % os.path.join(c.src_dir, c.name) | ||||||
|     fout = open(defname, 'w') |     fout = open(defname, 'w') | ||||||
|     fout.write('LIBRARY "%s"\nEXPORTS\n' % c.dll_name) |     fout.write('LIBRARY "%s"\nEXPORTS\n' % c.dll_name) | ||||||
|     num = 1 |     num = 1 | ||||||
|     for dot_h in c.export_files: |     for dot_h in c.export_files: | ||||||
|         dot_h_c = c.find_file(dot_h, c.name) |         dot_h_c = c.find_file(dot_h, c.name) | ||||||
|         api = open('%s/%s' % (dot_h_c.src_dir, dot_h), 'r') |         api = open(os.path.join(dot_h_c.src_dir, dot_h), 'r') | ||||||
|         for line in api: |         for line in api: | ||||||
|             m = pat1.match(line) |             m = pat1.match(line) | ||||||
|             if m: |             if m: | ||||||
|  | @ -1858,11 +1858,11 @@ def cp_z3pyc_to_build(): | ||||||
|         raise MKException("failed to compile Z3Py sources") |         raise MKException("failed to compile Z3Py sources") | ||||||
|     for pyc in filter(lambda f: f.endswith('.pyc'), os.listdir(Z3PY_SRC_DIR)): |     for pyc in filter(lambda f: f.endswith('.pyc'), os.listdir(Z3PY_SRC_DIR)): | ||||||
|         try: |         try: | ||||||
|             os.remove('%s/%s' % (BUILD_DIR, pyc)) |             os.remove(os.path.join(BUILD_DIR, pyc)) | ||||||
|         except: |         except: | ||||||
|             pass |             pass | ||||||
|         shutil.copyfile('%s/%s' % (Z3PY_SRC_DIR, pyc), '%s/%s' % (BUILD_DIR, pyc)) |         shutil.copyfile(os.path.join(Z3PY_SRC_DIR, pyc), os.path.join(BUILD_DIR, pyc)) | ||||||
|         os.remove('%s/%s' % (Z3PY_SRC_DIR, pyc)) |         os.remove(os.path.join(Z3PY_SRC_DIR, pyc)) | ||||||
|         if is_verbose(): |         if is_verbose(): | ||||||
|             print "Generated '%s'" % pyc |             print "Generated '%s'" % pyc | ||||||
| 
 | 
 | ||||||
|  | @ -1874,13 +1874,13 @@ def mk_bindings(api_files): | ||||||
|         api = get_component(API_COMPONENT) |         api = get_component(API_COMPONENT) | ||||||
|         for api_file in api_files: |         for api_file in api_files: | ||||||
|             api_file_path = api.find_file(api_file, api.name) |             api_file_path = api.find_file(api_file, api.name) | ||||||
|             new_api_files.append('%s/%s' % (api_file_path.src_dir, api_file)) |             new_api_files.append(os.path.join(api_file_path.src_dir, api_file)) | ||||||
|         g = {} |         g = {} | ||||||
|         g["API_FILES"] = new_api_files |         g["API_FILES"] = new_api_files | ||||||
|         if is_java_enabled(): |         if is_java_enabled(): | ||||||
|             check_java() |             check_java() | ||||||
|             mk_z3consts_java(api_files) |             mk_z3consts_java(api_files) | ||||||
|         execfile('scripts/update_api.py', g) # HACK |         execfile(os.path.join('scripts', 'update_api.py'), g) # HACK | ||||||
|         cp_z3pyc_to_build() |         cp_z3pyc_to_build() | ||||||
|                            |                            | ||||||
| # Extract enumeration types from API files, and add python definitions. | # Extract enumeration types from API files, and add python definitions. | ||||||
|  | @ -1895,14 +1895,14 @@ def mk_z3consts_py(api_files): | ||||||
|     openbrace_pat  = re.compile("{ *") |     openbrace_pat  = re.compile("{ *") | ||||||
|     closebrace_pat = re.compile("}.*;") |     closebrace_pat = re.compile("}.*;") | ||||||
| 
 | 
 | ||||||
|     z3consts  = open('%s/z3consts.py' % Z3PY_SRC_DIR, 'w') |     z3consts  = open(os.path.join(Z3PY_SRC_DIR, 'z3consts.py'), 'w') | ||||||
|     z3consts.write('# Automatically generated file\n\n') |     z3consts.write('# Automatically generated file\n\n') | ||||||
| 
 | 
 | ||||||
|     api_dll = get_component(Z3_DLL_COMPONENT) |     api_dll = get_component(Z3_DLL_COMPONENT) | ||||||
| 
 | 
 | ||||||
|     for api_file in api_files: |     for api_file in api_files: | ||||||
|         api_file_c = api_dll.find_file(api_file, api_dll.name) |         api_file_c = api_dll.find_file(api_file, api_dll.name) | ||||||
|         api_file   = '%s/%s' % (api_file_c.src_dir, api_file) |         api_file   = os.path.join(api_file_c.src_dir, api_file) | ||||||
|         api = open(api_file, 'r') |         api = open(api_file, 'r') | ||||||
| 
 | 
 | ||||||
|         SEARCHING  = 0 |         SEARCHING  = 0 | ||||||
|  | @ -1958,7 +1958,7 @@ def mk_z3consts_py(api_files): | ||||||
|                     idx = idx + 1 |                     idx = idx + 1 | ||||||
|             linenum = linenum + 1 |             linenum = linenum + 1 | ||||||
|     if VERBOSE: |     if VERBOSE: | ||||||
|         print "Generated '%s'" % ('%s/z3consts.py' % Z3PY_SRC_DIR) |         print "Generated '%s'" % os.path.join(Z3PY_SRC_DIR, 'z3consts.py') | ||||||
|                  |                  | ||||||
| 
 | 
 | ||||||
| # Extract enumeration types from z3_api.h, and add .Net definitions | # Extract enumeration types from z3_api.h, and add .Net definitions | ||||||
|  | @ -1973,7 +1973,7 @@ def mk_z3consts_dotnet(api_files): | ||||||
|     dotnet = get_component(DOTNET_COMPONENT) |     dotnet = get_component(DOTNET_COMPONENT) | ||||||
| 
 | 
 | ||||||
|     DeprecatedEnums = [ 'Z3_search_failure' ] |     DeprecatedEnums = [ 'Z3_search_failure' ] | ||||||
|     z3consts  = open('%s/Enumerations.cs' % dotnet.src_dir, 'w') |     z3consts  = open(os.path.join(dotnet.src_dir, 'Enumerations.cs'), 'w') | ||||||
|     z3consts.write('// Automatically generated file\n\n') |     z3consts.write('// Automatically generated file\n\n') | ||||||
|     z3consts.write('using System;\n\n' |     z3consts.write('using System;\n\n' | ||||||
|                    '#pragma warning disable 1591\n\n' |                    '#pragma warning disable 1591\n\n' | ||||||
|  | @ -1982,7 +1982,7 @@ def mk_z3consts_dotnet(api_files): | ||||||
| 
 | 
 | ||||||
|     for api_file in api_files: |     for api_file in api_files: | ||||||
|         api_file_c = dotnet.find_file(api_file, dotnet.name) |         api_file_c = dotnet.find_file(api_file, dotnet.name) | ||||||
|         api_file   = '%s/%s' % (api_file_c.src_dir, api_file) |         api_file   = os.path.join(api_file_c.src_dir, api_file) | ||||||
| 
 | 
 | ||||||
|         api = open(api_file, 'r') |         api = open(api_file, 'r') | ||||||
| 
 | 
 | ||||||
|  | @ -2043,7 +2043,7 @@ def mk_z3consts_dotnet(api_files): | ||||||
|             linenum = linenum + 1 |             linenum = linenum + 1 | ||||||
|     z3consts.write('}\n'); |     z3consts.write('}\n'); | ||||||
|     if VERBOSE: |     if VERBOSE: | ||||||
|         print "Generated '%s'" % ('%s/Enumerations.cs' % dotnet.src_dir) |         print "Generated '%s'" % os.path.join(dotnet.src_dir, 'Enumerations.cs') | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Extract enumeration types from z3_api.h, and add Java definitions | # Extract enumeration types from z3_api.h, and add Java definitions | ||||||
|  | @ -2058,13 +2058,13 @@ def mk_z3consts_java(api_files): | ||||||
|     java = get_component(JAVA_COMPONENT) |     java = get_component(JAVA_COMPONENT) | ||||||
| 
 | 
 | ||||||
|     DeprecatedEnums = [ 'Z3_search_failure' ] |     DeprecatedEnums = [ 'Z3_search_failure' ] | ||||||
|     gendir = java.src_dir + "/enumerations" |     gendir = os.path.join(java.src_dir, "enumerations") | ||||||
|     if not os.path.exists(gendir): |     if not os.path.exists(gendir): | ||||||
|         os.mkdir(gendir) |         os.mkdir(gendir) | ||||||
| 
 | 
 | ||||||
|     for api_file in api_files: |     for api_file in api_files: | ||||||
|         api_file_c = java.find_file(api_file, java.name) |         api_file_c = java.find_file(api_file, java.name) | ||||||
|         api_file   = '%s/%s' % (api_file_c.src_dir, api_file) |         api_file   = os.path.join(api_file_c.src_dir, api_file) | ||||||
| 
 | 
 | ||||||
|         api = open(api_file, 'r') |         api = open(api_file, 'r') | ||||||
| 
 | 
 | ||||||
|  | @ -2107,7 +2107,7 @@ def mk_z3consts_java(api_files): | ||||||
|                 if m: |                 if m: | ||||||
|                     name = words[1] |                     name = words[1] | ||||||
|                     if name not in DeprecatedEnums: |                     if name not in DeprecatedEnums: | ||||||
|                         efile  = open('%s/%s.java' % (gendir, name), 'w') |                         efile  = open('%s.java' % os.path.join(gendir, name), 'w') | ||||||
|                         efile.write('/**\n *  Automatically generated file\n **/\n\n') |                         efile.write('/**\n *  Automatically generated file\n **/\n\n') | ||||||
|                         efile.write('package %s.enumerations;\n\n' % java.package_name); |                         efile.write('package %s.enumerations;\n\n' % java.package_name); | ||||||
| 
 | 
 | ||||||
|  | @ -2156,7 +2156,7 @@ def mk_gui_str(id): | ||||||
| def mk_vs_proj(name, components): | def mk_vs_proj(name, components): | ||||||
|     if not VS_PROJ: |     if not VS_PROJ: | ||||||
|         return |         return | ||||||
|     proj_name = '%s/%s.vcxproj' % (BUILD_DIR, name) |     proj_name = '%s.vcxproj' % os.path.join(BUILD_DIR, name) | ||||||
|     modes=['Debug', 'Release'] |     modes=['Debug', 'Release'] | ||||||
|     PLATFORMS=['Win32'] |     PLATFORMS=['Win32'] | ||||||
|     f = open(proj_name, 'w') |     f = open(proj_name, 'w') | ||||||
|  | @ -2228,7 +2228,7 @@ def mk_vs_proj(name, components): | ||||||
|     for dep in deps: |     for dep in deps: | ||||||
|         dep = get_component(dep) |         dep = get_component(dep) | ||||||
|         for cpp in filter(lambda f: f.endswith('.cpp'), os.listdir(dep.src_dir)): |         for cpp in filter(lambda f: f.endswith('.cpp'), os.listdir(dep.src_dir)): | ||||||
|             f.write('    <ClCompile Include="%s/%s" />\n' % (dep.to_src_dir, cpp)) |             f.write('    <ClCompile Include="%s" />\n' % os.path.join(dep.to_src_dir, cpp)) | ||||||
|     f.write('  </ItemGroup>\n') |     f.write('  </ItemGroup>\n') | ||||||
|     f.write('  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\n') |     f.write('  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\n') | ||||||
|     f.write('  <ImportGroup Label="ExtensionTargets">\n') |     f.write('  <ImportGroup Label="ExtensionTargets">\n') | ||||||
|  | @ -2242,8 +2242,8 @@ def mk_win_dist(build_path, dist_path): | ||||||
|         c.mk_win_dist(build_path, dist_path) |         c.mk_win_dist(build_path, dist_path) | ||||||
|     # Add Z3Py to lib directory |     # Add Z3Py to lib directory | ||||||
|     for pyc in filter(lambda f: f.endswith('.pyc'), os.listdir(build_path)): |     for pyc in filter(lambda f: f.endswith('.pyc'), os.listdir(build_path)): | ||||||
|         shutil.copy('%s/%s' % (build_path, pyc), |         shutil.copy(os.path.join(build_path, pyc), | ||||||
|                     '%s/bin/%s' % (dist_path, pyc)) |                     os.path.join(dist_path, 'bin', pyc)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue