# # Makefile for the Linux WWAN device drivers. # # NOTE: This make file can serve as both an external Makefile (launched # directly by the user), or as the sub-dir Makefile used by the kernel # build system. # If CONFIG_SPI_PARPORT isn't set, we'll assume the user has never configured # their kernel to include this module and set up some defaults. # ifndef CONFIG_GPIO_PARPORT EXTERNAL_BUILD=y CONFIG_GPIO_PARPORT=m # CONFIG_GPIO_PARPORT_MUTEX is not set # CONFIG_GPIO_PARPORT_EXCLUSIVE is not set CONFIG_GPIO_PARPORT_NOCLAIME=y endif ifndef CONFIG_SPI_PARPORT EXTERNAL_BUILD=y CONFIG_SPI_PARPORT=m # CONFIG_SPI_PARPORT_EXCLUSIVE is not set endif ifeq ($(CONFIG_SPI_HSO_DEBUG),y) EXTRA_CFLAGS += -g -Wa,-adhlms=$@.lst endif ifdef KBUILD_EXTMOD EXTRA_CFLAGS += -I$(KBUILD_EXTMOD) endif list-m := list-$(CONFIG_GPIO_PARPORT) += gpio_parport gpio_test list-$(CONFIG_SPI_PARPORT) += spi_parport obj-$(CONFIG_GPIO_PARPORT) += gpio_parport.o gpio_test.o obj-$(CONFIG_SPI_PARPORT) += spi_parport.o # # Begin dual Makefile mode here. First we provide support for when we # are being invoked by the kernel build system # ifneq ($(KERNELRELEASE),) EXTRA_CFLAGS += -DCONFIG_PM ifeq ($(EXTERNAL_BUILD),y) ifeq ($(CONFIG_GPIO_PARPORT_MUTEX),y) EXTRA_CFLAGS += -DCONFIG_GPIO_PARPORT_MUTEX endif ifeq ($(CONFIG_GPIO_PARPORT_EXCLUSIVE),y) EXTRA_CFLAGS += -DCONFIG_GPIO_PARPORT_EXCLUSIVE endif ifeq ($(CONFIG_GPIO_PARPORT_NOCLAIME),y) EXTRA_CFLAGS += -DCONFIG_GPIO_PARPORT_NOCLAIME endif ifeq ($(CONFIG_SPI_PARPORT_EXCLUSIVE),y) EXTRA_CFLAGS += -DCONFIG_SPI_PARPORT_EXCLUSIVE endif ifeq ($(CONFIG_SPI_HSO_DEBUG),y) EXTRA_CFLAGS += -DCONFIG_SPI_HSO_DEBUG endif endif else # Here we begin the portion that is executed if the user invoked this Makefile # directly. # KSRC should be set to the path to your sources KVER := $(shell uname -r) KSRC := /lib/modules/$(KVER)/build INSTALLDIR:=/lib/modules/$(KVER)/kernel/drivers/net/wwan/ # KSRC_OUTPUT should be overridden if you are using a 2.6 kernel that # has it's output sent elsewhere via KBUILD_OUTPUT= or O= KSRC_OUTPUT := $(KSRC) PWD=$(shell pwd) VERFILE := $(KSRC_OUTPUT)/include/linux/version.h KERNELRELEASE := $(shell \ if [ -r $(VERFILE) ]; then \ (cat $(VERFILE); echo UTS_RELEASE) | \ $(CC) -I$(KSRC_OUTPUT) $(CFLAGS) -E - | \ tail -n 1 | \ xargs echo; \ else \ uname -r; \ fi) MODPATH := $(DESTDIR)/lib/modules/$(KERNELRELEASE) all: modules clean: $(RM) -f *.mod.* *.mod *.o *.ko .*.o.cmd .*.ko.cmd *.flags .lst *.lst Module*.symvers $(RM) -rf $(PWD)/tmp $(RM) -rf .tmp_versions $(RM) -f modules.order $(RM) -f Module.markers distclean: clean rm -f tags TAGS TMP=$(PWD)/tmp MODVERDIR=$(TMP)/.tmp_versions modules: mkdir -p $(MODVERDIR) ifdef ($(KSRC_OUTPUT)/.tmp_versions) -cp $(KSRC_OUTPUT)/.tmp_versions/*.mod $(MODVERDIR) endif ifeq ($(KSRC),$(KSRC_OUTPUT)) # We're not outputting elsewhere ifdef ($(KSRC)/.tmp_versions) -cp $(KSRC)/.tmp_versions/*.mod $(MODVERDIR) endif $(MAKE) -C $(KSRC) M=$(PWD) MODVERDIR=$(MODVERDIR) modules else # We've got a kernel with seperate output, copy the config, and use O= mkdir -p $(TMP) cp $(KSRC_OUTPUT)/.config $(TMP) $(MAKE) -C $(KSRC) M=$(PWD) MODVERDIR=$(MODVERDIR)) O=$(PWD)/tmp modules endif test-gpio: modules rmmod lp || true rmmod ppdev || true rmmod gpio_test || true rmmod gpio_parport || true insmod gpio_parport.ko insmod gpio_test.ko gpi=254 irq=7 install: modules for mod; $(list-m); do modprobe -r $mod || true; done install -d $(INSTALLDIR) install -m 644 -c $(addsuffix .ko,$(list-m)) $(INSTALLDIR) /sbin/depmod -a ${KVER} uninstall: rm -rf $(addprefix $(INSTALLDIR),$(addsuffix .ko,$(list-m))) /sbin/depmod -a ${KVER} endif # End of internal build .PHONY: TAGS tags RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \) -prune -o define all-sources ( find . $(RCS_FIND_IGNORE) -name '*.[chS]' -print ) endef TAGS: $(all-sources) | etags - tags: $(RM) -f $@ CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \ $(all-sources) | xargs ctags $$CTAGSF -a