# 1) run (from top of kernel tree): make ARCH=arch headers_check
# 2) cd tools/build; 'make -f uapi-compile.mk [UAPI_DIR=
] BDIR='
# , where UAPI_DIR, if supplied, will restrict the make rules to only apply
# to the headers in directory provided. 'BDIR' is the directory where the .o
# files will be produced. It defaults to the current directory.
SRC_DIR :=../../
UAPI_INSTALL_DIR_ORIG :=$(SRC_DIR)/usr/include/
UAPI_INSTALL_DIR :=$(SRC_DIR)/usr/include/$(UAPI_DIR)/
CC :=gcc
BUILD_DIR :=./$(BDIR)
HEADERS :=$(shell find $(UAPI_INSTALL_DIR) -name '*.h')
IMPLICIT_UAPI_INCLUDES :=linux/posix_types.h asm-generic/ipcbuf.h
IMPLICIT_UAPI_INCLUDES :=\
$(addprefix --include=$(UAPI_INSTALL_DIR_ORIG),$(IMPLICIT_UAPI_INCLUDES))
IMPLICIT_STANDARD_INCLUDES := stdarg.h stdint.h stddef.h
IMPLICIT_STANDARD_INCLUDES :=\
$(addprefix --include=,$(IMPLICIT_STANDARD_INCLUDES))
INCLUDE_HEADERS := $(IMPLICIT_UAPI_INCLUDES) $(IMPLICIT_STANDARD_INCLUDES)
OBJECT_FILES :=$(addprefix $(BUILD_DIR)/,$(HEADERS:%.h=%.o))
all: header_objs
clean:
@rm -f $(OBJECT_FILES)
header_objs: $(OBJECT_FILES)
$(BUILD_DIR)/%.o: %.h
$(CC) -I$(UAPI_INSTALL_DIR_ORIG) $(INCLUDE_HEADERS) -c $< -o $@