diff options
author | Kyle K <kylek389@gmail.com> | 2013-01-22 21:24:28 -0600 |
---|---|---|
committer | Kyle Kaminski <kyle@kkaminsk.com> | 2013-01-22 21:24:28 -0600 |
commit | 8fdd43b49af70fd8712116b31010c032301a96b4 (patch) | |
tree | 0c26a12a33b77ca6ff79ca64b99e3ebb42c62b6b /Makefile | |
parent | 9618a5e3d3104dc92223f7a51283e603cce31628 (diff) | |
download | kernelhello-8fdd43b49af70fd8712116b31010c032301a96b4.tar.gz kernelhello-8fdd43b49af70fd8712116b31010c032301a96b4.tar.bz2 kernelhello-8fdd43b49af70fd8712116b31010c032301a96b4.zip |
place a simple /proc, support debug build with Makefile
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -1,14 +1,20 @@ -# causes weird file size, smaller than stripped? -ifeq ($(DEBUG),) - ccflags-y += -g -endif - # Makfile assignments: # := value at right is expanded and assigned at declaration time # = value at right is expanded only when it is used, hence it is a reference # ?= value at right is assigned only if the variable doesn't have a value # -# + +# run following to compile with debug options +# $ DEBUG=1 make +ifneq ($(DEBUG),) + DEBUG_FLAGS = -O0 -g -DHELLO_DEBUG +endif + +# see Documentation/kbuild/makefiles.txt +EXTRA_CFLAGS += $(DEBUG_FLAGS) + +ifneq ($(KERNELRELEASE),) +# call from kernel build system # objects that are part of hello module (hello.o) #hello-objs += main.o debug.o @@ -17,14 +23,20 @@ hello-y += main.o debug.o # .ko module to be created obj-m := hello.o +# normal makefile, not kbuild +else + KERNELDIR ?= /lib/modules/$(shell uname -r)/build # '-C' changes the dir # '-M' causes the the kernel's toplevel Makefile to move back into this dir # before trying to build 'modules' target +# and it informs kbuild that an external module is being built all: make -C $(KERNELDIR) KCPPFLAGS="-I$(CURDIR)" M=$(PWD) modules +endif + kclean: make -C $(KERNELDIR) M=$(PWD) clean |