Home | History | Annotate | Line # | Download | only in libkern
Makefile revision 1.4
      1 #	$NetBSD: Makefile,v 1.4 2013/08/20 20:54:35 matt Exp $
      2 
      3 WITHOUT_MAN=true  # defined
      4 
      5 .include <bsd.obj.mk>		# Pull in OBJDIR name rules.
      6 .include <bsd.own.mk>
      7 
      8 LIB=	kern
      9 LIBISPRIVATE?=	yes
     10 DBG=	-Os
     11 
     12 S= ${NETBSDSRCDIR}/sys
     13 CPPFLAGS+= -nostdinc -I${.OBJDIR} -I${S} -I${S}/arch
     14 
     15 CPPFLAGS+= -D_STANDALONE
     16 
     17 COPTS+=	-ffreestanding
     18 COPTS+=	-fno-stack-protector
     19 COPTS+=	-fno-unwind-tables
     20 CWARNFLAGS+= -Werror
     21 CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
     22 
     23 .if !make(obj) && !make(clean) && !make(cleandir)
     24 .NOPATH: machine
     25 .endif
     26 
     27 realdepend realall: machine .WAIT
     28 CLEANFILES+= ${MACHINE_CPU} machine
     29 
     30 ARCHDIRS.i386=		x86
     31 ARCHDIRS.m68000=	m68k
     32 ARCHDIRS.sparc64=	sparc
     33 ARCHDIRS.x86_64=	x86
     34 MACHDIRS.sun2=		sun68k
     35 
     36 machine::
     37 .if ${MACHINE_CPU} == "arm"
     38 	ln -sf ${S}/arch/${MACHINE_CPU}/include machine
     39 .else
     40 	ln -sf ${S}/arch/${MACHINE}/include machine
     41 .endif
     42 .if !empty(ARCHDIRS.${MACHINE_ARCH})
     43 .for d in ${ARCHDIRS.${MACHINE_ARCH}}
     44 	ln -sf ${S}/arch/${d}/include ${d}
     45 .endfor
     46 .endif
     47 .if !empty(MACHDIRS.${MACHINE})
     48 .for d in ${MACHDIRS.${MACHINE}}
     49 	ln -sf ${S}/arch/${d}/include ${d}
     50 .endfor
     51 .endif
     52 	ln -sf ${S}/arch/${MACHINE_CPU}/include ${MACHINE_CPU}
     53 
     54 ${OBJS}: machine
     55 
     56 ### find out what to use for libkern
     57 KERN_AS=	library
     58 KERNDIR=	${S}/lib/libkern
     59 
     60 .include "${S}/lib/libkern/Makefile.libkern"
     61 .ifndef ARCHSUBDIR
     62 .BEGIN:
     63 	@echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU}
     64 	@false
     65 .endif
     66 
     67 .include <bsd.lib.mk>
     68 
     69 lib${LIB}.o:: ${OBJS}
     70 	@echo building standard ${LIB} library
     71 	@rm -f lib${LIB}.o
     72 	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
     73 
     74 lib${LIB}.po:: ${POBJS}
     75 	@echo building profiled ${LIB} library
     76 	@rm -f lib${LIB}.po
     77 	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
     78 
     79 showsources: ${SRCS}
     80 	@echo ${.ALLSRC}
     81