summaryrefslogtreecommitdiff
path: root/sys/arch/loongson
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-05-31 22:21:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-05-31 22:21:45 +0000
commit5a95f7ec91d73027a0cb3cfad969e67da84aa980 (patch)
tree3dc0482b21e6cce79dc71912a2fac336fe24694c /sys/arch/loongson
parenta28226240cd918c9b04e30eb6121cf4a6b7f5e5a (diff)
Completely rewrite the tags file creation process. use config(8) against
a fat kernel (GERERIC or GENERIC.MP) into a temporary dir, then extract some variables using make -V, and after some more singing and dancing use this full and (more) correct list of files with ctags. Don't read this code. ok guenther
Diffstat (limited to 'sys/arch/loongson')
-rw-r--r--sys/arch/loongson/Makefile64
1 files changed, 35 insertions, 29 deletions
diff --git a/sys/arch/loongson/Makefile b/sys/arch/loongson/Makefile
index 698ee4de761..aa3504e3aec 100644
--- a/sys/arch/loongson/Makefile
+++ b/sys/arch/loongson/Makefile
@@ -1,36 +1,42 @@
-# $OpenBSD: Makefile,v 1.1 2010/02/14 22:39:31 miod Exp $
-
-# Makefile for loongson tags file and boot blocks
-
-S=${.CURDIR}/../..
-.include "$S/kern/Make.tags.inc"
-
+# $OpenBSD: Makefile,v 1.2 2010/05/31 22:21:43 deraadt Exp $
+
+S= ${.CURDIR}/../..
+KFILE= GENERIC
+.if exists(conf/GENERIC.MP)
+KFILE= GENERIC.MP
+.endif
+TDIRS= ${_arch} include pci isa eisa
+TAGS= ${.CURDIR}/tags
+
+NOPROG=
+NOMAN=
SUBDIR= stand
-NOPROG= noprog
-NOMAN= noman
-
-TLOONGSON= $S/arch/loongson/tags
-
-SLOONGSON= $S/arch/loongson/dev/*.[ch] $S/arch/loongson/include/*.h \
- $S/arch/loongson/loongson/*.[ch] \
- $S/arch/mips64/dev/*.[ch] $S/arch/mips64/include/*.h \
- $S/arch/mips64/mips64/*.[ch]
-ALOONGSON= $S/arch/loongson/loongson/*.S $S/arch/mips64/mips64/*.S
-
-# Directories in which to place tags links
-DLOONGSON= dev include loongson
-
-tags:
- -ctags -wdtf ${TLOONGSON} ${SLOONGSON} ${COMM}
- egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${ALOONGSON} | \
- sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
- >> ${TLOONGSON}
- sort -o ${TLOONGSON} ${TLOONGSON}
+# config the fattest kernel we can find into a temporary dir
+# to create a Makefile. Then use make to pull some variables
+# out and push them into the sub-shell to expand the paths,
+# and finally run ctags.
+tags::
+ TDIR=`mktemp -d /tmp/_tagXXXXXXXXXX` || exit 1; \
+ eval "S=${S}" && \
+ config -s ${S} -b $${TDIR} ${.CURDIR}/conf/${KFILE} && \
+ eval "_arch=\"`make -V _arch -f $${TDIR}/Makefile`\"" && \
+ eval "_mach=\"`make -V _mach -f $${TDIR}/Makefile`\"" && \
+ eval "_machdir=\$S/arch/$${_mach}" && \
+ eval "_archdir=\$S/arch/$${_arch}" && \
+ eval "SFILES=\"`make -V SFILES -f $${TDIR}/Makefile`\"" && \
+ eval "CFILES=\"`make -V CFILES -f $${TDIR}/Makefile`\"" && \
+ eval "AFILES=\"`make -V AFILES -f $${TDIR}/Makefile`\"" && \
+ ctags -wdt -f ${TAGS} $${CFILES} && \
+ egrep "^[_A-Z]*ENTRY[_A-Z]*\(.*\)" $${SFILES} $${AFILES} | \
+ sed "s;\\([^:]*\\):\\([^(]*\\)(\\([^, )]*\\)\\(.*\\);\\3 \\1 /^\\2(\\3\\4$$/;" \
+ >> ${TAGS} && \
+ sort -o ${TAGS} ${TAGS} && \
+ rm -rf $${TDIR}
links:
- -for i in ${DLOONGSON}; do \
- (cd $$i && { rm -f tags; ln -s ${TLOONGSON} tags; }) done
+ -for i in conf ${TDIRS}; do \
+ (cd $$i && rm -f tags; ln -s tags tags); done
obj: _SUBDIRUSE