Do we need to export OSVERSION?

Max Okumoto okumoto at
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/
and /usr/ports/Mk/ they use MAKEFLAGS to pass

  # These won't change, so we can pass them through the environment
        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}" \

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/ 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


More information about the Kernel mailing list