MFamd64: (based on) r209957

Move logic of building ACPI headers for acpi_wakeup.c into better places,
remove intermediate makefile and shell script, and reduce diff between i386
and amd64.
This commit is contained in:
Jung-uk Kim 2010-11-12 20:55:14 +00:00
parent 448a42a61e
commit a3c464fb3c
6 changed files with 29 additions and 60 deletions

View file

@ -239,13 +239,28 @@ dev/acpica/acpi_if.m standard
dev/acpi_support/acpi_wmi_if.m standard
dev/wpi/if_wpi.c optional wpi
i386/acpica/acpi_machdep.c optional acpi
i386/acpica/acpi_wakeup.c optional acpi
acpi_wakecode.h optional acpi \
dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \
compile-with "${MAKE} -f $S/i386/acpica/Makefile MAKESRCPATH=$S/i386/acpica" \
acpi_wakecode.o optional acpi \
dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \
compile-with "${NORMAL_S}" \
no-obj no-implicit-rule before-depend \
clean "acpi_wakecode.h acpi_wakecode.o acpi_wakecode.bin"
clean "acpi_wakecode.o"
acpi_wakecode.bin optional acpi \
dependency "acpi_wakecode.o" \
compile-with "objcopy -S -O binary acpi_wakecode.o ${.TARGET}" \
no-obj no-implicit-rule before-depend \
clean "acpi_wakecode.bin"
acpi_wakecode.h optional acpi \
dependency "acpi_wakecode.bin" \
compile-with "file2c -sx 'static char wakecode[] = {' '};' < acpi_wakecode.bin > ${.TARGET}" \
no-obj no-implicit-rule before-depend \
clean "acpi_wakecode.h"
acpi_wakedata.h optional acpi \
dependency "acpi_wakecode.o" \
compile-with '${NM} -n --defined-only acpi_wakecode.o | while read offset dummy what; do echo "#define $${what} 0x$${offset}"; done > ${.TARGET}' \
no-obj no-implicit-rule before-depend \
clean "acpi_wakedata.h"
#
i386/acpica/acpi_wakeup.c optional acpi
i386/bios/apm.c optional apm
i386/bios/mca_machdep.c optional mca
i386/bios/smapi.c optional smapi

View file

@ -1,30 +0,0 @@
# $FreeBSD$
# Correct path for kernel builds
# Don't rely on the kernel's .depend file
.ifdef MAKESRCPATH
.PATH: ${MAKESRCPATH}
DEPENDFILE=
.else
MAKESRCPATH= ${.CURDIR}
CLEANFILES= acpi_wakecode.h acpi_wakecode.bin acpi_wakecode.o
.endif
.if ${CC:T:Micc} == "icc"
CFLAGS+= -restrict
NOSTDINC= -X
.else
NOSTDINC= -nostdinc
.endif
CFLAGS+= ${NOSTDINC} -I. -I${MAKESRCPATH}/../..
all: acpi_wakecode.h
acpi_wakecode.o: acpi_wakecode.S assym.s
acpi_wakecode.bin: acpi_wakecode.o
objcopy -S -O binary acpi_wakecode.o acpi_wakecode.bin
acpi_wakecode.h: acpi_wakecode.bin acpi_wakecode.o
sh ${MAKESRCPATH}/genwakecode.sh > acpi_wakecode.h
.include <bsd.prog.mk>

View file

@ -27,8 +27,6 @@
* $FreeBSD$
*/
#define LOCORE
#include <machine/asmacros.h>
#include <machine/specialreg.h>

View file

@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <dev/acpica/acpivar.h>
#include "acpi_wakecode.h"
#include "acpi_wakedata.h"
/* Make sure the code is less than one page and leave room for the stack. */
CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024);

View file

@ -1,11 +0,0 @@
#!/bin/sh
# $FreeBSD$
#
file2c 'static char wakecode[] = {' '};' <acpi_wakecode.bin
nm -n --defined-only acpi_wakecode.o | while read offset dummy what
do
echo "#define ${what} 0x${offset}"
done
exit 0

View file

@ -96,23 +96,24 @@ opt_ddb.h: Makefile
.endif
# Machine-specific code such as sleep/wakeup
SRCS+= acpi_apm.c acpi_machdep.c acpi_wakecode.h acpi_wakeup.c
SRCS+= acpi_apm.c acpi_machdep.c acpi_wakecode.h acpi_wakedata.h acpi_wakeup.c
SRCS+= assym.s madt.c
CLEANFILES+= acpi_wakecode.bin acpi_wakecode.h acpi_wakecode.o
CLEANFILES+=acpi_wakecode.bin acpi_wakecode.h acpi_wakecode.o acpi_wakedata.h
SRCS+= opt_global.h
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
NM?= nm
.if ${MACHINE_CPUARCH} == "amd64"
.if !defined(KERNBUILDDIR)
CFLAGS+=-DSMP
.endif
SRCS+= acpi_switch.S acpi_wakedata.h
CLEANFILES+= acpi_wakedata.h
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
NM?= nm
SRCS+= acpi_switch.S
acpi_switch.o: acpi_switch.S
${NORMAL_S}
.endif
acpi_wakecode.o: acpi_wakecode.S assym.s
${NORMAL_S}
acpi_wakecode.bin: acpi_wakecode.o
@ -125,10 +126,5 @@ acpi_wakedata.h: acpi_wakecode.o
while read offset dummy what; do \
echo "#define $${what} 0x$${offset}"; \
done > ${.TARGET}
.else
acpi_wakecode.h: acpi_wakecode.S assym.s
${MAKE} -f ${.CURDIR}/../../../${MACHINE_CPUARCH}/acpica/Makefile \
MAKESRCPATH=${.CURDIR}/../../../${MACHINE_CPUARCH}/acpica
.endif
.include <bsd.kmod.mk>