Home | History | Annotate | Line # | Download | only in conf
Makefile.usermode revision 1.18
      1 # $NetBSD: Makefile.usermode,v 1.18 2011/09/03 18:42:13 jmcneill Exp $
      2 
      3 OPT_CPU_HOST=			%CPU_HOST%
      4 .if !empty(OPT_CPU_HOST)
      5 MACHINE_ARCH=			${OPT_CPU_HOST}
      6 .else
      7 MACHINE_ARCH=			usermode
      8 .endif
      9 USETOOLS?=			no
     10 NEED_OWN_INSTALL_TARGET?=	no
     11 .include <bsd.own.mk>
     12 
     13 ##
     14 ## (1) port identification
     15 ##
     16 USERMODE=	$S/arch/usermode
     17 GENASSYM_CONF=	${USERMODE}/usermode/genassym.cf
     18 
     19 ##
     20 ## (2) compile settings
     21 ##
     22 USERMODE_HOSTOS!=uname -s
     23 USERMODE_HOSTMACHINE!=uname -m
     24 USERMODE_LIBS=	-lrt
     25 USERMODE_CPPFLAGS=-U_KERNEL -I/usr/include
     26 USERMODE_CPPFLAGS+=${CWARNFLAGS} ${NOGCCERROR:D:U-Werror}
     27 
     28 .if ${USERMODE_HOSTOS} == "Linux"
     29 USERMODE_LIBS+=	-lpthread
     30 CPPFLAGS+=-Dstrtoul=netbsd_strtoul
     31 CPPFLAGS+=-Dstrtoll=netbsd_strtoll
     32 CPPFLAGS+=-Dstrtoull=netbsd_strtoull
     33 .endif
     34 
     35 DEFCOPTS=	-fno-omit-frame-pointer
     36 CPPFLAGS+=	-Dusermode -D__NetBSD__ -Wno-unused-but-set-variable
     37 CPPFLAGS.init_main.c+=	-Dmain=kernmain
     38 
     39 OPT_SDL=	%SDL%
     40 OPT_URKELVISOR=	%URKELVISOR%
     41 
     42 .if !empty(OPT_SDL)
     43 SDL_CFLAGS!=	sdl-config --cflags
     44 SDL_LIBS!=	sdl-config --libs
     45 USERMODE_LIBS+=	-Wl,-Bdynamic ${SDL_LIBS}
     46 .endif
     47 
     48 CPPFLAGS.thunk.c+=	${USERMODE_CPPFLAGS}
     49 CPPFLAGS.thunk_sdl.c+=	${SDL_CFLAGS} ${USERMODE_CPPFLAGS}
     50 CPPFLAGS.urkelvisor.c+=	${USERMODE_CPPFLAGS}
     51 
     52 ##
     53 ## (3) libkern and compat
     54 ##
     55 KERN_AS=	library
     56 COMPAT_AS=	library
     57 
     58 ##
     59 ## (4) local objects, compile rules, and dependencies
     60 ##
     61 MD_OBJS=	thunk.o
     62 MD_CFILES=	${USERMODE}/usermode/thunk.c
     63 MD_SFILES=
     64 
     65 .if !empty(OPT_URKELVISOR)
     66 MD_OBJS+=	urkelvisor.o
     67 MD_CFILES+=	${USERMODE}/usermode/urkelvisor.c
     68 .endif
     69 
     70 .if !empty(OPT_SDL)
     71 MD_OBJS+=	thunk_sdl.o
     72 MD_CFILES+=	${USERMODE}/usermode/thunk_sdl.c
     73 .endif
     74 
     75 ##
     76 ## (5) link settings
     77 ##
     78 SYSTEM_LD=	@${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}"; \
     79 		${_MKSHECHO}\
     80 		${CC} -static ${COPTS} -Wl,-Map,$@.map -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o ${USERMODE_LIBS}; \
     81 		${CC} -static ${COPTS} -Wl,-Map,$@.map -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o ${USERMODE_LIBS}
     82 NVFLAGS=	-n
     83 
     84 ##
     85 ## (6) port specific target dependencies
     86 ##
     87 
     88 .if !make(obj) && !make(clean) && !make(cleandir)
     89 .BEGIN:
     90 	@rm -f i386 && \
     91 		ln -s $S/arch/i386/include i386
     92 .endif
     93 
     94 thunk.d: ${USERMODE}/usermode/thunk.c
     95 	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
     96 	    ${CPPFLAGS.thunk.c} ${USERMODE}/usermode/thunk.c
     97 
     98 thunk.o: ${USERMODE}/usermode/thunk.c
     99 	${CC} ${CPPFLAGS.thunk.c} -c -o $@ ${USERMODE}/usermode/thunk.c
    100 
    101 thunk_sdl.d: ${USERMODE}/usermode/thunk.c
    102 	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
    103 	    ${CPPFLAGS.thunk_sdl.c} ${USERMODE}/usermode/thunk_sdl.c
    104 
    105 thunk_sdl.o: ${USERMODE}/usermode/thunk_sdl.c
    106 	${CC} ${CPPFLAGS.thunk_sdl.c} -c -o $@ ${USERMODE}/usermode/thunk_sdl.c
    107 
    108 urkelvisor.d: ${USERMODE}/usermode/urkelvisor.c
    109 	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
    110 	    ${CPPFLAGS.urkelvisor.c} ${USERMODE}/usermode/urkelvisor.c
    111 
    112 urkelvisor.o: ${USERMODE}/usermode/urkelvisor.c
    113 	${CC} ${CPPFLAGS.urkelvisor.c} -c -o $@ ${USERMODE}/usermode/urkelvisor.c
    114 
    115 ##
    116 ## (7) misc settings
    117 ##
    118 
    119 ##
    120 ## (8) config(8) generated machinery
    121 %INCLUDES
    122 
    123 %OBJS
    124 
    125 %CFILES
    126 
    127 %SFILES
    128 
    129 %LOAD
    130 
    131 %RULES
    132 
    133 ##
    134 ## (9) port independent kernel machinery
    135 ##
    136 .include "$S/conf/Makefile.kern.inc"
    137 
    138 ##
    139 ## (10) appending make options
    140 ##
    141 %MAKEOPTIONSAPPEND
    142