[BACK]Return to MAKEDEV.mansub CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/MAKEDEV.mansub, Revision 1.2

1.2     ! miod        1: dnl    $OpenBSD: MAKEDEV.mansub,v 1.1 2004/02/16 19:03:30 miod Exp $
1.1       miod        2: dnl
                      3: dnl Copyright (c) 2004, Miodrag Vallat
                      4: dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
                      5: dnl
                      6: dnl Permission to use, copy, modify, and distribute this software for any
                      7: dnl purpose with or without fee is hereby granted, provided that the above
                      8: dnl copyright notice and this permission notice appear in all copies.
                      9: dnl
                     10: dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     11: dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     12: dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     13: dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14: dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     15: dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     16: dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     17: dnl
                     18: dnl This file is an m4 file, really. It's a clone of MAKEDEV.sub, then
                     19: dnl adapted to mdoc output. This means, mostly removed from any non-trivial
                     20: dnl content...
                     21: dnl
                     22: dnl o First, a change of quote to make shell statements like: `command`
                     23: dnl   possible
                     24: dnl
                     25: changequote(`{-', `-}')dnl
                     26: dnl
                     27: dnl o version info must be stripped of $ so we can say 'generated from' below
                     28: dnl
                     29: dnl  If we just use the version string how are we going to know what arch
                     30: dnl  'MAKEDEV.md,v' came from?
                     31: dnl
                     32: dnl  Thus, I have used the below to create a version string looking like
                     33: dnl  'OpenBSD: etc.sparc/MAKEDEV.inc,v...' which works, although requires
                     34: dnl  some attention if ported to another Id string setup.
                     35: dnl
                     36: dnl
                     37: dnl Initialize the stacks stored in _m4_*
                     38: dnl
                     39: undefine({-_m4_cvs_ver-})dnl
                     40: pushdef({-_m4_cvs_ver-}, {-done-})dnl
                     41: dnl
                     42: undefine({-_m4_devs-})dnl
                     43: pushdef({-_m4_devs-}, {-done-})dnl
                     44: dnl
                     45: undefine({-_m4_disks-})dnl
                     46: undefine({-_m4_disks2-})dnl
                     47: pushdef({-_m4_disks-}, {-done-})dnl
                     48: pushdef({-_m4_disks2-}, {-done-})dnl
                     49: dnl
                     50: dnl define stack 'add to' functions, only unique names queued
                     51: dnl
                     52: define({-ver_q-}, {-ifelse(index($1_ver, y), 0, ,
                     53: {-pushdef({-_m4_cvs_ver-}, {-$2-})define({-$1_ver-}, {-y-})-})-})dnl ver_q
                     54: dnl
                     55: define({-dev_q-}, {-ifelse(index(_q_$1_dev, :), 0,
                     56: {-errprint({-duplicated dev id: $1 at -}__file__{-:-}__line__ originally at _q_$1_dev)-},
                     57: {-pushdef({-_m4_devs-}, {-$1-})dnl
                     58: define({-_q_$1_dev-}, {-:-}__file__{-:-}__line__)-})-})dnl dev_q
                     59: dnl
                     60: define({-disk_q-}, {-ifelse(index(_q_$1_disk, :), 0,
                     61: {-errprint({-duplicated disk id: $1 at -}__file__{-:-}__line__ originally at _q_$1_disk)-}, {-pushdef({-_m4_disks-}, {-$1-})dnl
                     62: pushdef({-_m4_disks2-}, {-$1-})dnl
                     63: define({-_q_$1_disks-}, {-:-}__file__{-:-}__line__)-})-})dnl disk_q
                     64: dnl
                     65: dnl store a version string for 'this' file
                     66: dnl
                     67: dnl vers ( uniqueidstring, versionstring, subdir )
                     68: dnl
1.2     ! miod       69: dnl example1: vers(__file__, {-$OpenBSD: MAKEDEV.mansub,v 1.1 2004/02/16 19:03:30 miod Exp $-})
        !            70: dnl example2: vers(__file__, {-$OpenBSD: MAKEDEV.mansub,v 1.1 2004/02/16 19:03:30 miod Exp $-}, etc.MACHINE)
1.1       miod       71: dnl
                     72: dnl if subdir is defined, prepend it to the filename in the version string
                     73: dnl
                     74: define({-vers-},
                     75: {-ifelse({-$3-}, {--},
                     76: {-ver_q(hstcl({-$1-}), {-translit({-{-$2-}-}, {-$-}, {--})-})-},
                     77: {-ver_q(hstcl({-$1-}), {-_addsubdir({-{-$2-}-}, $3)-})-})-})dnl
                     78: dnl
                     79: dnl Version info for this file:
                     80: dnl
1.2     ! miod       81: vers(__file__, {-$OpenBSD: MAKEDEV.mansub,v 1.1 2004/02/16 19:03:30 miod Exp $-})dnl
1.1       miod       82: dnl
                     83: dnl
                     84: define({-_addsubdir-},
                     85: {-patsubst({-$1-}, {-\$(OpenBSD:) ([^\$]*)\$-}, {-\1 $2/\2-})-})dnl
                     86: dnl
                     87: dnl do the 'showing' of the version info
                     88: dnl
                     89: define({-do_vers-}, {-COMM     $1-})dnl
                     90: dnl
                     91: dnl show version function, to be called at the place when all versions are
                     92: dnl   queued, and it is time to show all of them
                     93: dnl
                     94: define({-show_vers-},
                     95: {-ifelse(_m4_cvs_ver, {-done-}, {--},
                     96: {-do_vers(_m4_cvs_ver)
                     97: popdef({-_m4_cvs_ver-})dnl
                     98: show_vers()dnl
                     99: -})-})dnl
                    100: dnl
1.2     ! miod      101: dnl _devxr(name,optional different xr name)
        !           102: dnl
        !           103: define({-_devxr-},{-.Xr $1 ifelse(index($1,{- -}),-1,{-4 -})-})dnl
1.1       miod      104: dnl
                    105: dnl _devitem(pattern, description)
                    106: dnl
1.2     ! miod      107: define({-_devitem-},{-.It Ar $2
        !           108: $3{--}ifelse($4,nothing,,{-, see
        !           109: _devxr({-ifelse($4,,$1,$4)-})-})dnl
        !           110: .-})dnl
1.1       miod      111: dnl
                    112: dnl _devtitle(name,description)
                    113: dnl
                    114: define({-_devtitle-},{-ifelse($1,make,,{-.El
                    115: -}).Pp
                    116: .Sy $2
                    117: .Bl -tag -width tenletters -compact-})dnl
                    118: dnl
                    119: dnl _DEV(name, [character major], [block major])
                    120: dnl
                    121: define({-_DEV-}, {-$1_dev{--}dnl
                    122: define({-$1__DEV-}, {-Y-})-})dnl
                    123: dnl
                    124: define({-_MKDEV-}, {-$1_mkdev-})dnl
                    125: define({-_TITLE-}, {-$1_title-})dnl
1.2     ! miod      126: dnl
        !           127: define({-__devitem-}, {-define($1_dev, {-_devitem($1,$2,$3,$4)-})-})dnl
        !           128: dnl
1.1       miod      129: define({-__devtitle-}, {-define($1_title, {-_devtitle($1,$2)-})-})dnl
                    130: define({-_mkdev-})dnl
                    131: define({-_mcdev-})dnl
                    132: define({-_cdev-})dnl
                    133: define({-__mkdev-})dnl
                    134: define({-target-})dnl
                    135: define({-twrget-})dnl