VirtualBox

Changeset 971 in vbox


Ignore:
Timestamp:
Feb 19, 2007 10:22:54 AM (18 years ago)
Author:
vboxsync
Message:

unified additions linux/*/Makefile.module a bit with Support/linux/Makefile; make clean does even work if KERN_DIR is invalid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/module/Makefile.module

    r719 r971  
    3636        r0drv/linux/semaphore-r0drv-linux.o
    3737
    38 #
    39 # Where is everything?
    40 #
    41 ifeq ($(KERN_DIR),)
    42 KERN_DIR_CUR := /lib/modules/$(shell uname -r)/build
    43 ifeq ($(shell if test -d $(KERN_DIR_CUR); then echo yes; fi),yes)
    44 KERN_DIR := $(KERN_DIR_CUR)
     38ifneq ($(MAKECMDGOALS),clean)
     39
     40# kernel base directory
     41ifndef $(KERN_DIR)
     42 KERN_DIR := /lib/modules/$(shell uname -r)/build
     43 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
     44  KERN_DIR := /usr/src/linux
     45  ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
     46   $(error Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.)
     47  endif
     48  $(warning Warning: using /usr/src/linux as the source directory of your Linux kernel. If this is not correct, specify KERN_DIR=<directory> and run Make again.)
     49 endif
    4550else
    46 KERN_DIR = /usr/src/linux
    47 $(warning Warning: defaulting kernel sources to $(KERN_DIR). Specify KERN_DIR=<right-place> if this is not right.)
    48 endif
     51 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
     52  $(error Error: KERN_DIR does not point to a directory.)
     53 endif
    4954endif
    5055
    5156# includes
    52 ifeq ($(KERN_INCL),)
    53  ifeq ($(shell if test -d $(KERN_DIR)/include; then echo yes; fi),yes)
     57ifndef $(KERN_INCL)
    5458 KERN_INCL = $(KERN_DIR)/include
    55 # Instead of sticking to the standards, OpenSUSE 10.2 only puts a few include
    56 # files in /lib/modules/$(uname -r)/build/include, and puts the rest in
    57 # /lib/modules/$(uname -r)/source/include, which points into the kernel sources
    58   EXTRA_INCL = /lib/modules/$(shell uname -r)/source/include
    59  else
    60  KERN_INCL = /usr/src/linux/include
    61  $(warning Warning: defaulting to the includes in $(KERN_INCL). Specify KERN_INCL=<right-place> if this is not right.)
    62  endif
     59endif
     60ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
     61 $(error Error: unable to find the include directory for your current Linux kernel. Specify $KERN_INCL=<directory> and run Make again.)
    6362endif
    6463
    65 # Module install dir.
     64# module install dir.
    6665ifndef MODULE_DIR
    67 MODULE_DIR_TST := /lib/modules/$(shell uname -r)
    68 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
    69 MODULE_DIR := $(MODULE_DIR_TST)/misc
    70 else
    71 # MODULE_DIR := .
    72 $(error Unable to find the folder to install the additions driver to)
    73 endif
     66 MODULE_DIR_TST := /lib/modules/$(shell uname -r)
     67 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
     68  MODULE_DIR := $(MODULE_DIR_TST)/misc
     69 else
     70  $(error Unable to find the folder to install the additions driver to)
     71 endif
    7472endif # MODULE_DIR unspecified
    7573
     
    9997  KBUILD_EXTMOD := $(shell pwd)
    10098 endif
    101  INCL    += $(addprefix -I$(KBUILD_EXTMOD),/  /include /r0drv/linux)
     99 INCL    += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
    102100 export INCL
    103101endif
    104 KFLAGS   := -D__KERNEL__ -DMODULE -D__LINUX__ -DIN_RING0 -D_X86_ -DIN_RT_R0 -DIN_SUP_R0 -DVBGL_VBOXGUEST -DVBGL_HGCM -DVBOX_HGCM -DLOG_TO_BACKDOOR
     102KFLAGS   := -D__KERNEL__ -DMODULE -D__LINUX__ -DIN_RING0 -D_X86_ -DIN_RT_R0 -DIN_SUP_R0 \
     103            -DVBGL_VBOXGUEST -DVBOX_HGCM -DLOG_TO_BACKDOOR
    105104#ifeq ($(BUILD_TYPE),debug) - you'll have to enable this manually to get debug stuff.
    106105#KFLAGS   += -DDEBUG
     
    147146        @mkdir -p $(MODULE_DIR); \
    148147        install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
    149         PATH="$(PATH):/bin:/sbin" depmod -ae;
     148        PATH="$(PATH):/bin:/sbin" depmod -ae;
     149
     150endif # eq($(MAKECMDGOALS),clean)
    150151
    151152clean:
    152         rm -rf *.o .*.cmd .*.flags
     153        for f in . linux r0drv r0drv/linux; do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
     154        rm -rf .vboxdrv* .tmp_ver* vboxdrv.* Module.symvers Modules.symvers
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette