1246145Shselasky#
2246145Shselasky# $FreeBSD: stable/11/stand/kshim/kshim.mk 269541 2014-08-04 23:00:13Z brooks $
3246145Shselasky#
4269541Sbrooks# Copyright (c) 2013 Hans Petter Selasky.
5269541Sbrooks# Copyright (c) 2014 SRI International
6269541Sbrooks# All rights reserved.
7246145Shselasky#
8269541Sbrooks# This software was developed by SRI International and the University of
9269541Sbrooks# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
10269541Sbrooks# ("CTSRD"), as part of the DARPA CRASH research programme.
11269541Sbrooks#
12246145Shselasky# Redistribution and use in source and binary forms, with or without
13246145Shselasky# modification, are permitted provided that the following conditions
14246145Shselasky# are met:
15246145Shselasky# 1. Redistributions of source code must retain the above copyright
16246145Shselasky#    notice, this list of conditions and the following disclaimer.
17246145Shselasky# 2. Redistributions in binary form must reproduce the above copyright
18246145Shselasky#    notice, this list of conditions and the following disclaimer in the
19246145Shselasky#    documentation and/or other materials provided with the distribution.
20246145Shselasky#
21246145Shselasky# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22246145Shselasky# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23246145Shselasky# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24246145Shselasky# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25246145Shselasky# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26246145Shselasky# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27246145Shselasky# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28246145Shselasky# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29246145Shselasky# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30246145Shselasky# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31246145Shselasky# SUCH DAMAGE.
32246145Shselasky#
33246145Shselasky
34269541SbrooksKSHIM_DIR:=	${.PARSEDIR}
35269541Sbrooks.PATH:		${KSHIM_DIR}
36246145Shselasky
37269541SbrooksCFLAGS+=	-I${KSHIM_DIR}
38269541SbrooksCFLAGS+=	-I${KSHIM_DIR}/../..
39246359ShselaskyCFLAGS+=	-DUSB_GLOBAL_INCLUDE_FILE=\"bsd_global.h\"
40266882ShselaskyCFLAGS+=	-DHAVE_ENDIAN_DEFS
41246145Shselasky
42246145Shselasky#
43246145Shselasky# Single threaded BSD kernel
44246145Shselasky#
45269541SbrooksKSRCS+=	bsd_kernel.c
46246145Shselasky
47246145Shselasky#
48246145Shselasky# BUSSPACE implementation
49246145Shselasky#
50269541SbrooksKSRCS+=	bsd_busspace.c
51246145Shselasky
52246145ShselaskySRCS+=	sysinit_data.c
53246145ShselaskySRCS+=	sysuninit_data.c
54246145Shselasky
55246145ShselaskyCLEANFILES+= sysinit.bin
56246145ShselaskyCLEANFILES+= sysinit_data.c
57246145ShselaskyCLEANFILES+= sysuninit_data.c
58246145Shselasky
59269541SbrooksSRCS+=	${KSRCS}
60269541SbrooksSYSINIT_OBJS=	${KSRCS:R:C/$/.osys/}
61269541SbrooksCLEANFILES+=	${SYSINIT_OBJS}
62246145Shselasky
63246145Shselasky#
64246145Shselasky# SYSINIT() and SYSUNINIT() handling
65246145Shselasky#
66246145Shselasky
67269541Sbrookssysinit_data.c: sysinit.bin
68269541Sbrooks	sysinit -i sysinit.bin -o ${.TARGET} -k sysinit -s sysinit_data
69246145Shselasky
70269541Sbrookssysuninit_data.c: sysinit.bin
71269541Sbrooks	sysinit -i sysinit.bin -o ${.TARGET} -R -k sysuninit -s sysuninit_data
72246145Shselasky
73269541Sbrooks.for KSRC in ${KSRCS:R}
74269541Sbrooks${KSRC}.osys: ${KSRC}.o
75269541Sbrooks	${OBJCOPY} -j ".debug.sysinit" -O binary ${KSRC}.o ${KSRC}.osys
76246145Shselasky.endfor
77246145Shselasky
78269541Sbrookssysinit.bin: ${SYSINIT_OBJS}
79246145Shselasky	cat ${.ALLSRC} > sysinit.bin
80