Skip to content
Browse files

Docs, cleaning, better error handling

- Implement proper cleaning
- Cover setting up environment in README
- Fix git management to be fairly sane
  • Loading branch information...
1 parent af40126 commit 087a9deb434f2f403a698e86b18954cb3f5b4017 @ringerc ringerc committed Dec 14, 2012
Showing with 98 additions and 38 deletions.
  1. +10 −8 Makefile
  2. +0 −19 README
  3. +55 −0 README.txt
  4. +0 −11 postgres.mak
  5. +24 −0 postgresql.mak
  6. +9 −0 zlib.mak
View
18 Makefile
@@ -42,18 +42,20 @@ TCLDIR=$(TCL_X64)
!ERROR "Unrecognised target cpu $(TARGET_CPU)
!ENDIF
-default: all
+default: postgresql
$(WGET) $(BISON) $(FLEX) $(TOUCH):
$(MINGW)\bin\mingw-get install msys msys-wget msys-bison msys-flex
+phony:
+
!INCLUDE zlib.mak
!INCLUDE configpl.mak
-!INCLUDE postgres.mak
-
-all: $(ZLIB_OBJS) $(FLEX) $(BISON)
+!INCLUDE postgresql.mak
-clean:
- @-rd /s /q $(LIBBUILDDIR)
- @-rd /s /q $(PGBUILDDIR)
- @-del $(CONFIG_PL) $(BUILDENV_PL)
+clean: zlib-clean postgresql-clean
+ IF EXIST $(LIBBUILDDIR) rd /s /q $(LIBBUILDDIR)
+
+really-clean: clean zlib-really-clean
+ IF EXIST $(PGBUILDDIR) rd /s /q $(PGBUILDDIR)
+
View
19 README
@@ -1,19 +0,0 @@
-These scripts create a PostgreSQL build environment for Windows, and build
-PostgreSQL.
-
-They're for NMake, the Microsoft version of make that uses cmd.exe. It comes
-with Visual Studio. Yes, that's horrid, but it's better than trying to disentangle
-the environment of mingw from that of Visual Studio.
-
-You will require installs of ActiveState Perl, ActiveState TCL, Python.org
-Python 2, MinGW, git (from git-scm.org), and the Microsoft SDK 7.1 to use these
-scripts. Instructions on unattended installs for these tools are coming shortly;
-just need to copy them from another machine.
-
-Edit:
-
- pg_build_win\settings.mak
-
-Build with:
-
- "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe" /f pg_build_win\Makefile postgresql
View
55 README.txt
@@ -0,0 +1,55 @@
+These scripts create a PostgreSQL build environment for Windows, and build
+PostgreSQL.
+
+They're for NMake, the Microsoft version of make that uses cmd.exe. It comes
+with Visual Studio. Yes, that's horrid, but it's better than trying to disentangle
+the environment of mingw from that of Visual Studio.
+
+You will require installs of ActiveState Perl, ActiveState TCL, Python.org
+Python 2, MinGW, git (from git-scm.org), and the Microsoft SDK 7.1 to use these
+scripts. Instructions on unattended installs for these tools are coming shortly;
+just need to copy them from another machine.
+
+Edit:
+
+ pg_build_win\settings.mak
+
+to reflect your environment.
+
+Set up your Visual Studio or Windows SDK environment for the build target you want.
+For Windows SDK use SetEnv.Cmd ; for Visual Studio use vcvars.bat.
+
+ "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /x86 /release /xp
+
+Use
+
+ "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /?
+
+for help.
+
+Build with:
+
+ nmake /f pg_build_win\Makefile postgresql
+
+Supported targets are:
+
+POSTGRESQL:
+-----------
+* postgresql: Build PostgreSQL and its dependencies
+* postgresql-check: Run the test suite
+* postgresql-clean: Clean postgresql working tree, leave libraries alone
+
+LIBRARIES:
+----------
+
+If you want to build individual libraries, each library Makefile
+has "libname" and "libname-clean" targets, eg:
+
+* zlib
+* zlib-clean
+
+CLEANING:
+---------
+
+* clean - remove built libraries and clean PostgreSQL working tree
+* really-clean: Remove built libraries and downloaded files, delete PostgreSQL checkout and working tree
View
11 postgres.mak
@@ -1,11 +0,0 @@
-#
-# Build PostgreSQL
-#
-
-$(PGBUILDDIR)\$(PG_BRANCH)\GNUmakefile.in:
- IF NOT EXIST "$(PGBUILDDIR)" md "$(PGBUILDDIR)"
- "$(GIT)" clone "$(PG_GIT_URL)" "$(PGBUILDDIR)\$(PG_BRANCH)"
-
-postgresql: $(PGBUILDDIR)\$(PG_BRANCH)\GNUmakefile.in $(CONFIG_PL) $(BUILDENV_PL)
- cd $(PGBUILDDIR)\$(PG_BRANCH)\src\tools\msvc
- "$(PERL_CMD)" build.pl
View
24 postgresql.mak
@@ -0,0 +1,24 @@
+#
+# Build PostgreSQL
+#
+
+
+$(PGBUILDDIR)\$(PG_BRANCH): phony
+ @IF NOT EXIST "$(PGBUILDDIR)" md "$(PGBUILDDIR)
+ IF NOT EXIST "$(PGBUILDDIR)\$(PG_BRANCH)" "$(GIT)" clone -b "$(PG_BRANCH)" "$(PG_GIT_URL)" "$(PGBUILDDIR)\$(PG_BRANCH)"
+ cd $(PGBUILDDIR)\$(PG_BRANCH)
+ "$(GIT)" pull --force
+
+postgresql: $(FLEX) $(BISON) zlib $(PGBUILDDIR)\$(PG_BRANCH) $(CONFIG_PL) $(BUILDENV_PL)
+ cd $(PGBUILDDIR)\$(PG_BRANCH)\src\tools\msvc
+ "$(PERL_CMD)" build.pl
+
+postgresql-clean:
+ IF EXIST $(PGBUILDDIR)\$(PG_BRANCH) (
+ cd $(PGBUILDDIR)\$(PG_BRANCH)
+ "$(GIT)" clean -fdx
+ )
+
+postgresql-check: postgresql
+ cd $(PGBUILDDIR)\$(PG_BRANCH)\src\tools\msvc
+ "$(PERL_CMD)" vcregress.pl check
View
9 zlib.mak
@@ -53,3 +53,12 @@ $(ZLIB_BINDIR)\lib\zdll.lib: $(ZLIB_SRCDIR)\zlib1.dll
@IF NOT EXIST $(ZLIB_BINDIR)\lib md $(ZLIB_BINDIR)\lib
copy /Y /B $(ZLIB_SRCDIR)\zdll.lib $(ZLIB_BINDIR)\lib\zdll.lib >NUL
@$(TOUCH) $(ZLIB_BINDIR)\lib\zdll.lib
+
+zlib: $(ZLIB_OBJS)
+
+zlib-clean:
+ IF EXIST $(ZLIB_BINDIR) rd /s /q $(ZLIB_BINDIR)
+ IF EXIST $(ZLIB_SRCDIR) rd /s /q $(ZLIB_SRCDIR)
+
+zlib-really-clean: zlib-clean
+ IF EXIST $(ZLIB_ARCHIVE) del $(ZLIB_ARCHIVE)

0 comments on commit 087a9de

Please sign in to comment.
Something went wrong with that request. Please try again.