Commit d5a4b1a5 authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki

tools/power/acpi: Remove direct kernel source include reference

Avoid breaking cross-compiled ACPI tools builds by rearranging the
handling of kernel header files.

This patch also contains OUTPUT/srctree cleanups in order to make above fix
working for various build environments.

Fixes: e323c02d (ACPICA: MSVC9: Fix <sys/stat.h> inclusion order issue)
Reported-and-tested-by: default avatarYisheng Xie <xieyisheng1@huawei.com>
Reported-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
[ rjw: Changelog ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent a25f0944
...@@ -191,6 +191,9 @@ ...@@ -191,6 +191,9 @@
#ifndef __init #ifndef __init
#define __init #define __init
#endif #endif
#ifndef __iomem
#define __iomem
#endif
/* Host-dependent types and defines for user-space ACPICA */ /* Host-dependent types and defines for user-space ACPICA */
......
...@@ -8,18 +8,19 @@ ...@@ -8,18 +8,19 @@
# as published by the Free Software Foundation; version 2 # as published by the Free Software Foundation; version 2
# of the License. # of the License.
include ../../../../scripts/Makefile.include ifeq ($(srctree),)
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
OUTPUT=./ srctree := $(patsubst %/,%,$(dir $(srctree)))
ifeq ("$(origin O)", "command line") #$(info Determined 'srctree' to be $(srctree))
OUTPUT := $(O)/
endif endif
ifneq ($(OUTPUT),) include $(srctree)/../../scripts/Makefile.include
# check that the output directory actually exists
OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) OUTPUT=$(srctree)/
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) ifeq ("$(origin O)", "command line")
OUTPUT := $(O)/power/acpi/
endif endif
#$(info Determined 'OUTPUT' to be $(OUTPUT))
# --- CONFIGURATION BEGIN --- # --- CONFIGURATION BEGIN ---
...@@ -70,8 +71,8 @@ WARNINGS := -Wall ...@@ -70,8 +71,8 @@ WARNINGS := -Wall
WARNINGS += $(call cc-supports,-Wstrict-prototypes) WARNINGS += $(call cc-supports,-Wstrict-prototypes)
WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
KERNEL_INCLUDE := ../../../include KERNEL_INCLUDE := $(OUTPUT)include
ACPICA_INCLUDE := ../../../drivers/acpi/acpica ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE) CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
CFLAGS += $(WARNINGS) CFLAGS += $(WARNINGS)
......
...@@ -8,28 +8,42 @@ ...@@ -8,28 +8,42 @@
# as published by the Free Software Foundation; version 2 # as published by the Free Software Foundation; version 2
# of the License. # of the License.
$(OUTPUT)$(TOOL): $(TOOL_OBJS) FORCE objdir := $(OUTPUT)tools/$(TOOL)/
$(ECHO) " LD " $@ toolobjs := $(addprefix $(objdir),$(TOOL_OBJS))
$(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(TOOL_OBJS) -L$(OUTPUT) -o $@ $(OUTPUT)$(TOOL): $(toolobjs) FORCE
$(ECHO) " LD " $(subst $(OUTPUT),,$@)
$(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(toolobjs) -L$(OUTPUT) -o $@
$(ECHO) " STRIP " $(subst $(OUTPUT),,$@)
$(QUIET) $(STRIPCMD) $@ $(QUIET) $(STRIPCMD) $@
$(OUTPUT)%.o: %.c $(KERNEL_INCLUDE):
$(ECHO) " CC " $@ $(ECHO) " MKDIR " $(subst $(OUTPUT),,$@)
$(QUIET) mkdir -p $(KERNEL_INCLUDE)
$(ECHO) " CP " $(subst $(OUTPUT),,$@)
$(QUIET) cp -rf $(srctree)/../../../include/acpi $(KERNEL_INCLUDE)/
$(objdir)%.o: %.c $(KERNEL_INCLUDE)
$(ECHO) " CC " $(subst $(OUTPUT),,$@)
$(QUIET) $(CC) -c $(CFLAGS) -o $@ $< $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
all: $(OUTPUT)$(TOOL) all: $(OUTPUT)$(TOOL)
clean: clean:
-find $(OUTPUT) \( -not -type d \) \ $(ECHO) " RMOBJ " $(subst $(OUTPUT),,$(objdir))
-and \( -name '*~' -o -name '*.[oas]' \) \ $(QUIET) find $(objdir) \( -not -type d \)\
-type f -print \ -and \( -name '*~' -o -name '*.[oas]' \)\
| xargs rm -f -type f -print | xargs rm -f
-rm -f $(OUTPUT)$(TOOL) $(ECHO) " RM " $(TOOL)
$(QUIET) rm -f $(OUTPUT)$(TOOL)
$(ECHO) " RMINC " $(subst $(OUTPUT),,$(KERNEL_INCLUDE))
$(QUIET) rm -rf $(KERNEL_INCLUDE)
install-tools: install-tools:
$(INSTALL) -d $(DESTDIR)${sbindir} $(ECHO) " INST " $(TOOL)
$(INSTALL_PROGRAM) $(OUTPUT)$(TOOL) $(DESTDIR)${sbindir} $(QUIET) $(INSTALL) -d $(DESTDIR)$(sbindir)
$(QUIET) $(INSTALL_PROGRAM) $(OUTPUT)$(TOOL) $(DESTDIR)$(sbindir)
uninstall-tools: uninstall-tools:
- rm -f $(DESTDIR)${sbindir}/$(TOOL) $(ECHO) " UNINST " $(TOOL)
$(QUIET) rm -f $(DESTDIR)$(sbindir)/$(TOOL)
install: all install-tools $(EXTRA_INSTALL) install: all install-tools $(EXTRA_INSTALL)
uninstall: uninstall-tools $(EXTRA_UNINSTALL) uninstall: uninstall-tools $(EXTRA_UNINSTALL)
......
...@@ -17,9 +17,7 @@ vpath %.c \ ...@@ -17,9 +17,7 @@ vpath %.c \
../../os_specific/service_layers\ ../../os_specific/service_layers\
. .
CFLAGS += -DACPI_APPLICATION -DACPI_SINGLE_THREAD -DACPI_DEBUGGER\ CFLAGS += -DACPI_APPLICATION -DACPI_SINGLE_THREAD -DACPI_DEBUGGER\
-I.\ -I.
-I../../../../../drivers/acpi/acpica\
-I../../../../../include
LDFLAGS += -lpthread LDFLAGS += -lpthread
TOOL_OBJS = \ TOOL_OBJS = \
acpidbg.o acpidbg.o
......
...@@ -12,10 +12,16 @@ ...@@ -12,10 +12,16 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
/* Headers not included by include/acpi/platform/aclinux.h */ /* Headers not included by include/acpi/platform/aclinux.h */
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <error.h>
#include <stdbool.h> #include <stdbool.h>
#include <fcntl.h> #include <fcntl.h>
#include <assert.h> #include <assert.h>
#include <linux/circ_buf.h> #include <sys/select.h>
#include "../../../../../include/linux/circ_buf.h"
#define ACPI_AML_FILE "/sys/kernel/debug/acpi/acpidbg" #define ACPI_AML_FILE "/sys/kernel/debug/acpi/acpidbg"
#define ACPI_AML_SEC_TICK 1 #define ACPI_AML_SEC_TICK 1
......
...@@ -19,9 +19,7 @@ vpath %.c \ ...@@ -19,9 +19,7 @@ vpath %.c \
./\ ./\
../../common\ ../../common\
../../os_specific/service_layers ../../os_specific/service_layers
CFLAGS += -DACPI_DUMP_APP -I.\ CFLAGS += -DACPI_DUMP_APP -I.
-I../../../../../drivers/acpi/acpica\
-I../../../../../include
TOOL_OBJS = \ TOOL_OBJS = \
apdump.o\ apdump.o\
apfiles.o\ apfiles.o\
...@@ -49,7 +47,9 @@ TOOL_OBJS = \ ...@@ -49,7 +47,9 @@ TOOL_OBJS = \
include ../../Makefile.rules include ../../Makefile.rules
install-man: ../../man/acpidump.8 install-man: $(srctree)/man/acpidump.8
$(INSTALL_DATA) -D $< $(DESTDIR)${mandir}/man8/acpidump.8 $(ECHO) " INST " acpidump.8
$(QUIET) $(INSTALL_DATA) -D $< $(DESTDIR)$(mandir)/man8/acpidump.8
uninstall-man: uninstall-man:
- rm -f $(DESTDIR)${mandir}/man8/acpidump.8 $(ECHO) " UNINST " acpidump.8
$(QUIET) rm -f $(DESTDIR)$(mandir)/man8/acpidump.8
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment