📄 makefile
字号:
-include ../versionDISTFILES=divdi3.c hal.c iw_ndis.c iw_ndis.h loader.c loader.h \ longlong.h Makefile misc_funcs.c ndis.c ndis.h \ ndiswrapper.h ntoskernel.c ntoskernel.h \ pe_linker.c pe_linker.h proc.c usb.c usb.h winnt_types.h \ wrapper.c wrapper.h x86_64_stubs.SKVERS ?= $(shell uname -r)KSRC ?= /lib/modules/$(KVERS)/buildKPSUB := $(shell echo $(KVERS) | sed -e 's/\([^\.]*\)\.\([^\.]*\)\..*/\1\2/')DESTDIR =INST_DIR := $(DESTDIR)/lib/modules/$(KVERS)/miscSRC_DIR=$(shell pwd)-include $(KSRC)/.configCFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \ echo -DEXPORT_SYMTAB -DMODVERSIONS \ -include $(KSRC)/include/linux/modversions.h)ifdef DEBUGCFLAGS += -DDEBUG=$(DEBUG) -g -DDEBUG_TIMER endififdef DEBUG_TIMERCFLAGS += -DDEBUG_TIMERendififdef NDISWRAPPER_VERSIONCFLAGS += -DNDISWRAPPER_VERSION=\"${NDISWRAPPER_VERSION}\" \ -DEXTRA_VERSION=\"${EXTRA_VERSION}\"endif.PHONY: prereq_check gen_exports clean dist_clean \ x86_64_stubs install stack_checkall : prereq_check x86_64_stubs gen_exports default stack_checkOBJS := hal.o iw_ndis.o loader.o misc_funcs.o ndis.o ntoskernel.o \ pe_linker.o proc.o wrapper.oifeq ($(CONFIG_USB),y)OBJS += usb.oendififeq ($(CONFIG_USB),m)OBJS += usb.oendif#ifeq ($(CONFIG_DEBUG_SPINLOCK),y)#$(warning CONFIG_DEBUG_SPINLOCK conflicts with spinlocks used by \# Windows driver. There is a workaround for it in ndiswrapper, but it \# may not work correctly. Don't complain about kernel crashes until \# CONFIG_DEBUG_SPINLOCK is disabled.)#endifdivdi3.o: divdi3.c longlong.hhal.o: hal.c ntoskernel.hiw_ndis..o: iw_ndis.c iw_ndis.h wrapper.hloader.o: loader.c loader.h ndis.h wrapper.hmisc_funcs.o: misc_funcs.c ndis.hndis.o: ndis.c ndis.h iw_ndis.h wrapper.hntoskernel.o: ntoskernel.c ndis.h usb.hpe_linker.o: pe_linker.cproc.o: proc.c ndis.h iw_ndis.h wrapper.husb.o: usb.c usb.h ndis.hwrapper.o: wrapper.c wrapper.h iw_ndis.h ntoskernel.h loader.hiw_ndis.h: ndis.hloader.h: ndiswrapper.hndis.h: ntoskernel.hntoskernel.h: ndiswrapper.h winnt_types.h pe_linker.husb.h: ntoskernel.hwrapper.h: ndis.hhal_exports.h: hal.cmisc_funcs_exports.h: misc_funcs.cndis_exports.h: ndis.cntoskerlen_exports.h: ntoskernel.cusb_exports.h: usb.cifeq ($(CONFIG_X86_64),y)OBJS += x86_64_stubs.ox86_64_stubs.o: x86_64_stubs.h x86_64_stubs.Sx86_64_stubs: x86_64_stubs.hx86_64_stubs.h: hal.c misc_funcs.c ndis.c ntoskernel.c usb.c wrapper.c @if :; then \ echo "# Do not edit this file; \ it is automatically generated"; \ for file in $^; do \ echo; \ echo "# generated from $$file"; \ sed -n \ -e 's/.*WRAP_EXPORT(\([^)]\+\)).*/ \ win_to_lin_stub \1/p' \ -e 's/.*WRAP_FUNC_PTR(\([^)]\+\)).*/ \ win_to_lin_stub \1/p' \ $$file | sort -u; \ done; \ fi > $@elsex86_64_stubs:OBJS += divdi3.oendif# generate exports symbol table from C files%_exports.h: %.c @if :; then \ echo "/* Do not edit this file; \ it is automatically generated from $< */"; \ echo "#ifdef CONFIG_X86_64"; \ sed -n \ -e 's/.*WRAP_EXPORT(\([^)]\+\)).*/ \ extern void x86_64_\1(void);/p' \ -e 's/.*WRAP_FUNC_PTR(\([^)]\+\)).*/ \ extern void x86_64_\1(void);/p' \ $< | sort; \ echo "#endif"; \ echo "struct wrap_export $(basename $<)_exports[] = {";\ sed -n \ -e 's/.*WRAP_EXPORT(\(_win_\)\([^)]\+\)).*/ \ WRAP_EXPORT_WIN_FUNC(\2),/p' \ -e 's/.*WRAP_EXPORT(\([^)]\+\)).*/ \ WRAP_EXPORT_SYMBOL(\1),/p' \ -e 's/.*WRAP_EXPORT_MAP(\("[^"]\+"\)[ ,\n]\+\([^)]\+\)).*/ \ {\1, (WRAP_EXPORT_FUNC)\2},/p' $< | sort; \ echo " {NULL, NULL}"; \ echo "};"; \ fi > $@gen_exports: ndis_exports.h hal_exports.h ntoskernel_exports.h \ misc_funcs_exports.h usb_exports.h wrapper_exports.hprereq_check: @ if [ ! -f $(KSRC)/include/linux/version.h ]; then \ echo "Can't find kernel sources in $(KSRC);"; \ echo " give the path to kernel sources with KSRC=<path>\ argument to make";\ exit 1;\ ficlean: rm -rf $(MODULE) ndiswrapper.o $(OBJS) usb.o x86_64_stubs.o \ divdi3.o .*.ko.cmd .*.o.cmd ndiswrapper.mod.[oc] *~ .tmp_versionsdistclean: clean rm -f *_exports.h .\#* x86_64_stubs.hifeq ($(KPSUB),24)MODULE := ndiswrapper.oCFLAGS += -DLINUX -D__KERNEL__ -DMODULE -I$(KSRC)/include \ -Wall -Wstrict-prototypes -fomit-frame-pointer \ -fno-strict-aliasing -pipe -O2ifneq ($(CONFIG_X86_64),y)CFLAGS += -mpreferred-stack-boundary=2 endifdefault: $(OBJS) $(LD) -r -o $(MODULE) $(OBJS)elseMODULE := ndiswrapper.koobj-m := ndiswrapper.o ndiswrapper-objs := $(OBJS)default: $(MAKE) -C $(KSRC) SUBDIRS=$(SRC_DIR) \ NDISWRAPPER_VERSION=$(NDISWRAPPER_VERSION) \ EXTRA_VERSION=$(EXTRA_VERSION) modulesendifstack_check: @ if [ "x$(CONFIG_X86_64)" = "x" -a $(KPSUB) -eq 26 ]; then \ if grep -q CONFIG_4KSTACKS $(KSRC)/.config; then \ if grep -q "CONFIG_4KSTACKS=y" $(KSRC)/.config; then \ echo; echo; \ echo "*** WARNING: "\ "Kernel is compiled with 4K stack size option"\ "(CONFIG_4KSTACKS); many Windows drivers will"\ "not work with this option enabled. Disable"\ "CONFIG_4KSTACKS option, recompile and install"\ "kernel";\ echo; echo; \ fi;\ else \ echo; echo; \ echo "*** WARNING: Kernel seems to have 4K size stack option" \ "(CONFIG_4KSTACKS) removed; many Windows drivers will"\ "need at least 8K size stacks."\ "You should read wiki about 4K size stack issue."\ "Don't complain about crashes until you resolve this."; \ echo; echo; \ fi;\ fiinstall: prereq_check x86_64_stubs gen_exports default stack_check mkdir -p $(INST_DIR) install -m 0644 $(MODULE) $(INST_DIR) -/sbin/depmod -adist: @for file in $(DISTFILES); do \ cp $$file $(distdir)/$$file; \ done
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -