Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Don't use "#if defined(__i386__) || defined(__x86_64__)" con...
details: https://anonhg.NetBSD.org/src/rev/ec1cb3ded527
branches: trunk
changeset: 779125:ec1cb3ded527
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat May 05 16:03:55 2012 +0000
description:
Don't use "#if defined(__i386__) || defined(__x86_64__)" conditionals
in C source file to define option features.
Define proper options in each Makefile per ${MACHINE_ARCH} variable instead.
Previously if a host is x86 and it has /usr/mdec/mbr file in its system,
tools fdisk implicitly installs it as mbr bootcode even for !x86 targets.
diffstat:
sbin/fdisk/Makefile | 9 ++++++++-
sbin/fdisk/fdisk.c | 15 ++++-----------
tools/fdisk/Makefile | 6 +-----
3 files changed, 13 insertions(+), 17 deletions(-)
diffs (83 lines):
diff -r 9548abd01a6d -r ec1cb3ded527 sbin/fdisk/Makefile
--- a/sbin/fdisk/Makefile Sat May 05 15:57:45 2012 +0000
+++ b/sbin/fdisk/Makefile Sat May 05 16:03:55 2012 +0000
@@ -1,10 +1,17 @@
-# $NetBSD: Makefile,v 1.41 2009/11/27 15:37:32 tsutsui Exp $
+# $NetBSD: Makefile,v 1.42 2012/05/05 16:03:55 tsutsui Exp $
PROG= fdisk
SRCS= fdisk.c
MAN= fdisk.8
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+= -DBOOTSEL
+.if (${HOSTPROG:U} == "")
+CPPFLAGS+= -DUSE_DISKLIST
+.endif
+.endif
+
.if ${MACHINE} == "arc"
CPPFLAGS+= -D_PATH_DEFDISK='"/dev/rsd0d"'
.endif
diff -r 9548abd01a6d -r ec1cb3ded527 sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c Sat May 05 15:57:45 2012 +0000
+++ b/sbin/fdisk/fdisk.c Sat May 05 16:03:55 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdisk.c,v 1.140 2012/04/06 20:09:26 christos Exp $ */
+/* $NetBSD: fdisk.c,v 1.141 2012/05/05 16:03:55 tsutsui Exp $ */
/*
* Mach Operating System
@@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.140 2012/04/06 20:09:26 christos Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.141 2012/05/05 16:03:55 tsutsui Exp $");
#endif /* not lint */
#define MBRPTYPENAMES
@@ -91,13 +91,6 @@
#define LE_MBR_MAGIC htole16(MBR_MAGIC)
#define LE_MBR_BS_MAGIC htole16(MBR_BS_MAGIC)
-#if defined(__i386__) || defined(__x86_64__)
-#if !HAVE_NBTOOL_CONFIG_H
-#include <machine/cpu.h>
-#endif /* !HAVE_NBTOOL_CONFIG_H */
-#define BOOTSEL
-#endif
-
#ifdef BOOTSEL
#define DEFAULT_BOOTCODE "mbr"
@@ -250,8 +243,8 @@
static int bootsize; /* actual size of bootcode */
static int boot_installed; /* 1 if we've copied code into the mbr */
-#if (defined(__i386__) || defined(__x86_64__)) && !HAVE_NBTOOL_CONFIG_H
-#define USE_DISKLIST
+#if defined(USE_DISKLIST)
+#include <machine/cpu.h>
static struct disklist *dl;
#endif
diff -r 9548abd01a6d -r ec1cb3ded527 tools/fdisk/Makefile
--- a/tools/fdisk/Makefile Sat May 05 15:57:45 2012 +0000
+++ b/tools/fdisk/Makefile Sat May 05 16:03:55 2012 +0000
@@ -1,13 +1,9 @@
-# $NetBSD: Makefile,v 1.4 2010/06/19 23:11:10 riz Exp $
+# $NetBSD: Makefile,v 1.5 2012/05/05 16:03:55 tsutsui Exp $
HOSTPROGNAME= ${MACHINE_GNU_PLATFORM}-fdisk
HOST_SRCDIR= sbin/fdisk
HOST_SRCS= getcap.c disklabel.c
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
-CPPFLAGS+= -DBOOTSEL
-.endif
-
.include "${.CURDIR}/../Makefile.nbincludes"
.include "${.CURDIR}/../Makefile.host"
Home |
Main Index |
Thread Index |
Old Index