FreeBSD: make rules required for building on FreeBSD, don't merge! style
authorUlrich Spörlein <uqs@spoerlein.net>
Fri, 20 Nov 2009 12:16:58 +0000 (13:16 +0100)
committerUlrich Spörlein <uqs@spoerlein.net>
Thu, 30 Sep 2010 20:08:48 +0000 (22:08 +0200)
games/Makefile.inc

index 17c5ea6..a1749b1 100644 (file)
@@ -13,3 +13,36 @@ ORIGBINGRP:= ${BINGRP}
 BINGRP=                games
 BINMODE=       550
 .endif
+
+# cribbed from DragonflyBSD build system
+
+# Host arch, target arch is in MACHINE
+ARCH!= uname -p
+.if defined(MACHINE) && ${MACHINE} != ${ARCH}
+NXCC?=         PATH=/sbin:/bin:/usr/sbin:/usr/bin ${CC}        # this must not be a cross compiler
+.else
+NXCC?=         ${CC}
+.endif
+# weed out target specific cflags
+NXCFLAGS?=     ${CFLAGS:N-mtune*:N-mcpu*:N-march*:N-EL:N-G0:N-mno-dsp:N-mabicalls}
+
+.SUFFIXES: .nx .no
+
+# .no == native object file, for helper code when cross building.
+#
+.c.no:
+       ${NXCC} ${_${.IMPSRC:T}_FLAGS} ${NXCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+
+.y.no:
+       ${YACC} ${YFLAGS} ${.IMPSRC}
+       ${NXCC} ${NXCFLAGS} -c y.tab.c -o ${.TARGET}
+       rm -f y.tab.c
+
+.l.no:
+       ${LEX} ${LFLAGS} -o${.TARGET}.c ${.IMPSRC}
+       ${NXCC} ${NXCFLAGS} -c ${.TARGET}.c -o ${.TARGET}
+       rm -f ${.TARGET}.c
+
+.no.nx .c.nx:
+       ${NXCC} ${_${.IMPSRC:T}_FLAGS} ${NXCFLAGS} ${NXLDFLAGS} ${.IMPSRC} \
+           ${NXLDLIBS} -o ${.TARGET}