makefile

来自「linux driver 第二版 随书源码」· 代码 · 共 50 行

TXT
50
字号
# Comment/uncomment the following line to enable/disable debugging#DEBUG = y# Change it here or specify it on the "make" commandlineINCLUDEDIR = /usr/includeifeq ($(DEBUG),y)  DEBFLAGS = -O -g -DJIT_DEBUG -DJIQ_DEBUG -DALL_DEBUGelse  DEBFLAGS = -O2endifCFLAGS = -D__KERNEL__ -DMODULE -Wall $(DEBFLAGS)CFLAGS += -I$(INCLUDEDIR)# first the portable ones, then those that need newer kernel versions# this way everything compilable is built under 1.2 before getting errorsOBJS = faulty.o sleepy.o silly.o slave.o slaveD.o slaveH.o import.o \	master.o export.o hello.o \	jit.o jiq.o all: $(OBJS)clean:	rm -f *.o *.ver *~ # Don't use -Wall here: the cose is silly by designhello.o: hello.c	$(CC) -D__KERNEL__ -c $^ -o $@# set MODVERSIONS if the kernel uses itVERSUSED = $(shell grep 'define CONFIG_MODVERSIONS' \                   $(INCLUDEDIR)/linux/autoconf.h | wc -l | sed 's/ //g')ifeq ($(VERSUSED),1)  MODVERSIONS = yendif# and then use itifdef MODVERSIONSexport.o import.o: export.verendifexport.ver: export.c	$(CC) -I$(INCLUDEDIR) -E -D__GENKSYMS__ $^ | genksyms > $@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?