3 include $(dir $(lastword $(MAKEFILE_LIST)))../../Makefile.cfg
7 BIN := ../Output/$(ARCH)-kernel/libacpica.a
9 _VERS := $(patsubst acpica-unix-%.tar.gz,%,$(wildcard acpica-unix-*.tar.gz))
10 _VERS := $(sort $(_VERS))
11 _LATEST := $(lastword $(_VERS))
15 $(warning Unable to find an archive matching acpica-unix-%.tar.gz in Externals/ACPICA)
16 $(warning Go to https://www.acpica.org/downloads/ to get it)
17 $(error No ACPICA archive found, disable ACPI with 'USE_ACPICA=0')
20 ifneq ($(_LATEST),$(_VERS))
21 $(warning Multiple archvies found, picked $(_LATEST))
23 ACPICAVER := $(_LATEST)
26 ACPICAROOT := acpica-unix-$(ACPICAVER)/
27 ACPICA_ARCHIVE := acpica-unix-$(ACPICAVER).tar.gz
28 COMPDIR := $(ACPICAROOT)source/components/
29 KERNELDIR := ../../KernelLand/Kernel/
31 CPPFLAGS += -I $(KERNELDIR)include -I$(KERNELDIR)arch/$(ARCHDIR)/include -D_MODULE_NAME_=\"ACPICA\"
32 CPPFLAGS += -I $(ACPICAROOT)source/include -D _ACESS -D __KERNEL__
33 CPPFLAGS += -D ARCH=$(ARCH) -D ARCHDIR=$(ARCHDIR) -D PLATFORM=\"$(PLATFORM)\" -D ARCHDIR_IS_$(ARCHDIR)=1 -D PLATFORM_is_$(PLATFORM)=1
34 CPPFLAGS += -D KERNEL_VERSION=$(KERNEL_VERSION) -ffreestanding
35 ifneq ($(ACPI_DEBUG),no)
36 CPPFLAGS += -D ACPI_DEBUG_OUTPUT=1 -D ACPI_DISASSEMBLER=1
38 CFLAGS += -Wall -fno-stack-protector -Wstrict-prototypes -std=gnu99 -g
40 SRCS := $(wildcard $(COMPDIR)*/*.c)
41 OBJS := $(SRCS:$(COMPDIR)%.c=obj-$(ARCH)/%.o)
43 ACENV_H := $(ACPICAROOT)source/include/platform/acenv.h
44 ACACESS_H := $(ACPICAROOT)source/include/platform/acacess.h
48 ifeq ($(words $(SRCS)),0)
49 extract: $(ACPICAROOT)
50 @echo Re-run make to compile
56 $(RM) -r obj-$(ARCH)/ include
59 $(RM) -r $(ACPICAROOT)
67 ln -s $(ACPICAROOT)source/include
69 $(ACPICAROOT): $(ACPICA_ARCHIVE)
70 tar -xf $(ACPICA_ARCHIVE)
72 $(ACACESS_H): acacess.h
75 $(ACENV_H): $(ACPICA_ARCHIVE) Makefile
76 tar -x -O -f $(ACPICA_ARCHIVE) $(ACENV_H) | sed 's/aclinux/acacess/' | sed 's/_LINUX/_ACESS/' > $@
78 obj-$(ARCH)/%.o: $(COMPDIR)%.c $(ACENV_H) $(ACACESS_H)
81 @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
84 -include $(OBJS:%=%.dep)