Do we need to export OSVERSION?

Max Okumoto okumoto at ucsd.edu
Wed Apr 20 11:47:10 PDT 2005


Hi Matt,

Running into a problems with OSVERSION and the
semantics of .EXPORT:

Variables set in the command line and MAKEFLAGS
are readonly.  Nothing in the makefiles are able
to modified thier values. (POSIX)

This is compatible with .EXPORT:
     o if variable does not exist create it and
       export it to the enviornment, as empty string.
     o if variable exists, export it to the enviornment
       with its value.
     o if variable that is exported is set after being
       exported, export its new value.

     o if variable is from command line or MAKEFLAGS
       do net change is value, or modify the enviornment.
       Emit a warning.


All of this works fine execpt that in /usr/ports/Mk/bsd.port.mk
and /usr/ports/Mk/bsd.port.subdir.mk they use MAKEFLAGS to pass
OSVERSION. :-P

  # These won't change, so we can pass them through the environment
  .MAKEFLAGS: \
        ARCH="${ARCH:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
        OPSYS="${OPSYS:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
        OSREL="${OSREL:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
        OSVERSION="${OSVERSION:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
        PORTOBJFORMAT="${PORTOBJFORMAT:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
        SYSTEMVERSION="${SYSTEMVERSION:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}"

In our /usr/share/mk/* files we use .makeenv (.EXPORT:)
to put OSVERSION into the enviornment.  So of course
warnings start popping up line mushrooms. :-(

I have a few solutions:
       1. hack make(1) to special case OSVERSION variable (worst)

       2. change the semantics of .EXPORT: to allow changes
          to command line variables.

       3. some how convince the port maintainers to stop passing
          OSVERSION through MAKEFLAGS.

       4. change /usr/share/mk/bsd.port.mk and others to
          not export OSVERSION.

I think #4 is the easiest and would not break things, but I 
am not sure it would not break things.  Why did we use .makeenv
for OSVERSION?

                     Max










More information about the Kernel mailing list