summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorTodd T. Fries <todd@cvs.openbsd.org>2002-01-23 06:02:20 +0000
committerTodd T. Fries <todd@cvs.openbsd.org>2002-01-23 06:02:20 +0000
commit90e611c886f1352d0cd29eba6ba8517293abe8ec (patch)
tree2b314d876e1bb3f2a10b08acf3d8d33afb80f36f /etc
parent9d6780b3ebdb2fc788e0cd0af82c001a10b3f3a1 (diff)
add target macros as a result of a conversation with mickey; cleaner look
Diffstat (limited to 'etc')
-rw-r--r--etc/MAKEDEV.sub75
1 files changed, 71 insertions, 4 deletions
diff --git a/etc/MAKEDEV.sub b/etc/MAKEDEV.sub
index ef6e5a27759..42c89886a24 100644
--- a/etc/MAKEDEV.sub
+++ b/etc/MAKEDEV.sub
@@ -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 Copyright (c) 2001 Todd T. Fries <todd@OpenBSD.org>
dnl All rights reserved.
@@ -74,8 +74,8 @@ dnl store a version string for 'this' file
dnl
dnl vers ( uniqueidstring, versionstring, subdir )
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 if subdir is defined, prepend it to the filename in the version string
dnl
@@ -86,7 +86,7 @@ define({-vers-},
dnl
dnl Version info for this file:
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
define({-_addsubdir-},
@@ -289,6 +289,26 @@ ifelse({-$3-},{--},
{-undefine({-_dt-},{-_do-})-},dnl <--- The END
{-_dl(shift(shift($@)))-})-})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
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 nothing
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