Makefile.usermode revision 1.15
1# $NetBSD: Makefile.usermode,v 1.15 2011/08/28 23:16:18 jmcneill Exp $
2
3MACHINE_ARCH=			usermode
4USETOOLS?=			no
5NEED_OWN_INSTALL_TARGET?=	no
6.include <bsd.own.mk>
7
8##
9## (1) port identification
10##
11USERMODE=	$S/arch/usermode
12GENASSYM_CONF=	${USERMODE}/usermode/genassym.cf
13
14##
15## (2) compile settings
16##
17USERMODE_LIBS=	-lrt
18USERMODE_CPPFLAGS=-U_KERNEL -I/usr/include
19USERMODE_CPPFLAGS+=${CWARNFLAGS} ${NOGCCERROR:D:U-Werror}
20
21DEFCOPTS=	-fno-omit-frame-pointer
22CPPFLAGS+=	-Dusermode
23CPPFLAGS.init_main.c+=	-Dmain=kernmain
24
25OPT_SDL=	%SDL%
26.if !empty(OPT_SDL)
27SDL_CFLAGS!=	sdl-config --cflags
28SDL_LIBS!=	sdl-config --libs
29USERMODE_LIBS+=	-Wl,-Bdynamic ${SDL_LIBS}
30.endif
31
32CPPFLAGS.thunk.c+=	${USERMODE_CPPFLAGS}
33CPPFLAGS.thunk_sdl.c+=	${SDL_CFLAGS} ${USERMODE_CPPFLAGS}
34
35##
36## (3) libkern and compat
37##
38KERN_AS=	obj
39COMPAT_AS=	obj
40
41##
42## (4) local objects, compile rules, and dependencies
43##
44MD_OBJS=	thunk.o
45MD_CFILES=	${USERMODE}/usermode/thunk.c
46.if !empty(OPT_SDL)
47MD_OBJS+=	thunk_sdl.o
48MD_CFILES+=	${USERMODE}/usermode/thunk_sdl.c
49.endif
50MD_SFILES=
51
52##
53## (5) link settings
54##
55SYSTEM_LD=	@${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}"; \
56		${_MKSHECHO}\
57		${CC} ${COPTS} -Wl,-Map,$@.map,-Bstatic -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o ${USERMODE_LIBS}; \
58		${CC} ${COPTS} -Wl,-Map,$@.map,-Bstatic -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o ${USERMODE_LIBS}
59NVFLAGS=	-n
60
61##
62## (6) port specific target dependencies
63##
64
65.if !make(obj) && !make(clean) && !make(cleandir)
66.BEGIN:
67	@rm -f i386 && \
68		ln -s $S/arch/i386/include i386
69.endif
70
71thunk.d: ${USERMODE}/usermode/thunk.c
72	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
73	    ${CPPFLAGS.thunk.c} ${USERMODE}/usermode/thunk.c
74
75thunk.o: ${USERMODE}/usermode/thunk.c
76	${CC} ${CPPFLAGS.thunk.c} -c -o $@ ${USERMODE}/usermode/thunk.c
77
78thunk_sdl.d: ${USERMODE}/usermode/thunk.c
79	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
80	    ${CPPFLAGS.thunk_sdl.c} ${USERMODE}/usermode/thunk_sdl.c
81
82thunk_sdl.o: ${USERMODE}/usermode/thunk_sdl.c
83	${CC} ${CPPFLAGS.thunk_sdl.c} -c -o $@ ${USERMODE}/usermode/thunk_sdl.c
84
85##
86## (7) misc settings
87##
88
89##
90## (8) config(8) generated machinery
91%INCLUDES
92
93%OBJS
94
95%CFILES
96
97%SFILES
98
99%LOAD
100
101%RULES
102
103##
104## (9) port independent kernel machinery
105##
106.include "$S/conf/Makefile.kern.inc"
107
108##
109## (10) appending make options
110##
111%MAKEOPTIONSAPPEND
112