Makefile at [cd0d83fed7]

File Makefile artifact 53c5d86523 part of check-in cd0d83fed7


# Copyright (C) 2011 Alessandro Ghedini <alessandro@ghedini.me>
# Updated 2012 by Mike Perry to extract syscall table addresses
# Updated 2014 by Francis Brosnan Blázquez to check for ia32 support
obj-m += nokeyctl.o

ifdef M
include $(M)/Makefile.inc
ifndef SYSTEM_MAP_FILE
SYSTEM_MAP_FILE := $(KERNEL_DIR)/System.map
endif

SCT   := $(shell grep " sys_call_table" '$(SYSTEM_MAP_FILE)' | awk '{ print $$1; }')
SCT32 := $(shell grep "ia32_sys_call_table" '$(SYSTEM_MAP_FILE)' | awk '{ print $$1; }')

EXTRA_CFLAGS += -Dsys_call_table_addr="((void**)0x$(SCT))"
ifdef SCT32
EXTRA_CFLAGS += -Dia32_sys_call_table_addr="((void**)0x$(SCT32))" -D__enable_32bits_support
endif
else
include Makefile.inc
endif

all:
	@echo "Building with " $(EXTRA_CFLAGS)
	make -C '$(KERNEL_DIR)' 'M=$(PWD)'

install: all
	-mkdir -p '$(DESTDIR)/lib/modules/$(KERNEL_VER)/misc'
	cp nokeyctl.ko '$(DESTDIR)/lib/modules/$(KERNEL_VER)/misc/'

clean:
	make -C '$(KERNEL_DIR)' 'M=$(PWD)' clean
	rm -f Module.symvers built-in.o modules.order nokeyctl.ko nokeyctl.mod.c nokeyctl.mod.o nokeyctl.o

distclean: clean
	rm -f Makefile.inc