📄 makefile
字号:
ifneq ($(KERNELRELEASE),) # We were called by kbuildCFLAGS += $(DEFINES) -gobj-m += zc030x.ozc030x-objs := zc030x_main.o zc030x_i2c.o zc030x_matrix.o zc030x_mm.o zc030x_isochron.o zc030x_v4l.o zc030x_cameras.o zc030x_jpeg.o zc030x_fp.o zc030x_reg.oelse # We were called from command lineifeq ($(shell uname -r | cut -d. -f1,2), 2.6)KERNEL_VERSION = `uname -r`KERNELDIR := /lib/modules/$(KERNEL_VERSION)/buildPWD := $(shell pwd)MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/media/default: @echo ' Building ZC030X driver for 2.5/2.6 kernel.' @echo ' PLEASE IGNORE THE "Overriding SUBDIRS" WARNING' @echo ' Remember: you must have read/write access to your kernel source tree.' $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modulesinstall: install -c -m 0644 zc030x.ko $(MODULE_INSTALLDIR) /sbin/depmod -aeuninstall: rm -f $(MODULE_INSTALLDIR)/zc030x.ko /sbin/depmod -aqclean: rm -f *.o zc030x.ko rm -f .*.cmd rm -f zc030x.mod.o rm -rf .tmp_versionselse#makefile2.4KERNEL_VERSION = `uname -r`#### Location of the header files (most importantly the config files)# # for the kernel you want to build the module against.# # This should be correct for the currently installed kernel on your machine.KINCLUDE = /lib/modules/$(KERNEL_VERSION)/build/includeKERNEL_ACFILE = $(KINCLUDE)/linux/autoconf.hKERNEL_MODVERSIONSFILE = $(KINCLUDE)/linux/modversions.hMODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/# Detect module versioning supportifneq ($(strip $(shell grep 'define CONFIG_MODVERSIONS 1' $(KERNEL_ACFILE))),) DEFINES += -DMODVERSIONS -include $(KERNEL_MODVERSIONSFILE)endif## Detect SMP supportifneq ($(strip $(shell grep 'define CONFIG_SMP 1' $(KERNEL_ACFILE))),) DEFINES += -D__SMP__ -DSMPendif# Setup the toolsCC = gccLD = ld# Setup compiler warningsWARNINGS = -Wall -Wpointer-arithWARNINGS += -Wcast-align -Wwrite-strings -Wstrict-prototypesWARNINGS += -Wuninitialized -Wreturn-type -Wunused -Wparentheses# Setup compiler flagsCFLAGS = -O2 -g -fomit-frame-pointer -fno-strict-aliasing -pipe -msoft-float CFLAGS += -mpreferred-stack-boundary=2 CFLAGS += -I$(KINCLUDE) -Idrivers/usb# what are following options for ??CFLAGS += -nostdinc -iwithprefix include -DMODULE -D__KERNEL__ -DNOKERNEL# Setup link flagsLDFLAGS = -rOBJS = zc030x_main.o \ zc030x_i2c.o \ zc030x_matrix.o \ zc030x_mm.o \ zc030x_v4l.o \ zc030x_cameras.o \ zc030x_jpeg.o \ zc030x_fp.o \ zc030x_reg.o \ zc030x_isochron.o ## zc030x_proc.o \# zc030x_legacy_init.o BINARY = zc030x.o#### Targets follow herebinary: $(OBJS) @echo Linking $(BINARY) @$(LD) $(LDFLAGS) -o $(BINARY) $(OBJS)install: binary @echo Installing.. Your root password may be required. su -c "make install-root"install-root: install -c -m 0644 zc030x.o $(MODULE_INSTALLDIR) /sbin/depmod -ae.c.o: Makefile $*.c @echo Compiling $*.c @$(CC) $(CFLAGS) $(WARNINGS) $(DEFINES) -c $*.c -o $*.o#### Dependencies follow here#zc030x_main.o: zc030x_kerneldef.h \ zc030x_cameras.h \ zc030x_i2c.h \ zc030x_sensorsig.h \ zc030x.h \ zc030x_mm.h \ zc030x_isochron.h \ zc030x_frame.h \ zc030x_fp.h \ zc030x_cameras.h \ ./sensors/CS2102.h \ ./sensors/CS2103.h \ ./sensors/HDCS1020.h \ ./sensors/HDCS2020.h \ ./sensors/HV7121B.h \ ./sensors/HV7131B.h \ ./sensors/ICM102A.h \ ./sensors/ICM105A.h \ ./sensors/OV7620.h \ ./sensors/OVCIF.h \ ./sensors/PAS106B.h \ ./sensors/PAS202B.h \ ./sensors/PB0111.h \ ./sensors/PB0330.h \ ./sensors/TAS5130C.h \ ./sensors/TAS5110B.hzc030x_i2c.o: zc030x_i2c.h \ zc030x_kerneldef.h \ zc030x.hzc030x_matrix.o: zc030x_matrix.h \ zc030x_kerneldef.hzc030x_mm.o: zc030x_mm.h \ zc030x_kerneldef.hzc030x_isochron.o: zc030x_isochron.h \ zc030x_kerneldef.hzc030x_fp.o: zc030x_fp.hzc030x_v4l.o: zc030x_v4l.h \ zc030x_kerneldef.h zc030x_cameras.o: zc030x_cameras.h \ zc030x_kerneldef.hzc030x_jpeg.o: zc030x_jpeg.h \ zc030x_frame.h \ zc030x_kerneldef.hzc030x_reg.o: zc030x_reg.h \ zc030x_kerneldef.h \############################################################################## # OTHER TARGETS ##############################################################################clean: rm -f *.o zc030x.ko rm -f .*.cmd rm -f zc030x.mod.o rm -rf .tmp_versions ############################################################################## endif #2.6 <-> 2.4endif #kbuild <-> commandlinereadframe: gcc -o readframe readimage.cdetectsensor: gcc -o detectsensor detectsensor.cpackage: pwd | awk -F / '{printf("%s", $$(NF));}'> /tmp/$$stupidname$$ (cd .. && tar -jcvf zc030x_new.tar.bz2 `cat /tmp/$$stupidname$$` --exclude=CVS --exclude=*.o --exclude=*.ko --exclude=*.init && rm -f /tmp/$$stupidname$$)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -