Usermode/libc - Fix strchr and strrchr behavior
[tpg/acess2.git] / Externals / ACPICA / Makefile
1
2
3 include $(dir $(lastword $(MAKEFILE_LIST)))../../Makefile.cfg
4
5 ACPI_DEBUG ?= no
6
7 BIN := ../Output/$(ARCH)-kernel/libacpica.a
8
9 _VERS := $(patsubst acpica-unix-%.tar.gz,%,$(wildcard acpica-unix-*.tar.gz))
10 _VERS := $(sort $(_VERS))
11 _LATEST := $(lastword $(_VERS))
12
13 ifeq ($(ACPICAVER),)
14  ifeq ($(_LATEST),)
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')
18  endif
19  
20  ifneq ($(_LATEST),$(_VERS))
21   $(warning Multiple archvies found, picked $(_LATEST))
22  endif
23  ACPICAVER := $(_LATEST)
24 endif
25
26 ACPICAROOT := acpica-unix-$(ACPICAVER)/
27 ACPICA_ARCHIVE := acpica-unix-$(ACPICAVER).tar.gz
28 COMPDIR := $(ACPICAROOT)source/components/
29 KERNELDIR := ../../KernelLand/Kernel/
30
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
37 endif
38 CFLAGS          += -Wall -fno-stack-protector -Wstrict-prototypes -std=gnu99 -g
39
40 SRCS := $(wildcard $(COMPDIR)*/*.c)
41 OBJS := $(SRCS:$(COMPDIR)%.c=obj-$(ARCH)/%.o)
42
43 ACENV_H := $(ACPICAROOT)source/include/platform/acenv.h
44 ACACESS_H := $(ACPICAROOT)source/include/platform/acacess.h
45
46 .PHONY: all clean
47
48 ifeq ($(words $(SRCS)),0)
49 extract: $(ACPICAROOT)
50         @echo Re-run make to compile
51 endif
52
53 all: $(BIN) include
54
55 clean:
56         $(RM) -r obj-$(ARCH)/ include
57
58 purge: clean
59         $(RM) -r $(ACPICAROOT)
60
61 $(BIN): $(OBJS)
62         @mkdir -p $(dir $@)
63         @echo [AR] $@
64         @ar rcu $@ $(OBJS)
65
66 include:
67         ln -s $(ACPICAROOT)source/include
68
69 $(ACPICAROOT): $(ACPICA_ARCHIVE)
70         tar -xf $(ACPICA_ARCHIVE)
71
72 $(ACACESS_H): acacess.h
73         cp $< $@
74
75 $(ACENV_H): $(ACPICA_ARCHIVE) Makefile
76         tar -x -O -f $(ACPICA_ARCHIVE) $(ACENV_H) | sed 's/aclinux/acacess/' | sed 's/_LINUX/_ACESS/' > $@
77
78 obj-$(ARCH)/%.o: $(COMPDIR)%.c $(ACENV_H) $(ACACESS_H)
79         @mkdir -p $(dir $@)
80         @echo [CC] -o $@
81         @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< 
82         @$(CC) -M -MP -MT $@ $(CPPFLAGS) $< -o [email protected]
83
84 -include $(OBJS:%=%.dep)
85

UCC git Repository :: git.ucc.asn.au