Commit 777db9ab89d3abc35f741660c8914e10f8a6955b
1 parent
43ca4548
Simplify Makefile, to allow for cross-compiling.
Showing
1 changed file
with
0 additions
and
44 deletions
module/Makefile
| 1 | -# Comment/uncomment the following line to disable/enable debugging | |
| 2 | -#DEBUG = y | |
| 3 | 1 | |
| 4 | -# Add your debugging flag (or not) to CFLAGS | |
| 5 | -ifeq ($(DEBUG),y) | |
| 6 | - DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines | |
| 7 | -else | |
| 8 | - DEBFLAGS = -O2 | |
| 9 | -endif | |
| 10 | - | |
| 11 | -EXTRA_CFLAGS += $(DEBFLAGS) -I.. | |
| 12 | - | |
| 13 | -ifneq ($(KERNELRELEASE),) | |
| 14 | -# call from kernel build system | |
| 15 | - | |
| 16 | -#obj-m := tiny_tty.o tiny_serial.o tty0tty.o | |
| 17 | 2 | obj-m := tty0tty.o |
| 18 | 3 | |
| 19 | -else | |
| 20 | - | |
| 21 | -KERNELDIR ?= /lib/modules/$(shell uname -r)/build | |
| 22 | -PWD := $(shell pwd) | |
| 23 | -KBASE := /lib/modules/$(KVER) | |
| 24 | -KSRC ?= $(PWD) | |
| 25 | -KBUILD := $(KSRC) | |
| 26 | -MOD_DIR := $(KBASE)/kernel | |
| 27 | - | |
| 28 | -modules: default | |
| 29 | - | |
| 30 | -default: | |
| 31 | - $(MAKE) -C $(KERNELDIR) M=$(PWD) modules | |
| 32 | - | |
| 33 | -endif | |
| 34 | - | |
| 35 | 4 | clean: |
| 36 | 5 | rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions modules.order Module.symvers |
| 37 | 6 | |
| 38 | -depend .depend dep: | |
| 39 | - $(CC) $(CFLAGS) -M *.c > .depend | |
| 40 | - | |
| 41 | -install: modules | |
| 42 | - @( [ `id -u` -ne 1 ] || { echo "Must be root to install modules"; exit 1; } ) | |
| 43 | - rm -f $(MOD_DIR)/extra/tty0tty.ko | |
| 44 | - $(MAKE) -C $(KERNELDIR) M=$(PWD) O=$(KBASE) modules_install | |
| 45 | - depmod -a | |
| 46 | - | |
| 47 | -ifeq (.depend,$(wildcard .depend)) | |
| 48 | -include .depend | |
| 49 | -endif | |
| 50 | - | ... | ... |