Makefile.usermode revision 1.14
1# $NetBSD: Makefile.usermode,v 1.14 2011/08/25 11:06:29 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.o: ${USERMODE}/usermode/thunk.c
72	${CC} ${CPPFLAGS.thunk.c} -c -o $@ ${USERMODE}/usermode/thunk.c
73
74thunk_sdl.o: ${USERMODE}/usermode/thunk_sdl.c
75	${CC} ${CPPFLAGS.thunk_sdl.c} -c -o $@ ${USERMODE}/usermode/thunk_sdl.c
76
77##
78## (7) misc settings
79##
80
81##
82## (8) config(8) generated machinery
83%INCLUDES
84
85%OBJS
86
87%CFILES
88
89%SFILES
90
91%LOAD
92
93%RULES
94
95##
96## (9) port independent kernel machinery
97##
98.include "$S/conf/Makefile.kern.inc"
99
100##
101## (10) appending make options
102##
103%MAKEOPTIONSAPPEND
104