>From 2fcfd03b1ca9a63c45da79b5c8a2e550b739849f Mon Sep 17 00:00:00 2001
From: Hartmut Becker
Date: Mon, 18 Aug 2014 22:45:29 +0200
Subject: [PATCH] Enhance/fix VMS build environment
* config.h-vms.template: make sure the CRTL version is known
* makefile.com: always compile/link the guile module, remove
VAXCRTL parameter, new LIST parameter
* makefile.vms: always compile/link the guile module, use more
complete dependencies
* prepare_vms.com: helper to create a VMS config file when building
from a snapshot of the repository
---
config.h-vms.template | 18 +++++------
makefile.com | 34 +++++++++++--------
makefile.vms | 86 +++++++++++++++++++++++++++++--------------------
prepare_vms.com | 59 +++++++++++++++++++++++++++++++++
4 files changed, 140 insertions(+), 57 deletions(-)
create mode 100644 prepare_vms.com
diff --git a/config.h-vms.template b/config.h-vms.template
index 3b4bd3b..eefc299 100644
--- a/config.h-vms.template
+++ b/config.h-vms.template
@@ -18,6 +18,12 @@ this program. If not, see . */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.ac by autoheader. */
+/* Pull in types.h here to get __CRTL_VER defined for old versions of the
+ compiler which don't define it. */
+#ifdef __DECC
+# include
+#endif
+
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
@@ -372,15 +378,9 @@ this program. If not, see . */
/* #undef HAVE_VMSDIR_H */
/* #undef _DIRENT_HAVE_D_NAMLEN */
-/* On older systems without 7.0 backport of CRTL the first one is defined */
-#ifdef __CRTL_VER
-# if __CRTL_VER < 70000000
-# define HAVE_VMSDIR_H 1
-# endif
-#else
-# if __VMS_VER < 70000000
-# define HAVE_VMSDIR_H 1
-# endif
+/* On older systems without 7.0 backport of CRTL use non-VMS code for opendir() etc. */
+#if __CRTL_VER < 70000000
+# define HAVE_VMSDIR_H 1
#endif
#if defined(HAVE_VMSDIR_H) && defined(HAVE_DIRENT_H)
diff --git a/makefile.com b/makefile.com
index 6359c47..8e6b39b 100644
--- a/makefile.com
+++ b/makefile.com
@@ -1,8 +1,7 @@
$!
$! Makefile.com - builds GNU Make for VMS
$!
-$! P1 is non-empty if you want to link with the VAXCRTL library instead
-$! of the shareable executable
+$! P1 = LIST will provide compiler listings.
$! P2 = DEBUG will build an image with debug information
$! P3 = WALL will enable all warning messages (some are suppressed since
$! one macro intentionally causes an error condition)
@@ -50,6 +49,12 @@ $ endif
$ endif
$ endif
$!
+$!
+$ if (p1 .eqs. "LIST")
+$ then
+$ ccopt = ccopt + "/list/show=(expan,inclu)"
+$ endif
+$!
$! Should we build a debug image
$!
$ if (p2.eqs."DEBUG")
@@ -67,9 +72,11 @@ $ then
$ gosub check_cc_qual
$ endif
$ filelist = "alloca ar arscan commands default dir expand file function " + -
- "hash implicit job load main misc read remake remote-stub rule " + -
- "output signame variable version vmsfunctions vmsify vpath " + -
+ "guile hash implicit job load main misc read remake " + -
+ "remote-stub rule output signame variable version " + -
+ "vmsfunctions vmsify vpath " + -
"[.glob]glob [.glob]fnmatch getopt1 getopt strcache"
+$!
$ copy config.h-vms config.h
$ n=0
$ open/write optf make.opt
@@ -77,18 +84,14 @@ $ loop:
$ cfile = f$elem(n," ",filelist)
$ if cfile .eqs. " " then goto linkit
$ write sys$output "Compiling ''cfile'..."
-$ call compileit 'cfile' 'p1'
+$ call compileit 'cfile'
$ n = n + 1
$ goto loop
$ linkit:
$ close optf
-$ if p1 .nes. "" then goto link_using_library
$ link/exe=make make.opt/opt'lopt
$ goto cleanup
$
-$ link_using_library:
-$ link/exe=make make.opt/opt,sys$library:vaxcrtl/lib'lopt
-$
$ cleanup:
$ if f$trnlnm("SYS").nes."" then $ deassign sys
$ if f$trnlnm("OPTF").nes."" then $ close optf
@@ -128,10 +131,15 @@ $!-----------------------------------------------------------------------------
$!
$ compileit : subroutine
$ ploc = f$locate("]",p1)
-$ filnam = p1
-$ if ploc .lt. f$length(p1) then filnam=f$extract(ploc+1,100,p1)
-$ write optf "''filnam'"
-$ cc'ccopt'/include=([],[.glob]) -
+$ if ploc .lt. f$length(p1)
+$ then
+$ objdir = f$extract(0, ploc+1, p1)
+$ write optf p1
+$ else
+$ objdir := []
+$ write optf objdir+p1
+$ endif
+$ cc'ccopt'/include=([],[.glob])/obj='objdir' -
/define=("allocated_variable_expand_for_file=alloc_var_expand_for_file","unlink=remove","HAVE_CONFIG_H","VMS") -
'p1'
$ exit
diff --git a/makefile.vms b/makefile.vms
index e5950b7..d7e67c3 100644
--- a/makefile.vms
+++ b/makefile.vms
@@ -88,13 +88,13 @@ mandir = []
# Number to put on the man page filename.
manext = 1
-#guile = ,guile.obj
+guile = ,guile.obj
objs = commands.obj,job.obj,output.obj,dir.obj,file.obj,misc.obj,hash.obj,\
load.obj,main.obj,read.obj,remake.obj,rule.obj,implicit.obj,\
default.obj,variable.obj,expand.obj,function.obj,strcache.obj,\
- vpath.obj,version.obj\
- $(ARCHIVES)$(ALLOCA)$(extras)$(getopt)$(glob)$(guile)
+ vpath.obj,version.obj$(guile)\
+ $(ARCHIVES)$(ALLOCA)$(extras)$(getopt)$(glob)
srcs = commands.c job.c output.c dir.c file.c misc.c guile.c hash.c \
load.c main.c read.c remake.c rule.c implicit.c \
@@ -118,40 +118,56 @@ clean:
-$(RM) make.exe;,*.obj;
-$(RM) [.glob]*.obj;
-# Automatically generated dependencies.
-# makeint.h: config.h gnumake.h gettext.h
-# filedef.h: hash.h
-ar.obj: ar.c makeint.h filedef.h dep.h [.glob]fnmatch.h
-arscan.obj: arscan.c makeint.h
-commands.obj: commands.c makeint.h dep.h commands.h filedef.h variable.h job.h
-default.obj: default.c makeint.h rule.h dep.h job.h filedef.h commands.h variable.h
-dir.obj: dir.c makeint.h hash.h [.glob]glob.h
-expand.obj: expand.c makeint.h commands.h filedef.h job.h rule.h variable.h
-file.obj: file.c makeint.h commands.h dep.h filedef.h variable.h job.h debug.h
-function.obj: function.c makeint.h variable.h dep.h commands.h filedef.h debug.h job.h
-getopt.obj: getopt.c getopt.h config.h gettext.h
-getopt1.obj: getopt1.c getopt.h config.h
-guile.obj: guile.c makeint.h debug.h dep.h gmk-default.h
-hash.obj: hash.c makeint.h hash.h
-implicit.obj: implicit.c makeint.h rule.h dep.h filedef.h debug.h variable.h job.h commands.h
-job.obj: job.c vmsjobs.c makeint.h commands.h job.h filedef.h variable.h debug.h
-output.obj: output.c vmsjobs.c makeint.h output.h filedef.h debug.h
-load.obj: load.c makeint.h debug.h filedef.h variable.h
-main.obj: main.c makeint.h commands.h dep.h filedef.h variable.h job.h rule.h debug.h getopt.h
-misc.obj: misc.c makeint.h dep.h debug.h
-read.obj: read.c makeint.h commands.h dep.h filedef.h variable.h [.glob]glob.h debug.h rule.h job.h
-remake.obj: remake.c makeint.h commands.h job.h dep.h filedef.h variable.h debug.h
-remote-stub.obj: remote-stub.c makeint.h filedef.h job.h commands.h
-rule.obj: rule.c makeint.h commands.h dep.h filedef.h variable.h rule.h job.h
-signame.obj: signame.c makeint.h
-strcache.obj: strcache.c makeint.h hash.h
-variable.obj: variable.c makeint.h commands.h variable.h dep.h filedef.h job.h rule.h
+ar.obj: ar.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h dep.h \
+ [.glob]fnmatch.h
+arscan.obj: arscan.c makeint.h config.h gnumake.h gettext.h
+commands.obj: commands.c makeint.h config.h gnumake.h gettext.h filedef.h \
+ hash.h dep.h variable.h job.h output.h commands.h
+default.obj: default.c makeint.h config.h gnumake.h gettext.h filedef.h \
+ hash.h variable.h rule.h dep.h job.h output.h commands.h
+dir.obj: dir.c makeint.h config.h gnumake.h gettext.h hash.h filedef.h \
+ dep.h [.glob]glob.h
+expand.obj: expand.c makeint.h config.h gnumake.h gettext.h filedef.h \
+ hash.h job.h output.h commands.h variable.h rule.h
+file.obj: file.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
+ dep.h job.h output.h commands.h variable.h debug.h
+[.glob]fnmatch.obj: [.glob]fnmatch.c config.h [.glob]fnmatch.h
+function.obj: function.c makeint.h config.h gnumake.h gettext.h filedef.h \
+ hash.h variable.h dep.h job.h output.h commands.h debug.h
+getopt.obj: getopt.c config.h gettext.h getopt.h
+getopt1.obj: getopt1.c config.h getopt.h
+[.glob]glob.obj: [.glob]glob.c config.h [.glob]fnmatch.h [.glob]glob.h
+guile.obj: guile.c makeint.h config.h gnumake.h gettext.h
+hash.obj: hash.c makeint.h config.h gnumake.h gettext.h hash.h
+implicit.obj: implicit.c makeint.h config.h gnumake.h gettext.h filedef.h \
+ hash.h rule.h dep.h debug.h variable.h job.h output.h commands.h
+job.obj: job.c makeint.h config.h gnumake.h gettext.h job.h output.h debug.h \
+ filedef.h hash.h commands.h variable.h debug.h vmsjobs.c
+load.obj: load.c makeint.h config.h gnumake.h gettext.h
+main.obj: main.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
+ dep.h variable.h job.h output.h commands.h rule.h debug.h getopt.h
+misc.obj: misc.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
+ dep.h debug.h
+output.obj: output.c makeint.h config.h gnumake.h gettext.h job.h output.h
+read.obj: read.c makeint.h config.h gnumake.h gettext.h [.glob]glob.h \
+ filedef.h hash.h dep.h job.h output.h commands.h variable.h rule.h \
+ debug.h
+remake.obj: remake.c makeint.h config.h gnumake.h gettext.h filedef.h \
+ hash.h job.h output.h commands.h dep.h variable.h debug.h
+remote-stub.obj: remote-stub.c makeint.h config.h gnumake.h gettext.h \
+ filedef.h hash.h job.h output.h commands.h
+rule.obj: rule.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
+ dep.h job.h output.h commands.h variable.h rule.h
+signame.obj: signame.c makeint.h config.h gnumake.h gettext.h
+strcache.obj: strcache.c makeint.h config.h gnumake.h gettext.h hash.h
+variable.obj: variable.c makeint.h config.h gnumake.h gettext.h filedef.h \
+ hash.h dep.h job.h output.h commands.h variable.h rule.h
version.obj: version.c config.h
-vmsfunctions.obj: vmsfunctions.c makeint.h vmsdir.h debug.h job.h
+vmsfunctions.obj: vmsfunctions.c makeint.h config.h gnumake.h gettext.h \
+ debug.h job.h output.h vmsdir.h
vmsify.obj: vmsify.c
-vpath.obj: vpath.c makeint.h filedef.h variable.h
-[.glob]fnmatch.obj: [.glob]fnmatch.c [.glob]fnmatch.h config.h
-[.glob]glob.obj: [.glob]glob.c [.glob]glob.h [.glob]fnmatch.h config.h
+vpath.obj: vpath.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
+ variable.h
config.h: config.h-vms
$(CP) $< $@
diff --git a/prepare_vms.com b/prepare_vms.com
new file mode 100644
index 0000000..04f581f
--- /dev/null
+++ b/prepare_vms.com
@@ -0,0 +1,59 @@
+$!
+$! prepare_vms.com - Build config.h-vms from master on VMS.
+$!
+$! This is used for building off the master instead of a release tarball.
+$!
+$!
+$!
+$! First try ODS-5, Pathworks V6 or UNZIP name.
+$!
+$ config_template = f$search("sys$disk:[]config*h-vms.template")
+$ if config_template .eqs. ""
+$ then
+$!
+$! Try NFS, VMStar, or Pathworks V5 ODS-2 encoded name.
+$!
+$ config_template = f$search("sys$disk:[]config.h-vms*template")
+$ if config_template .eqs. ""
+$ then
+$ write sys$output "Could not find config.h-vms*template!"
+$ exit 44
+$ endif
+$ endif
+$ config_template_file = f$parse(config_template,,,"name")
+$ config_template_type = f$parse(config_template,,,"type")
+$ config_template = "sys$disk:[]" + config_template_file + config_template_type
+$!
+$!
+$! Pull the package and version from configure.ac
+$!
+$ open/read ac_file sys$disk:[]configure.ac
+$ac_read_loop:
+$ read ac_file/end=ac_read_loop_end line_in
+$ key = f$extract(0, 7, line_in)
+$ if key .nes. "AC_INIT" then goto ac_read_loop
+$ package = f$element (1,"[",line_in)
+$ package = f$element (0,"]",package)
+$ version = f$element (2,"[",line_in)
+$ version = f$element (0,"]",version)
+$ac_read_loop_end:
+$ close ac_file
+$!
+$ if (package .eqs. "") .or. (version .eqs. "")
+$ then
+$ write sys$output "Unable to determine package and/or version!"
+$ exit 44
+$ endif
+$!
+$!
+$ outfile = "sys$disk:[]config.h-vms"
+$!
+$! Note the pipe command is close to the length of 255, which is the
+$! maximum token length prior to VMS V8.2:
+$! %DCL-W-TKNOVF, command element is too long - shorten
+$ pipe (write sys$output "sub/%PACKAGE%/''package'/WHOLE/NOTYPE" ;-
+ write sys$output "sub/%VERSION%/''version'/WHOLE/NOTYPE" ;-
+ write sys$output "exit") |-
+ edit/edt 'config_template'/out='outfile'/command=sys$pipe >nla0:
+$!
+$ write sys$output package, ", version: ", version, " prepared for VMS"
--
1.7.10.4