xref: /netbsd/sys/kern/Makefile (revision bf9ec67e)
1#	$NetBSD: Makefile,v 1.10 2001/04/05 19:49:40 jhawk Exp $
2#
3#	from: @(#)Makefile	8.2 (Berkeley) 3/21/94
4
5# Makefile for kernel tags files, init_sysent, etc.
6
7all:
8	@echo "make tags, links, init_sysent.c, or vnode_if.c only"
9	@false
10
11SYSCALLSRC = makesyscalls.sh syscalls.conf syscalls.master
12init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscallargs.h: ${SYSCALLSRC}
13	-mv -f init_sysent.c init_sysent.c.bak
14	-mv -f syscalls.c syscalls.c.bak
15	-mv -f ../sys/syscall.h ../sys/syscall.h.bak
16	-mv -f ../sys/syscallargs.h ../sys/syscallargs.h.bak
17	sh makesyscalls.sh syscalls.conf syscalls.master
18
19VNODEIFSRC = vnode_if.sh vnode_if.src
20vnode_if.c ../sys/vnode_if.h: ${VNODEIFSRC}
21	-mv -f vnode_if.c vnode_if.c.bak
22	-mv -f ../sys/vnode_if.h ../sys/vnode_if.h.bak
23	sh vnode_if.sh vnode_if.src
24
25
26# Kernel tags:
27# Tags files are built in the top-level directory for each architecture,
28# with a makefile listing the architecture-dependent files, etc.  The list
29# of common files is in ./Make.tags.inc.  Links to the correct tags file
30# are placed in each source directory.  We need to have links to tags files
31# from the generic directories that are relative to the machine type, even
32# via remote mounts; therefore we use symlinks to $SYSTAGS, which points at
33# ${SYSDIR}/arch/${MACHINE}/tags.
34
35# Note: only a couple of architectures are currently working right. Add more
36# to ARCH as you fix them. Use the i386 as a model.
37
38ARCH=	i386 mac68k
39
40SYSTAGS=/var/db/sys_tags
41SYSDIR=..
42
43.ifmake links
44# Directories in which to place tags links (other than machine-dependent):
45# The invocation below returns every directory that contains sources, the idea
46# being, in the face of a constantly varying source tree, that this will be
47# easier to maintain than a fixed list.
48DGEN!=	(cd ${SYSDIR};							\
49	    find -H . -name arch -prune -o -name "*.[chs]" -print |	\
50	    sed -e 's@^\./@@' -e 's@/[^/]*\..*@@' | sort -t / -u )
51.endif
52
53tags::
54	-for i in ${ARCH}; do \
55	    (cd ../arch/$$i && ${MAKE} ${MFLAGS} tags); done
56
57links::
58	rm -f ${SYSTAGS}
59	ln -s ${SYSDIR}/arch/${MACHINE}/tags ${SYSTAGS}
60	-for i in ${DGEN}; do \
61	    (cd ../$$i && { rm -f tags; ln -s ${SYSTAGS} tags; }); done
62	-for i in ${ARCH}; do \
63	    (cd ../arch/$$i && ${MAKE} ${MFLAGS} SYSTAGS=${SYSTAGS} links); done
64