Makefile.usermode revision 1.15 1 # $NetBSD: Makefile.usermode,v 1.15 2011/08/28 23:16:18 jmcneill Exp $
2
3 MACHINE_ARCH= usermode
4 USETOOLS?= no
5 NEED_OWN_INSTALL_TARGET?= no
6 .include <bsd.own.mk>
7
8 ##
9 ## (1) port identification
10 ##
11 USERMODE= $S/arch/usermode
12 GENASSYM_CONF= ${USERMODE}/usermode/genassym.cf
13
14 ##
15 ## (2) compile settings
16 ##
17 USERMODE_LIBS= -lrt
18 USERMODE_CPPFLAGS=-U_KERNEL -I/usr/include
19 USERMODE_CPPFLAGS+=${CWARNFLAGS} ${NOGCCERROR:D:U-Werror}
20
21 DEFCOPTS= -fno-omit-frame-pointer
22 CPPFLAGS+= -Dusermode
23 CPPFLAGS.init_main.c+= -Dmain=kernmain
24
25 OPT_SDL= %SDL%
26 .if !empty(OPT_SDL)
27 SDL_CFLAGS!= sdl-config --cflags
28 SDL_LIBS!= sdl-config --libs
29 USERMODE_LIBS+= -Wl,-Bdynamic ${SDL_LIBS}
30 .endif
31
32 CPPFLAGS.thunk.c+= ${USERMODE_CPPFLAGS}
33 CPPFLAGS.thunk_sdl.c+= ${SDL_CFLAGS} ${USERMODE_CPPFLAGS}
34
35 ##
36 ## (3) libkern and compat
37 ##
38 KERN_AS= obj
39 COMPAT_AS= obj
40
41 ##
42 ## (4) local objects, compile rules, and dependencies
43 ##
44 MD_OBJS= thunk.o
45 MD_CFILES= ${USERMODE}/usermode/thunk.c
46 .if !empty(OPT_SDL)
47 MD_OBJS+= thunk_sdl.o
48 MD_CFILES+= ${USERMODE}/usermode/thunk_sdl.c
49 .endif
50 MD_SFILES=
51
52 ##
53 ## (5) link settings
54 ##
55 SYSTEM_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}
59 NVFLAGS= -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
71 thunk.d: ${USERMODE}/usermode/thunk.c
72 ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
73 ${CPPFLAGS.thunk.c} ${USERMODE}/usermode/thunk.c
74
75 thunk.o: ${USERMODE}/usermode/thunk.c
76 ${CC} ${CPPFLAGS.thunk.c} -c -o $@ ${USERMODE}/usermode/thunk.c
77
78 thunk_sdl.d: ${USERMODE}/usermode/thunk.c
79 ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
80 ${CPPFLAGS.thunk_sdl.c} ${USERMODE}/usermode/thunk_sdl.c
81
82 thunk_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