Browse Source

add target macros as a result of a conversation with mickey; cleaner look

OPENBSD_3_1
todd 23 years ago
parent
commit
7394365be8
1 changed files with 71 additions and 4 deletions
  1. +71
    -4
      src/etc/MAKEDEV.sub

+ 71
- 4
src/etc/MAKEDEV.sub View File

@ -1,4 +1,4 @@
dnl $OpenBSD: MAKEDEV.sub,v 1.4 2002/01/07 06:54:10 todd Exp $
dnl $OpenBSD: MAKEDEV.sub,v 1.5 2002/01/23 06:02:19 todd Exp $
dnl dnl
dnl Copyright (c) 2001 Todd T. Fries <todd@OpenBSD.org> dnl Copyright (c) 2001 Todd T. Fries <todd@OpenBSD.org>
dnl All rights reserved. dnl All rights reserved.
@ -74,8 +74,8 @@ dnl store a version string for 'this' file
dnl dnl
dnl vers ( uniqueidstring, versionstring, subdir ) dnl vers ( uniqueidstring, versionstring, subdir )
dnl dnl
dnl example1: vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.4 2002/01/07 06:54:10 todd Exp $-})
dnl example2: vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.4 2002/01/07 06:54:10 todd Exp $-},etc.MACHINE)
dnl example1: vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.5 2002/01/23 06:02:19 todd Exp $-})
dnl example2: vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.5 2002/01/23 06:02:19 todd Exp $-},etc.MACHINE)
dnl dnl
dnl if subdir is defined, prepend it to the filename in the version string dnl if subdir is defined, prepend it to the filename in the version string
dnl dnl
@ -86,7 +86,7 @@ define({-vers-},
dnl dnl
dnl Version info for this file: dnl Version info for this file:
dnl dnl
vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.4 2002/01/07 06:54:10 todd Exp $-})dnl
vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.5 2002/01/23 06:02:19 todd Exp $-})dnl
dnl dnl
dnl dnl
define({-_addsubdir-}, define({-_addsubdir-},
@ -289,6 +289,26 @@ ifelse({-$3-},{--},
{-undefine({-_dt-},{-_do-})-},dnl <--- The END {-undefine({-_dt-},{-_do-})-},dnl <--- The END
{-_dl(shift(shift($@)))-})-})dnl {-_dl(shift(shift($@)))-})-})dnl
dnl dnl
dnl
define({-_show_target-},{-dnl
ifdef({-$1__DEV-},{-disp_dev({-$2-})-})dnl
ifelse({-$3-},{--},
{-_disp_dev_end()-},dnl <--- The END
{-_show_target(shift(shift($@)))-})-})dnl
dnl
define({-disp_dev-},{-dnl
ifdef({-_disp_dev_tab-},,{-define({-_disp_dev_tab-})-})dnl
ifdef({-_disp_dev_len-},,{-dnl
define({-_disp_dev_len-},0)dnl
_disp_dev_tab{--}_recurse{--}dnl
define({-_disp_dev_tab-},{- -})-})dnl
ifelse(eval(len($1)+_disp_dev_len<60),1,
{- $1{--}define({-_disp_dev_len-},eval(1+_disp_dev_len+len($1)))-},{-
_disp_dev_tab{--}_recurse $1{--}dnl
define({-_disp_dev_len-},len($1))-})dnl
-})dnl
define({-_disp_dev_end-},{-undefine({-_disp_dev_tab-},{-_disp_dev_len-})-})dnl
dnl
dnl A word about the above: dnl A word about the above:
dnl dnl
dnl _dt -> 'tab' .. at first, defined to nothing, as the tab is already there dnl _dt -> 'tab' .. at first, defined to nothing, as the tab is already there
@ -307,3 +327,50 @@ dnl ifstep(devstr)
dnl .. if stepping is defined for the particular device, emit ' step', else dnl .. if stepping is defined for the particular device, emit ' step', else
dnl nothing dnl nothing
define({-ifstep-},{-ifdef({-step_$1-},{- -}step_$1{--})-})dnl define({-ifstep-},{-ifdef({-step_$1-},{- -}step_$1{--})-})dnl
dnl
dnl
define({-target-},{-twrget({-$1-},{-$2-},{-$2-},shift(shift($@)))-})dnl
dnl
dnl twrget(target,devname,prefix,str1,str2,str3)
dnl $1 $2 $3 $4 $5 $6
dnl
define({-twrget-},{-dnl
dnl
ifdef({-$1_target-},,{-pushdef({-$1_target-},{-done-})-})dnl
dnl
ifelse({-$4-},,,{-dnl
ifelse({-$4-},{-_done-},,{-dnl
ifelse({-$5-},,,{-dnl
dnl errprint({-recurse: $1,$2,$3,$4,$5,$6,...-})dnl
twrget({-$1-},{-$2-},{-$3-},shift(shift(shift(shift($@)))))dnl
-})-})-})dnl
dnl
ifelse({-$4-},{-_done-},,{-dnl
dnl errprint({-recurse: $1_$2_dev,$3$4,$3$4,_done-})dnl
twrget({-$1_$2_dev-},{-$3$4-},{-$3$4-},{-_done-})dnl
-})dnl
dnl
ifdef({-$1$2target-},,{-dnl
pushdef({-$1_target-},{-$2-})define({-$1$2target-})dnl
-})dnl
dnl
-})dnl
dnl
dnl
define({-show_target-},{-dnl
ifelse($1_target,{-done-},{-_disp_dev_end()-},
{-dnl $1_target:
show_dev($1,-}$1_target{-)dnl
popdef({-$1_target-})dnl
show_target({-$1-})dnl
-})-})dnl
dnl
define({-show_dev-},{-dnl
ifdef({-$2__DEV-},{-dnl
ifelse($1_$2_dev_target,{-done-},,{-dnl
disp_dev({-$1_$2_dev_target-})dnl
popdef({-$1_$2_dev_target-})dnl
show_dev({-$1-},{-$2-})-})dnl
-})dnl
-})dnl
dnl

Loading…
Cancel
Save