xref: /freebsd/stand/kshim/kshim.mk (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1*ca987d46SWarner Losh#
2*ca987d46SWarner Losh#
3*ca987d46SWarner Losh# Copyright (c) 2013 Hans Petter Selasky.
4*ca987d46SWarner Losh# Copyright (c) 2014 SRI International
5*ca987d46SWarner Losh# All rights reserved.
6*ca987d46SWarner Losh#
7*ca987d46SWarner Losh# This software was developed by SRI International and the University of
8*ca987d46SWarner Losh# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
9*ca987d46SWarner Losh# ("CTSRD"), as part of the DARPA CRASH research programme.
10*ca987d46SWarner Losh#
11*ca987d46SWarner Losh# Redistribution and use in source and binary forms, with or without
12*ca987d46SWarner Losh# modification, are permitted provided that the following conditions
13*ca987d46SWarner Losh# are met:
14*ca987d46SWarner Losh# 1. Redistributions of source code must retain the above copyright
15*ca987d46SWarner Losh#    notice, this list of conditions and the following disclaimer.
16*ca987d46SWarner Losh# 2. Redistributions in binary form must reproduce the above copyright
17*ca987d46SWarner Losh#    notice, this list of conditions and the following disclaimer in the
18*ca987d46SWarner Losh#    documentation and/or other materials provided with the distribution.
19*ca987d46SWarner Losh#
20*ca987d46SWarner Losh# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21*ca987d46SWarner Losh# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*ca987d46SWarner Losh# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*ca987d46SWarner Losh# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24*ca987d46SWarner Losh# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25*ca987d46SWarner Losh# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26*ca987d46SWarner Losh# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27*ca987d46SWarner Losh# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28*ca987d46SWarner Losh# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29*ca987d46SWarner Losh# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30*ca987d46SWarner Losh# SUCH DAMAGE.
31*ca987d46SWarner Losh#
32*ca987d46SWarner Losh
33*ca987d46SWarner LoshKSHIM_DIR:=	${.PARSEDIR}
34*ca987d46SWarner Losh.PATH:		${KSHIM_DIR}
35*ca987d46SWarner Losh
36*ca987d46SWarner LoshCFLAGS+=	-I${KSHIM_DIR}
37*ca987d46SWarner LoshCFLAGS+=	-I${KSHIM_DIR}/../..
38*ca987d46SWarner LoshCFLAGS+=	-DUSB_GLOBAL_INCLUDE_FILE=\"bsd_global.h\"
39*ca987d46SWarner LoshCFLAGS+=	-DHAVE_ENDIAN_DEFS
40*ca987d46SWarner Losh
41*ca987d46SWarner Losh#
42*ca987d46SWarner Losh# Single threaded BSD kernel
43*ca987d46SWarner Losh#
44*ca987d46SWarner LoshKSRCS+=	bsd_kernel.c
45*ca987d46SWarner Losh
46*ca987d46SWarner Losh#
47*ca987d46SWarner Losh# BUSSPACE implementation
48*ca987d46SWarner Losh#
49*ca987d46SWarner LoshKSRCS+=	bsd_busspace.c
50*ca987d46SWarner Losh
51*ca987d46SWarner LoshSRCS+=	sysinit_data.c
52*ca987d46SWarner LoshSRCS+=	sysuninit_data.c
53*ca987d46SWarner Losh
54*ca987d46SWarner LoshCLEANFILES+= sysinit.bin
55*ca987d46SWarner LoshCLEANFILES+= sysinit_data.c
56*ca987d46SWarner LoshCLEANFILES+= sysuninit_data.c
57*ca987d46SWarner Losh
58*ca987d46SWarner LoshSRCS+=	${KSRCS}
59*ca987d46SWarner LoshSYSINIT_OBJS=	${KSRCS:R:C/$/.osys/}
60*ca987d46SWarner LoshCLEANFILES+=	${SYSINIT_OBJS}
61*ca987d46SWarner Losh
62*ca987d46SWarner Losh#
63*ca987d46SWarner Losh# SYSINIT() and SYSUNINIT() handling
64*ca987d46SWarner Losh#
65*ca987d46SWarner Losh
66*ca987d46SWarner Loshsysinit_data.c: sysinit.bin
67*ca987d46SWarner Losh	sysinit -i sysinit.bin -o ${.TARGET} -k sysinit -s sysinit_data
68*ca987d46SWarner Losh
69*ca987d46SWarner Loshsysuninit_data.c: sysinit.bin
70*ca987d46SWarner Losh	sysinit -i sysinit.bin -o ${.TARGET} -R -k sysuninit -s sysuninit_data
71*ca987d46SWarner Losh
72*ca987d46SWarner Losh.for KSRC in ${KSRCS:R}
73*ca987d46SWarner Losh${KSRC}.osys: ${KSRC}.o
74*ca987d46SWarner Losh	${OBJCOPY} -j ".debug.sysinit" -O binary ${KSRC}.o ${KSRC}.osys
75*ca987d46SWarner Losh.endfor
76*ca987d46SWarner Losh
77*ca987d46SWarner Loshsysinit.bin: ${SYSINIT_OBJS}
78*ca987d46SWarner Losh	cat ${.ALLSRC} > sysinit.bin
79