VirtualBox

Changeset 84 in vbox


Ignore:
Timestamp:
Jan 17, 2007 10:27:28 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
17528
Message:

Support/linux/Makefile: fixed typo; 'make clean' should work even without KERN_DIR; cosmetical fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/linux/Makefile

    r81 r84  
    3131        r0drv/linux/thread-r0drv-linux.o \
    3232
    33 #
    34 # Where is everything?
    35 #
    36 KERN_DIR_CUR := /lib/modules/$(shell uname -r)/build
     33ifneq ($(MAKECMDGOALS),clean)
     34
     35# kernel base directory
    3736ifndef $(KERN_DIR)
    38 KERN_DIR := $(KERN_DIR_CUR)
    39 endif
    40 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
    41 ifneq ($(shell if test -d /usr/src/linux; then echo yes; fi),yes)
    42 $(error Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.)
    43 endif
    44 KERN_DIR := /usr/src/linux
    45 $(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.)
     37 KERN_DIR := /lib/modules/$(shell uname -r)/build
     38 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
     39  KERN_DIR := /usr/src/linux
     40  ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
     41   $(error Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.)
     42  endif
     43  $(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.)
     44 endif
     45else
     46 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
     47  $(error Error: KERN_DIR does not point to a directory.)
     48 endif
    4649endif
    4750
    4851# includes
    4952ifndef $(KERN_INCL)
    50 KERN_INCL = $(KERN_DIR)/include
    51 $(info Info: using $(KERN_INCL) as the include directory of your Linux kernel. If this is not correct, specify KERN_INFO=<directory> and run Make again.)
     53 KERN_INCL = $(KERN_DIR)/include
     54 $(info Info: using $(KERN_INCL) as the include directory of your Linux kernel. If this is not correct, specify KERN_INCL=<directory> and run Make again.)
    5255endif
    53 ifneq ($(shell if test -d $(KERN_INFO); then echo yes; fi),yes)
    54 $(error Error: unable to find the include directory for your current Linux kernel. Specify $KERN_INCL=<directory> and run Make again.)
     56ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
     57 $(error Error: unable to find the include directory for your current Linux kernel. Specify $KERN_INCL=<directory> and run Make again.)
    5558endif
    5659
    57 # Module install dir.
     60# module install dir.
    5861ifndef MODULE_DIR
    59 MODULE_DIR_TST := /lib/modules/$(shell uname -r)
    60 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
    61 MODULE_DIR := $(MODULE_DIR_TST)/misc
    62 else
    63 $(error Error: could not find the module directory for your current Linux kernel)
    64 endif
     62 MODULE_DIR_TST := /lib/modules/$(shell uname -r)
     63 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
     64  MODULE_DIR := $(MODULE_DIR_TST)/misc
     65 else
     66  $(error Error: could not find the module directory for your current Linux kernel)
     67 endif
    6568endif # MODULE_DIR unspecified
    6669
     
    8083#
    8184ifndef INCL
    82 INCL     := -I$(KERN_INCL) -I$(shell pwd) -I$(shell pwd)/include -I$(shell pwd)/r0drv/linux
    83 export INCL
     85 INCL    := -I$(KERN_INCL) -I$(shell pwd) -I$(shell pwd)/include -I$(shell pwd)/r0drv/linux
     86 export INCL
    8487endif
    8588KFLAGS   := -D__KERNEL__ -DMODULE -D__LINUX__ -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0
    8689ifndef CONFIG_VBOXDRV_FIXEDMAJOR
    87 KFLAGS   += -DCONFIG_VBOXDRV_AS_MISC
     90 KFLAGS  += -DCONFIG_VBOXDRV_AS_MISC
    8891endif
    8992ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
    90 KFLAGS   += -D__AMD64__
     93 KFLAGS  += -D__AMD64__
    9194else
    92 KFLAGS   += -D__X86__
     95 KFLAGS  += -D__X86__
    9396endif
    9497#ifeq ($(BUILD_TYPE),debug) - you'll have to enable this manually to get debug stuff.
     
    97100
    98101ifeq ($(KERN_VERSION), 24)
    99 #
    100102# 2.4
    101 #
    102 
    103 TOPDIR = $(KERN_DIR)
    104 
    105 MODULE_EXT := o
    106 
    107 EXTRA_CFLAGS := -DVBOX_LINUX_2_4
    108 
     103TOPDIR         = $(KERN_DIR)
     104MODULE_EXT    := o
     105EXTRA_CFLAGS  := -DVBOX_LINUX_2_4
    109106$(MODULE)-objs = $(OBJS)
    110 
    111107else
    112 #
    113108# 2.6 and later
    114 #
    115 
    116 MODULE_EXT := ko
    117 
    118 $(MODULE)-y  := $(OBJS)
     109MODULE_EXT    := ko
     110$(MODULE)-y   := $(OBJS)
    119111
    120112endif
     
    147139        rm -f /etc/vbox/module_not_compiled
    148140
     141endif # eq($(MAKECMDGOALS),clean)
     142
    149143clean:
    150144        for f in . linux r0drv r0drv/linux; do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
Note: See TracChangeset for help on using the changeset viewer.

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