[m-dev.] for review: improve build on MS-Windows.

Tyson Dowd trd at cs.mu.OZ.AU
Tue Jul 20 08:29:58 AEST 1999


Hi,

Anyone can review this.

===================================================================


Estimated hours taken: 3

Improve build and installation on MS-Windows.

configure.in:
Mmake.common.in:
	Set extension for executables (.exe for Windows, nothing
	otherwise).
	Detect presence of perl, makeinfo, texi2dvi and dvips.

Mmakefile:
README.MS-Windows:
	Remove old preinstall and postinstall hacks for windows.

compiler/Mmakefile:
profiler/Mmakefile:
util/Mmakefile:
	Use the extension for executables when installing.

doc/Mmakefile:
	Don't generate documentation unless the appropriate tools
	are available.  Use the auto-detection of perl,
	makeinfo, texi2dvi and dvips to build documentation.

doc/generate_mdb_doc:
	Don't insist on rm being in /bin



Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.38
diff -u -r1.38 Mmake.common.in
--- Mmake.common.in	1999/06/23 03:09:17	1.38
+++ Mmake.common.in	1999/07/19 21:28:07
@@ -71,6 +71,9 @@
 # Specify the additional compilation models to install the library for
 LIBGRADES  		= @LIBGRADES@
 
+# Specify EXT_FOR_EXE is `.exe' on MS-Windows and empty elsewhere.
+EXT_FOR_EXE	= @EXT_FOR_EXE@
+
 # Specify EXT_FOR_SHARED_LIB as `so' if the operating system
 # supports `.so' shared libraries,
 # `.dll' if it supports DLLs,
@@ -190,6 +193,14 @@
 # the changed value (tools/bootcheck will do this automatically for
 # the stage2 and stage3 directories). 
 INCLUDE_ADITI_OUTPUT = yes
+
+#-----------------------------------------------------------------------------#
+
+INSTALL_INFO=@INSTALL_INFO@
+TEXI2DVI=@TEXI2DVI@
+DVIPS=@DVIPS@
+MAKEINFO=@MAKEINFO@
+PERL=@PERL@
 
 #-----------------------------------------------------------------------------#
 
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.39
diff -u -r1.39 Mmakefile
--- Mmakefile	1999/06/07 08:01:10	1.39
+++ Mmakefile	1999/07/19 21:28:50
@@ -34,15 +34,6 @@
 
 #-----------------------------------------------------------------------------#
 
-PREINSTALL_HACK = 
-POSTINSTALL_HACK = 
-
-# For Windows 95 or Windows NT, uncomment the following two lines:
-# PREINSTALL_HACK = preinstall_hack_for_windows
-# POSTINSTALL_HACK = postinstall_hack_for_windows
-
-#-----------------------------------------------------------------------------#
-
 # `mmake dep' ensures that the .dep files exist;
 # `mmake depend' forces them to be remade to ensure that they are up-to-date.
 
@@ -287,11 +278,10 @@
 	@echo "	(autoload 'mdb \"gud\" \"Invoke the Mercury debugger\" t)"
 
 .PHONY: install_main
-install_main: all $(PREINSTALL_HACK) \
+install_main: all \
 		install_scripts install_util install_runtime install_boehm_gc \
   		install_library install_browser install_trace \
-		install_compiler install_profiler install_doc \
-		$(POSTINSTALL_HACK)
+		install_compiler install_profiler install_doc 
  
 .PHONY: install_scripts
 install_scripts: scripts
@@ -435,26 +425,6 @@
 	touch compiler/*.c
 	touch profiler/*.c
 	touch doc/*.info doc/*.dvi doc/*.html config.status
-
-# Another work-around for Windows:
-# the executable files need `.exe' filenames, otherwise they won't work.
-# But the Mmake files expect them to not have `.exe' filenames.
-
-.PHONY: preinstall_hack_for_windows
-preinstall_hack_for_windows:
-	cd compiler && mv mercury_compile.exe xyzzy && mv xyzzy mercury_compile
-	cd profiler && mv mercury_profile.exe xyzzy && mv xyzzy mercury_profile
-	cd util && mv mkinit.exe xyzzy && mv xyzzy mkinit
-	cd util && mv mdemangle.exe xyzzy && mv xyzzy mdemangle
-	cd util && mv info_to_mdb.exe xyzzy && mv xyzzy info_to_mdb
-
-.PHONY: postinstall_hack_for_windows
-postinstall_hack_for_windows:
-	cd $(INSTALL_MERC_BIN_DIR) && mv mercury_compile mercury_compile.exe
-	cd $(INSTALL_MERC_BIN_DIR) && mv mercury_profile mercury_profile.exe
-	cd $(INSTALL_BINDIR) && mv mkinit mkinit.exe
-	cd $(INSTALL_BINDIR) && mv mdemangle mdemangle.exe
-	cd $(INSTALL_BINDIR) && mv info_to_mdb info_to_mdb.exe
 
 #-----------------------------------------------------------------------------#
 
Index: README.MS-Windows
===================================================================
RCS file: /home/mercury1/repository/mercury/README.MS-Windows,v
retrieving revision 1.14
diff -u -r1.14 README.MS-Windows
--- README.MS-Windows	1999/03/14 04:15:46	1.14
+++ README.MS-Windows	1999/07/19 21:28:50
@@ -42,6 +42,12 @@
 
 For more information on Cygwin, see the Cygwin web site mentioned above.
 
+If you want to use the mtags tool from Mercury, you'll need to install
+perl.  A binary distribution of Perl is available at the Cygwin porting
+project:
+	http://www.student.uni-koeln.de/cygwin/
+
+
 -----------------------------------------------------------------------------
 
 RUNNING CONFIGURE
@@ -70,13 +76,8 @@
 -----------------------------------------------------------------------------
 
 RUNNING MAKE
-
-Due to bugs in Cygwin, you need to apply the 
-patches which are listed at the end of this file:
-
-	patch < README.MS-Windows
 
-Also, the date-stamps seem to get screwed up by Cygwin;
+The date-stamps seem to get screwed up by Cygwin;
 to avoid errors about `mercury_compile: Command not found',
 or `makeinfo: Command not found', you need to do the following:
 
@@ -113,19 +114,3 @@
 and the name clash between `mmake' and `Mmake'.  If you run into any
 such problems, rename your `Mmake' file to `Mmakefile'.
 
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-
---- Mmakefile	Sat Feb  7 02:48:13 1998
-+++ Mmakefile.windows	Sat Feb  7 02:49:58 1998
-@@ -23,8 +23,8 @@
- #-----------------------------------------------------------------------------#
- 
- # For Windows 95 or Windows NT, uncomment the following two lines:
--# PREINSTALL_HACK = preinstall_hack_for_windows
--# POSTINSTALL_HACK = postinstall_hack_for_windows
-+PREINSTALL_HACK = preinstall_hack_for_windows
-+POSTINSTALL_HACK = postinstall_hack_for_windows
- 
- #-----------------------------------------------------------------------------#
- 
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.176
diff -u -r1.176 configure.in
--- configure.in	1999/06/03 16:29:32	1.176
+++ configure.in	1999/07/19 21:28:50
@@ -178,6 +178,18 @@
 AC_PATH_PROG(INSTALL_INFO,install-info)
 AC_SUBST(INSTALL_INFO)
 #-----------------------------------------------------------------------------#
+AC_PATH_PROG(TEXI2DVI,texi2dvi)
+AC_SUBST(TEXI2DVI)
+#-----------------------------------------------------------------------------#
+AC_PATH_PROG(DVIPS,dvips)
+AC_SUBST(DVIPS)
+#-----------------------------------------------------------------------------#
+AC_PATH_PROG(MAKEINFO,makeinfo)
+AC_SUBST(MAKEINFO)
+#-----------------------------------------------------------------------------#
+AC_PATH_PROG(PERL,perl)
+AC_SUBST(PERL)
+#-----------------------------------------------------------------------------#
 AC_PROG_CC
 AC_SUBST(CC)
 
@@ -1993,6 +2005,17 @@
 
 #-----------------------------------------------------------------------------#
 
+case "$host" in
+	*-cygwin*)
+		EXT_FOR_EXE=".exe"
+		;;
+	*)
+		EXT_FOR_EXE=
+		;;
+esac
+
+#-----------------------------------------------------------------------------#
+
 AC_SUBST(LINK_SHARED_OBJ)
 AC_SUBST(ERROR_UNDEFINED)
 AC_SUBST(ALLOW_UNDEFINED)
@@ -2003,6 +2026,7 @@
 AC_SUBST(CFLAGS_FOR_PIC)
 AC_SUBST(EXT_FOR_PIC_OBJECTS)
 AC_SUBST(EXT_FOR_SHARED_LIB)
+AC_SUBST(EXT_FOR_EXE)
 AC_SUBST(USE_DLLS)
 AC_SUBST(SHARED_LIBS)
 AC_SUBST(DEFAULT_RM_C)
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.20
diff -u -r1.20 Mmakefile
--- Mmakefile	1999/06/23 03:09:24	1.20
+++ Mmakefile	1999/07/19 21:28:50
@@ -193,6 +193,6 @@
 
 .PHONY: install_compiler
 install_compiler: mercury_compile install_dirs
-	cp `vpath_find mercury_compile` $(INSTALL_MERC_BIN_DIR)
+	cp `vpath_find mercury_compile$(EXT_FOR_EXE)` $(INSTALL_MERC_BIN_DIR)
 
 #-----------------------------------------------------------------------------#
Index: doc/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/Mmakefile,v
retrieving revision 1.17
diff -u -r1.17 Mmakefile
--- Mmakefile	1999/03/22 05:31:34	1.17
+++ Mmakefile	1999/07/19 21:28:50
@@ -13,13 +13,43 @@
 
 #-----------------------------------------------------------------------------#
 
-TEXI2DVI=texi2dvi
-MAKEINFO=makeinfo
-TEXI2HTML=perl texi2html
-TEXI2HTML_SPLIT=perl texi2html -split
-DVIPS=dvips
+TEXI2HTML=$(PERL) texi2html
+TEXI2HTML_SPLIT=$(PERL) texi2html -split
 
-# INSTALL_INFO is defined in ../Mmake.common
+ifeq ($(PERL),)
+	HTML=
+	INSTALL_HTML=
+else
+	HTML=html
+	INSTALL_HTML=install_html
+endif
+
+ifeq ($(TEXI2DVI),)
+	DVI=
+	INSTALL_DVI=
+else
+	DVI=dvi
+	INSTALL_HTML=install_dvi
+endif
+
+ifeq ($(MAKEINFO),)
+	INFO=
+	INSTALL_INFO=
+	MDB_DOC=
+else
+	INFO=info
+	INSTALL_INFO=install_info
+	MDB_DOC=mdb_doc mdb_command_list mdb_command_test.inp
+	INSTALL_MDB_DOC=install_mdb_doc
+endif
+
+ifeq ($(DVIPS),)
+	PS=
+	INSTALL_PS=
+else
+	PS=ps
+	INSTALL_PS=install_ps
+endif
 
 #-----------------------------------------------------------------------------#
 
@@ -49,8 +79,7 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: all
-all: info dvi html manpages mdb_doc mdb_command_list mdb_command_test.inp
-#all: ps text
+all: $(INFO) $(DVI) $(HTML) manpages $(MDB_DOC) 
 
 #-----------------------------------------------------------------------------#
 
@@ -169,7 +198,8 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: install
-install: install_info install_html install_dvi install_manpages install_mdb_doc
+install: $(INSTALL_INFO) $(INSTALL_HTML) $(INSTALL_DVI) install_manpages \
+	$(INSTALL_MDB_DOC) 
 	# install_text install_ps
 
 .PHONY: install_dirs
Index: doc/generate_mdb_doc
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/generate_mdb_doc,v
retrieving revision 1.4
diff -u -r1.4 generate_mdb_doc
--- generate_mdb_doc	1999/03/25 10:42:48	1.4
+++ generate_mdb_doc	1999/07/19 21:28:50
@@ -9,7 +9,7 @@
 cat mdb_categories > mdb_doc
 
 tmp="mdb_doc_tmp.$$"
-trap '/bin/rm -f $tmp' 0 1 2 3 15
+trap 'rm -f $tmp' 0 1 2 3 15
 
 info -f ./mercury_user_guide.info -o $tmp -n "Mercury debugger concepts"
 ../util/info_to_mdb concepts $tmp >> mdb_doc
Index: profiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/profiler/Mmakefile,v
retrieving revision 1.11
diff -u -r1.11 Mmakefile
--- Mmakefile	1999/06/01 08:16:06	1.11
+++ Mmakefile	1999/07/19 21:28:50
@@ -113,6 +113,6 @@
 .PHONY: install_profiler
 install_profiler: mercury_profile
 	-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
-	cp `vpath_find mercury_profile` $(INSTALL_MERC_BIN_DIR)
+	cp `vpath_find mercury_profile$(EXT_FOR_EXE)` $(INSTALL_MERC_BIN_DIR)
 
 #-----------------------------------------------------------------------------#
Index: util/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/util/Mmakefile,v
retrieving revision 1.5
diff -u -r1.5 Mmakefile
--- Mmakefile	1999/06/01 08:16:13	1.5
+++ Mmakefile	1999/07/19 21:28:50
@@ -21,6 +21,7 @@
 # the -O0 is to get around a stupid compiler bug in gcc 2.7.2.3 on cyclone
 
 PROGS=mkinit mdemangle info_to_mdb
+PROGFILENAMES=$(PROGS:%=%$(EXT_FOR_EXE))
 
 #-----------------------------------------------------------------------------#
 
@@ -34,7 +35,7 @@
 .PHONY: install
 install: $(PROGS)
 	[ -d $(INSTALL_BINDIR) ] || mkdir -p $(INSTALL_BINDIR)
-	cp `vpath_find $(PROGS)` $(INSTALL_BINDIR)
+	cp `vpath_find $(PROGFILENAMES)` $(INSTALL_BINDIR)
 
 .PHONY: uninstall
 uninstall:


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't eveyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list