Commits

Leonardo de Moura committed a68ba36

Added install/uninstall to Makefile

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>

Comments (0)

Files changed (2)

 ## -lrt is for timer_create and timer_settime
 LDFLAGS=@LDFLAGS@ -lpthread -fopenmp
 LDFLAGS_EXTRA=
+PREFIX=@prefix@
 #########################
 
 Z3=z3
 	@ ./gmaketest --make=$(MAKE) || \
           (echo "Z3 needs GNU-Make to be built"; exit 1)
 
+################################
+#
+# installation/uninstallation
+#
+################################
+
+install: $(BIN_DIR)/$(Z3) $(BIN_DIR)/lib$(Z3).so  $(BIN_DIR)/lib$(Z3).a
+	@mkdir -p $(PREFIX)/bin
+	@mkdir -p $(PREFIX)/lib
+	@mkdir -p $(PREFIX)/include
+	@cp $(BIN_DIR)/$(Z3) $(PREFIX)/bin
+	@cp $(BIN_DIR)/lib$(Z3).so $(PREFIX)/lib
+	@cp $(BIN_DIR)/lib$(Z3).a $(PREFIX)/lib
+	@cp lib/z3_api.h    $(PREFIX)/include
+	@cp lib/z3.h        $(PREFIX)/include
+	@cp lib/z3_v1.h     $(PREFIX)/include
+	@cp lib/z3_macros.h $(PREFIX)/include
+	@cp c++/z3++.h      $(PREFIX)/include
+
+uninstall:
+	@rm -f $(PREFIX)/bin/$(Z3)
+	@rm -f $(PREFIX)/lib/lib$(Z3).so
+	@rm -f $(PREFIX)/lib/lib$(Z3).a
+	@rm -f $(PREFIX)/include/z3_api.h
+	@rm -f $(PREFIX)/include/z3.h
+	@rm -f $(PREFIX)/include/z3_v1.h
+	@rm -f $(PREFIX)/include/z3_macros.h
+	@rm -f $(PREFIX)/include/z3++.h
     msbuild z3-prover.sln 
   All components will be located at /debug
 
-1) Building Z3 using g++/make
+2) Building Z3 using g++/make
 Your machine must also have the following commands to be able to build Z3:
 autoconf, sed, awk, dos2unix commands
 
-
-- Open a shell
-- For building the z3 executable, execute
- 
   autoconf
   ./configure
   make
+  sudo make install
 
-The z3 executable will be located at bin/external/
-
-- If you want a static library for Z3
-
-  make a
-
-- If you also want the z3 shared library, execute
+It will install z3 executable at /usr/local/bin, libraries at /usr/local/lib, and include files at /usr/local/include.
+Use the following commands to install in a different prefix (e.g., /usr).
 
-  make so
-
-  for libz3.so (on Linux)
+  autoconf
+  ./configure --prefix=/usr
+  make
+  sudo make install
 
-  make dylib
+To uninstall z3, use
 
-  for libz3.dylib (on OSX)
+  sudo make uninstall
 
 Remark: the Z3 makefile imports the source file list from Visual Studio project files.
 To add new source files to the Z3 core, you must include them at: lib/lib.vcxproj