Return-Path: Delivered-To: apmail-httpd-test-dev-archive@httpd.apache.org Received: (qmail 90420 invoked by uid 500); 4 Feb 2003 02:32:53 -0000 Mailing-List: contact test-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: test-dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list test-dev@httpd.apache.org Received: (qmail 90407 invoked from network); 4 Feb 2003 02:32:51 -0000 To: test-dev@httpd.apache.org From: ptran@pobox.com Subject: [PATCH] flood: Fixed floodenv.bat environment problem in Makefile.win. Date: Mon, 03 Feb 2003 18:32:55 -0800 Message-Id: <20030204023300.2B28B19176@chickenfeet.org> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Summary: Fixed floodenv.bat environment problem in Makefile.win. This submission fixes the floodenv.bat environment problem. This problem occurs when Makefile.win tries to set up variables for use by external prorams using floodenv.bat. For example, Makefile.win invokes MSDEV like this: floodenv.bat msdev flood.dsw /useenv /make ... The invocation of floodenv.bat and MSDEV occur in independent environments, so MSDEV does not inherit the environment variables set by floodenv.bat. For the build to complete, you need to generate and invoke floodenv.bat before building with NMAKE and Makefile.win. For example: nmake -f makefile.win floodenv.bat floodenv.bat nmake -f makefile.win This patch fixes the problem by allowing Makefile.win to tell floodenv.bat to set up the environment variables and optionally run some commands in the new environment. When we need to invoke an external program like DevStudio, we tell floodenv.bat to execute the program so that it gets a properly initialized environment. The arguments to floodenv.bat are optional, so you can still set up your environment using just floodenv.bat. NOTE: This patch is based on the patch for building without OpenSSL. I sent this patch in an e-mail titled: [PATCH] flood: Fixed Win32 build when not using OpenSSL Below is a summary of the file changes. * Added macro CFG_FLOOD to consolidate all the places that evaluate: flood - Win32 $(LONG) They now just reference $(CFG_FLOOD). * Added commentary to our floodenv.bat target. * The floodenv.bat target no longer inserts an: @echo off at the top of the file. We now suppress the output of each line with a leading "@" symbol. We do so because we want the line invoking the optional external command to echo the command so we can tell what arguments and options are used. * The floodenv.bat target now also writes to "$@", which is "floodenv.bat". The usage helps minimize the places that use "floodenv.bat", thereby making it easier to maintain if we need to change the name in the future. * Changed floodenv.bat so that when we specify optional arguments to it, then it will execute the commands. If you do not specify arguments, you get the old behavior---floodenv.bat sets up your environment and then exits. * Created new macros to represent the different build tools we use: DEVENV_FLOOD: Uses DEVENV. MAKE_FLOOD: Uses NMAKE to invoke flood.mak (you need to generate flood.mak from within DevStudio). MSDEV_FLOOD: Uses MSDEV to invoke the VC6 flood.dsp using the flood.dsw. * Consolidated the build and clean targets with the new macros: DEVENV_FLOOD, MAKE_FLOOD, MSDEV_FLOOD These macros consolidate the usage between the build and clean targets. Several of the redundancy spread across multiple lines are now in macros, and their uses are simpler single lines. * Added .a and .y files to the clean target. They are "generated" files from the "install" target. --- Makefile.win.orig Mon Feb 03 13:55:57 2003 +++ Makefile.win Mon Feb 03 17:56:40 2003 @@ -101,16 +101,31 @@ LONG=Release !ENDIF +CFG_FLOOD = flood - Win32 $(LONG) + +# Floodenv.bat sets up environment variables and will optionally +# execute any command in the new environment. If we're guaranteed we +# ran on Windows NT and newer versions, then we can make use of: +# goto :EOF +# instead of: +# goto :end +# and +# %* +# instead of: +# %1 ... %9 +# See "goto /?" and "call /?" for details. floodenv.bat: Makefile.win - echo @echo off>floodenv.bat - echo set SRCLIB=$(SRCLIB)>>floodenv.bat - echo set APRPATH=$(APRPATH)>>floodenv.bat - echo set APRUTILPATH=$(APRUTILPATH)>>floodenv.bat - echo set OPENSSLPATH=$(OPENSSLPATH)>>floodenv.bat - echo set REGEXPATH=$(REGEXPATH)>>floodenv.bat + echo @set SRCLIB=$(SRCLIB)>$@ + echo @set APRPATH=$(APRPATH)>>$@ + echo @set APRUTILPATH=$(APRUTILPATH)>>$@ + echo @set OPENSSLPATH=$(OPENSSLPATH)>>$@ + echo @set REGEXPATH=$(REGEXPATH)>>$@ !IF "$(HAVE_SSL)" == "1" - echo set LINKSSL=libeay32.lib ssleay32.lib /libpath:"$(SSLBIN)">>floodenv.bat + echo @set LINKSSL=libeay32.lib ssleay32.lib /libpath:"$(SSLBIN)">>$@ !ENDIF + echo @if "%%1" == "" goto :end>>$@ + echo call %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 1>>$@ + echo :end>>$@ regex.h: $(REGEXPATH)\pcreposix.h copy "$(REGEXPATH)\pcreposix.h" regex.h < << @@ -146,41 +161,28 @@ !ENDIF !ENDIF -!IF EXIST("flood.mak") - -clean: - -floodenv.bat - $(MAKE) $(MAKEOPT) -f flood.mak CFG="flood - Win32 $(LONG)" RECURSE=0 CLEAN - del config.h floodenv.bat regex.h - -build: config.h - floodenv.bat - $(MAKE) $(MAKEOPT) -f flood.mak CFG="flood - Win32 $(LONG)" RECURSE=0 +DEVENV_FLOOD = call floodenv.bat devenv flood.sln /useenv +MAKE_FLOOD = call floodenv.bat $(MAKE) $(MAKEOPT) -f flood.mak \ + "CFG=$(CFG_FLOOD)" "RECURSE=0" +MSDEV_FLOOD = call floodenv.bat msdev flood.dsw /useenv /make "$(CFG_FLOOD)" +clean: floodenv.bat +!IF EXIST("flood.mak") + $(MAKE_FLOOD) CLEAN !ELSEIF EXIST("flood.sln") - -clean: - -floodenv.bat - devenv flood.sln /useenv /clean $(LONG) /project flood - del config.h floodenv.bat regex.h - -build: config.h - floodenv.bat - devenv flood.sln /useenv /build $(LONG) /project flood - + $(DEVENV_FLOOD) /clean $(LONG) /project flood !ELSE - -clean: - -floodenv.bat - msdev flood.dsw /USEENV /MAKE \ - "flood - Win32 $(LONG)" /CLEAN - del config.h floodenv.bat regex.h + $(MSDEV_FLOOD) /clean +!ENDIF + del .a .y config.h floodenv.bat regex.h build: config.h - floodenv.bat - msdev flood.dsw /USEENV /MAKE \ - "flood - Win32 $(LONG)" - +!IF EXIST("flood.mak") + $(MAKE_FLOOD) +!ELSEIF EXIST("flood.sln") + $(DEVENV_FLOOD) /build $(LONG) /project flood +!ELSE + $(MSDEV_FLOOD) !ENDIF install: