Date: Tue, 12 Jul 2011 22:00:56 +0200 From: Robert Millan <rmh@debian.org> To: Oliver Pinter <oliver.pntr@gmail.com>, freebsd-hackers@freebsd.org, Ed Maste <emaste@freebsd.org> Subject: Re: [PATCH] fake pre-processor macros when building on non-FreeBSD system Message-ID: <CAOfDtXMMej_KORBt1PvAdAL7VvEkzXjpHM=eO_%2BLh=fP5OfWmQ@mail.gmail.com> In-Reply-To: <CAPjTQNFp8dQBKdFzhPAX1NZ2j%2BLSsffZkOurN0yEb4M%2BpD%2Buow@mail.gmail.com> References: <CAOfDtXNqydD_hyvo25Arkm=gdqVcSJB8RPfnFL9xozQfS=UeEQ@mail.gmail.com> <CAPjTQNFp8dQBKdFzhPAX1NZ2j%2BLSsffZkOurN0yEb4M%2BpD%2Buow@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
2011/7/12 Oliver Pinter <oliver.pntr@gmail.com>:
> +.if ${OPSYS} != "FreeBSD"
>
> and what's the status example on NetBSD?
I didn't think of it. There are some instances of __NetBSD__ and also
__OpenBSD__ in the kernel tree, and the same problem can be fixed for
these two systems with minimal effort.
Here's a new version of the patch, which also adds -U__NetBSD__ and
-U__OpenBSD__ to CFLAGS.
--
Robert Millan
[-- Attachment #2 --]
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -90,6 +90,14 @@
.endif
WERROR?= -Werror
+.if !defined(OPSYS)
+OPSYS!= uname -s
+.endif
+
+.if ${OPSYS} != "FreeBSD"
+CFLAGS+= -Ulinux -U__linux__ -U__NetBSD__ -U__OpenBSD__ -D__FreeBSD__
+.endif
+
# XXX LOCORE means "don't declare C stuff" not "for locore.s".
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -96,6 +96,14 @@
CFLAGS+= -D_KERNEL
CFLAGS+= -DKLD_MODULE
+.if !defined(OPSYS)
+OPSYS!= uname -s
+.endif
+
+.if ${OPSYS} != "FreeBSD"
+CFLAGS+= -Ulinux -U__linux__ -U__NetBSD__ -U__OpenBSD__ -D__FreeBSD__
+.endif
+
# Don't use any standard or source-relative include directories.
CSTD= c99
NOSTDINC= -nostdinc
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXMMej_KORBt1PvAdAL7VvEkzXjpHM=eO_%2BLh=fP5OfWmQ>
